Sums and Products

Summation notation writes repeated addition compactly.

The symbol \sum means "sum".

Σ3i=1xᵢ=x₁+x₂+x₃
Summation notation compresses repeated addition.

A Small Sum

This expression

i=13xi\sum_{i=1}^{3} x_i

means:

add x_1, x_2, and x_3

So if

x1=2,x2=4,x3=6x_1 = 2,\quad x_2 = 4,\quad x_3 = 6

then:

i=13xi=2+4+6=12\sum_{i=1}^{3} x_i = 2 + 4 + 6 = 12
MATH-C01-T06-001Exercise: Compute a short sum

If x1=3x_1 = 3, x2=4x_2 = 4, and x3=5x_3 = 5, what is i=13xi\sum_{i=1}^{3} x_i?

Compute it first, then check your number.

HintExpand first

Write the sum as x1+x2+x3x_1 + x_2 + x_3.

SolutionExpansion

Expand the summation:

i=13xi=x1+x2+x3=3+4+5=12\sum_{i=1}^{3} x_i = x_1 + x_2 + x_3 = 3 + 4 + 5 = 12

The first equality expands the notation. The second substitutes the given values. Keeping those steps separate prevents many mistakes.

Reading the Parts

In

i=1nxi\sum_{i=1}^{n} x_i

read the parts like this:

i = 1        start with i equal to 1
n            stop at n
x_i          add the i-th value of x

The index ii is a counter. It moves from the starting value to the ending value.

The counter is temporary. After the sum is complete, ii has done its job.

MATH-C01-T06-002Exercise: Count the terms

How many terms are in this sum?

i=15xi\sum_{i=1}^{5} x_i

Compute it first, then check your number.

HintList the counter values

The counter ii starts at 1 and stops at 5.

SolutionCounter values

The counter takes the values:

1, 2, 3, 4, 51,\ 2,\ 3,\ 4,\ 5

so there are 5 terms. The upper limit is included because the sum runs from 1 through 5.

Product Notation

The symbol \prod means repeated multiplication.

For example:

i=13xi=x1x2x3\prod_{i=1}^{3} x_i = x_1 x_2 x_3

If

x1=2,x2=3,x3=4x_1 = 2,\quad x_2 = 3,\quad x_3 = 4

then:

i=13xi=234=24\prod_{i=1}^{3} x_i = 2 \cdot 3 \cdot 4 = 24

Product notation appears less often at the beginning than sums, but it is useful in probability.

MATH-C01-T06-003Exercise: Compute a product

If x1=2x_1 = 2, x2=3x_2 = 3, and x3=4x_3 = 4, what is i=13xi\prod_{i=1}^{3} x_i?

Compute it first, then check your number.

HintExpand first

Write the product as x1x2x3x_1x_2x_3.

SolutionMultiplication
i=13xi=x1x2x3=234=24\prod_{i=1}^{3} x_i = x_1x_2x_3 = 2 \cdot 3 \cdot 4 = 24

Product notation works like summation notation, but the repeated operation is multiplication instead of addition.

Why Sums Matter in ML

Sums appear everywhere:

  • dot products
  • averages
  • losses over a dataset
  • probabilities over possible outcomes
  • gradients that collect many contributions

For example, an average loss often has this shape:

1ni=1ni\frac{1}{n}\sum_{i=1}^{n} \ell_i

Read it as:

add the loss for each example
divide by the number of examples
MATH-C01-T06-004Exercise: Average loss

Three examples have losses 22, 55, and 88.

What is the average loss?

Compute it first, then check your number.

HintUse the average pattern

First compute 2+5+82 + 5 + 8, then divide by 3.

SolutionAverage
2+5+83=153=5\frac{2 + 5 + 8}{3} = \frac{15}{3} = 5

The numerator is the total loss across the three examples. Dividing by 3 turns that total into an average.

Next, we turn these habits into a practical method: reading formulas aloud.