Skip to content
Free public beta until December 4, 2026: every course is open, no card needed. After that, the first chapter of each course stays free and full access is a one-time $39 ($19 for up to 100 founding members chosen for helpful feedback). Your progress is kept. How the beta works

Summation notation and discrete functions

~12 min

Nearly every formula in this course is a sum over a finite list of numbers. An average brightness is one. So is a histogram count, a convolution sum, and a discrete Fourier coefficient. This section defines sigma notation as the bookkeeping tool for that kind of sum. It then extends the idea to sums over image pixels. There the counting runs over two directions at once, a row and a column. (linear-algebra's readiness chapter works the one-direction case in more depth. The practice questions below draw from its bank.)

Quick review

Practice from earlier coursework, pulled in for this topic.

From Linear Algebra — Vectors, Matrices, and the Geometry of Data

\sum_{i=1}^{4} a_i and \sum_{j=1}^{4} a_j are...

Correct! 🎉 Not quite.

Right on try — credit. Right — the answer had already been shown, so no credit this time. Next try is worth Answer shown after three tries — this one no longer earns credit. You chose to see the answer — this one earns no credit.

The index is a placeholder, not a label with meaning of its own — renaming it from i to j doesn't change which terms get added or in what order.

This condition would only make sense if i and j were separate quantities being compared; here they're just two different names for the same loop variable.

No numeric values are needed — the two sums are identical purely because the index is just a placeholder name, for any sequence a_1,\ldots,a_4.

Why

The summation index is a bound variable: its name has no effect on the sum's value. Both expressions add a_1+a_2+a_3+a_4.

Write out what each sum expands to term by term and compare -- the name of the index letter doesn't appear in the expanded sum.

From Linear Algebra — Vectors, Matrices, and the Geometry of Data

Evaluate \sum_{k=2}^{5} (2k - 3).

Correct! 🎉 Not quite.

Right on try — credit. Right — the answer had already been shown, so no credit this time. Next try is worth Answer shown after three tries — this one no longer earns credit. You chose to see the answer — this one earns no credit.

Why

Terms for k=2,3,4,5: 1, 3, 5, 7. Sum: 1+3+5+7 = 16.

Correct answer

Also accepted:

Why

List out the value of 2k-3 for each k from 2 to 5, then add the four results.

A double sum is just an ordinary sum done twice. First add up one row. Then do that for every row. Then add all the row totals together. Nothing about counting in two directions instead of one changes what "sum" means. It just says where to start and stop counting on two separate directions at once. Compare it to "every seat in every row of the theater": that needs both a row number and a seat number to be unambiguous.

The image-mean formula above is exactly "add up every pixel's brightness, then divide by how many pixels there are." That is the everyday meaning of "average." It only carries extra bookkeeping, the two sigma signs and their counting ranges, so a computer can carry it out without ever being told what a picture even is.

For a single list of numbers a_0, a_1, \dots, a_{n-1}, \sum_{i=0}^{n-1} a_i = a_0 + a_1 + \cdots + a_{n-1}. An image sum runs over two counters at once, row y and column x. So the sigma notation nests two sums, one per direction: \sum_{y=0}^{H-1}\sum_{x=0}^{W-1} I(x, y) is the sum of every pixel value in an H\times W image. It is computed by summing across each row, then adding the row totals together. The order of the two sums does not matter here, since addition never cares what order its terms arrive in. Dividing that double sum by the pixel count HW gives the image's mean brightness, \bar I = \frac{1}{HW}\sum_{y=0}^{H-1}\sum_{x=0}^{W-1} I(x, y), a quantity this course uses constantly, starting in Chapter 2.

Summing across one row of pixels

This bar chart is one row of an image, treated as a plain sequence of numbers. Watch the running total build as the sum adds one pixel at a time -- this is exactly the inner sum in the double-sigma formula above, before the outer sum adds row totals together.

Loading interactive…

Worked example

Computing a mean brightness by hand

  1. 1

    Find the mean brightness of the 2\times 3 image I = \begin{bmatrix} 100 & 150 & 200 \\ 50 & 100 & 150 \end{bmatrix}. Set up the double sum: H=2 rows, W=3 columns, so HW = 6 pixels total.

  2. 2

    Sum row y=0: 100+150+200 = 450. Sum row y=1: 50+100+150=300. Add the row totals: \sum_{y=0}^{1}\sum_{x=0}^{2} I(x,y) = 450+300 = 750

  3. 3

    Divide by the pixel count: \bar I = \frac{750}{6} = 125

Loading interactive…

Worked example

A second mean, on a bigger patch

  1. 1

    Find the mean brightness of the 2\times 4 image above -- half its pixels are 0, half are 255. Set up the double sum: H=2, W=4, so HW=8 pixels.

  2. 2

    Four pixels are 0, four are 255: total =4(0)+4(255)=1020.

  3. 3
    \bar I = \frac{1020}{8} = 127.5

Loading interactive…

Where this shows up

Manufacturing inspection

A camera checks a part on the line for a flaw: a scratch, a missing piece, an off color. Its first call often comes from nothing more than a handful of double-sum totals like \bar I. This mean gets figured over a small region of the image. A mean brightness far outside the normal range flags the part for closer review, or for pulling it off the line, before any fancier technique ever runs. The double sum is not a warm-up exercise here. It is the real math a factory line runs, millions of times a day, because it is cheap and exact.

Check your understanding (counts toward your progress)

Expand \sum_{y=0}^{1}\sum_{x=0}^{1} I(x,y) into a sum of four individual terms, with no sigma signs remaining.

In \sum_{y=0}^{H-1}\sum_{x=0}^{W-1} I(x,y), what does the order of the two sigma signs affect?

Correct! 🎉 Not quite.

Right on try — credit. Right — the answer had already been shown, so no credit this time. Next try is worth Answer shown after three tries — this one no longer earns credit. You chose to see the answer — this one earns no credit.

Addition is commutative and associative -- summing the same set of numbers in a different order never changes the total.

Both orderings touch every single pixel exactly once -- no pixel is included or excluded by swapping sum order.

The dimensions H and W are fixed by the image itself, unrelated to which sigma is written first.

Why

Since every term is added exactly once regardless of order, swapping the two sigma signs changes nothing about the result.

Find the mean brightness of \begin{bmatrix}0&255\\255&0\end{bmatrix}.

Correct! 🎉 Not quite.

Right on try — credit. Right — the answer had already been shown, so no credit this time. Next try is worth Answer shown after three tries — this one no longer earns credit. You chose to see the answer — this one earns no credit.

Why

The sum of all four entries is 0+255+255+0=510; dividing by the pixel count 4 gives \bar I = 127.5.

Correct answer

Also accepted:

Why

What does HW represent in the mean-brightness formula?

Correct! 🎉 Not quite.

Right on try — credit. Right — the answer had already been shown, so no credit this time. Next try is worth Answer shown after three tries — this one no longer earns credit. You chose to see the answer — this one earns no credit.

Diagonal length would involve a square root of a sum of squares, not a plain product.

The brightest possible value (255 for 8-bit images) is unrelated to the image's height and width.

Channel count is a separate property from spatial dimensions entirely.

Why

Height times width counts every distinct (x,y) pair exactly once -- the total pixel count.

Practice: Double sums by hand (3 problems · doesn’t affect your progress)

This 2\times 2 image has one black pixel and one white pixel on each diagonal. \begin{bmatrix}0&255\\255&0\end{bmatrix}. What is its mean brightness?

Correct! 🎉 Not quite.

Right on try — credit. Right — the answer had already been shown, so no credit this time. Next try is worth Answer shown after three tries — this one no longer earns credit. You chose to see the answer — this one earns no credit.

Why

Sum is 0+255+255+0=510; dividing by 4 pixels gives 127.5.

Correct answer

Also accepted:

Why

127.5

Every one of the nine pixels in a 3\times 3 image equals 80. Compute its mean brightness.

Correct! 🎉 Not quite.

Right on try — credit. Right — the answer had already been shown, so no credit this time. Next try is worth Answer shown after three tries — this one no longer earns credit. You chose to see the answer — this one earns no credit.

Why

Averaging n copies of the same value returns that value.

Correct answer

Also accepted:

Why

80

Expand \sum_{y=0}^{1}\sum_{x=0}^{1} I(x,y) into a sum of four individual terms, with no sigma signs left.

Feeling good about this section?

Take the section quiz

Every answer gets a full explanation at the end.

Graph settings

Calculator

Sign in to save highlights

Insert an equation

  • No matches.