If Σ means "add them all up", what if you need to multiply them all instead? Mathematics has a matching symbol for that: Π, the Greek capital letter pi. (Not the small π ≈ 3.14 of circles; just the same letter in capitals.)
Products appear less often than sums, but in some very important places. Probability multiplies: the chance that several independent things all happen is the product of their chances. The likelihood, the quantity that statistical models and many ML models are trained to make as large as possible, is a big Π. And growth over several periods multiplies too, which is why averaging growth rates needs a special "geometric" mean.
This lesson explains how to read Π, works through examples, shows where products appear in data science, and explains the logarithm trick that turns every Π into a Σ, which is how computers actually handle them.
What you need first: summation notation (Σ) explained and logarithm rules.
Key terms
- Π (capital pi): the product symbol, meaning "multiply together".
- Factorial, n!: the product 1 × 2 × 3 × … × n.
- Independent events: events where one happening doesn't change the chance of the other.
- Likelihood: the probability of the observed data under a model, usually a product of many probabilities.
- Geometric mean: the nth root of a product of n numbers, the right average for growth rates.
Reading Π
Π works exactly like Σ, except you multiply:
Πᵢ₌₁ⁿ xᵢ = x₁ × x₂ × x₃ × … × xₙ
Read it as "the product of x i, for i from 1 to n". The counter, limits and term mean exactly what they do for Σ.
| Sum | Product |
|---|---|
| Σᵢ₌₁⁴ i = 1 + 2 + 3 + 4 = 10 | Πᵢ₌₁⁴ i = 1 × 2 × 3 × 4 = 24 |
| start a total at 0, add each term | start a total at 1, multiply by each term |
A running product starts at 1, not 0, because multiplying anything by 0 gives 0.
Worked examples
Πᵢ₌₁³ (i + 1) = 2 × 3 × 4 = 24
Πₖ₌₁⁴ 2 = 2 × 2 × 2 × 2 = 2⁴ = 16. A constant multiplied n times is a power: Π c = cⁿ, just as Σ c = n·c.
Πᵢ₌₁³ xᵢ for x = [0.9, 0.8, 0.95]: 0.9 × 0.8 × 0.95 = 0.684.
Factorials
The product of the whole numbers from 1 to n has its own name and symbol: n factorial, written n!
n! = Πᵢ₌₁ⁿ i
5! = 1 × 2 × 3 × 4 × 5 = 120. It counts the number of ways to arrange n things in order: 5 books can be arranged on a shelf in 120 ways. Factorials grow even faster than exponentials, and they're the basis of counting and combinations in the Probability course. By convention, 0! = 1.
Products in Python
import math
print(math.prod([1, 2, 3, 4, 5]), math.factorial(5))
probs = [0.9, 0.8, 0.95]
print(round(math.prod(probs), 3))
product = 1
for p in probs:
product *= p
print(round(product, 3))
120 120
0.684
0.684
math.prod is Π for a list; NumPy has np.prod for arrays. The loop shows the idea: start at 1, multiply by each term.
Products in probability
If events are independent, the probability that they all happen is the product of their probabilities.
A delivery passes three independent checks with probabilities 0.9, 0.8 and 0.95. What's the chance it passes all three?
P(all pass) = Πᵢ pᵢ = 0.9 × 0.8 × 0.95 = 0.684, about 68%.
Notice how quickly products shrink: each check is likely to pass, but together there's a one-in-three chance that something fails. With 50 checks at 0.99 each, the chance all pass is 0.99⁵⁰ ≈ 0.61.
The likelihood: a big Π
You flip a coin 10 times and get 7 heads. If the coin's chance of heads is p, the probability of that exact sequence is a product: p for each head and (1 − p) for each tail:
L(p) = Πᵢ₌₁¹⁰ P(flipᵢ) = p⁷(1 − p)³
This is the likelihood. Statistics asks: which p makes the data we saw most likely? Try a few values, and plot the whole curve:
import numpy as np
import matplotlib.pyplot as plt
for p in [0.3, 0.5, 0.7, 0.9]:
print(p, f"{p ** 7 * (1 - p) ** 3:.6f}")
ps = np.linspace(0, 1, 300)
fig, ax = plt.subplots()
ax.plot(ps, ps ** 7 * (1 - ps) ** 3, lw=2)
ax.axvline(0.7, color="grey", ls="--")
ax.set_xlabel("p, the chance of heads")
ax.set_ylabel("likelihood of 7 heads in 10")
ax.set_title("The likelihood peaks at p = 0.7")
plt.show()
0.3 0.000075
0.5 0.000977
0.7 0.002224
0.9 0.000478
The likelihood is highest at p = 0.7: 7 heads out of 10, as common sense suggests. This idea, choosing the parameters that make the observed data most likely, is called maximum likelihood, and it's how logistic regression and many other models choose their coefficients.
Turning Π into Σ with logs
Notice how tiny the likelihoods above are. With thousands of data points, the product of thousands of probabilities becomes so small that a computer rounds it to zero, as shown in logarithm rules.
The fix is the product rule of logarithms, log(ab) = log(a) + log(b), which turns any product into a sum:
log(Πᵢ pᵢ) = Σᵢ log(pᵢ)
print(round(sum(math.log(p) for p in probs), 4))
print(round(math.log(math.prod(probs)), 4))
-0.3798
-0.3798
Both give the same answer, but the sum of logs never underflows. That's why ML code almost never computes a likelihood directly: it computes the log-likelihood, a Σ, and log loss is just its negative average.
The geometric mean: averaging growth
An investment grows 10% one year, falls 10% the next, then grows 20%. What's the average yearly growth? The ordinary average says (10 − 10 + 20)/3 = 6.67%. But growth multiplies:
1.1 × 0.9 × 1.2 = 1.188 overall.
The right average is the rate that, applied three times, gives the same result: the geometric mean, the cube root of the product:
(Πᵢ₌₁ⁿ xᵢ)^(1/n)
growth = [1.1, 0.9, 1.2]
print(round(math.prod(growth) ** (1 / len(growth)), 4))
1.0591
The true average is 5.91% a year, not 6.67%. Check: 1.0591³ ≈ 1.188 ✓. Whenever values are multiplied together, like growth rates, returns or ratios, use the geometric mean, not the ordinary one.
Practice
- Work out Πᵢ₌₁⁵ i and Πᵢ₌₂⁴ i².
Show the answer
1 × 2 × 3 × 4 × 5 = 120. 4 × 9 × 16 = 576.
- Write 3 × 6 × 9 × 12 in Π notation.
Show the answer
Πᵢ₌₁⁴ 3i.
- Three independent machines each work with probability 0.95. What's the chance all three work?
Show the answer
0.95³ ≈ 0.857.
- How many ways can 4 runners finish a race (no ties)?
Show the answer
4! = 24.
- Rewrite log(Πᵢ₌₁ⁿ pᵢ) as a sum.
Show the answer
Σᵢ₌₁ⁿ log(pᵢ).
Key takeaways
- Π means "multiply together", read just like Σ; a running product starts at 1.
- n! = Πᵢ₌₁ⁿ i counts arrangements of n things.
- The probability that independent events all happen is the product of their probabilities.
- The likelihood is a product; maximum likelihood picks the parameters that make the data most likely.
- log(Π pᵢ) = Σ log(pᵢ): computers use log-likelihoods to avoid underflow.
- Average growth rates with the geometric mean, (Π xᵢ)^(1/n).
Frequently asked questions
What does the Π symbol mean in maths?
Capital pi means "product": multiply together the expression after it for every value of the counter between the limits. It's the multiplying version of Σ.
What is the difference between Σ and Π?
Σ adds the terms together; Π multiplies them. An empty or starting sum is 0, while a starting product is 1.
Why do machine learning models use the log-likelihood instead of the likelihood?
The likelihood is a product of many probabilities, which becomes too small for a computer to store. Taking logs turns the product into a sum of ordinary-sized numbers with the same maximum.
What to learn next
- Learn the language of groups of things in sets and set notation for beginners.
- Revisit summation notation (Σ) explained.