Mathematical Notation

A compact shared vocabulary of symbols used throughout math and statistics. Knowing them lets you read likelihoods, probability statements, and model definitions without stumbling.

Sets and logic

We often work with the real numbers R\mathbb{R}. A set AA can be a subset of another, ABA \subset B, and an object can be an element of a set, xAx \in A. Two events combine via union ABA \cup B (either) and intersection ABA \cap B (both).

Logical shorthand: for all \forall, there exists \exists, and implies \Rightarrow. In probability we write distributed as XN(0,1)X \sim \mathcal{N}(0,1), and independence as XYX \perp Y (or the statistical form X ⁣ ⁣ ⁣YX \perp\!\!\!\perp Y).

Sums, products, and counting

The summation i=1nai=a1+a2++an\sum_{i=1}^{n} a_i = a_1 + a_2 + \cdots + a_n adds terms; the product i=1nai=a1a2an\prod_{i=1}^{n} a_i = a_1 a_2 \cdots a_n multiplies them. The factorial is n!=n(n1)21n! = n\,(n-1)\cdots 2 \cdot 1, and the binomial coefficient counts subsets:

(nk)=n!k!(nk)!.\binom{n}{k} = \frac{n!}{k!\,(n-k)!}.

Symbol reference

SymbolMeaningLaTeX
R\mathbb{R}real numbers\mathbb{R}
\inelement of\in
\subsetsubset of\subset
\cupunion\cup
\capintersection\cap
\forallfor all\forall
\existsthere exists\exists
\Rightarrowimplies\Rightarrow
\simdistributed as\sim
 ⁣ ⁣ ⁣\perp\!\!\!\perpindependent\perp\!\!\!\perp
\sumsummation\sum
\prodproduct\prod
n!n!factorialn!
(nk)\binom{n}{k}binomial coefficient\binom{n}{k}

Writing formulas in LaTeX

Worked example

For n=5n = 5 and k=2k = 2:

i=15i=15,i=15i=5!=120,(52)=12026=10.\sum_{i=1}^{5} i = 15,\qquad \prod_{i=1}^{5} i = 5! = 120,\qquad \binom{5}{2} = \frac{120}{2 \cdot 6} = 10.

Computing it

R

n <- 5; k <- 2
sum(1:n)        # 15
prod(1:n)       # 120
factorial(n)    # 120
choose(n, k)    # 10

Python

import math
n, k = 5, 2
print(sum(range(1, n + 1)))       # 15
print(math.prod(range(1, n + 1))) # 120
print(math.factorial(n))          # 120
print(math.comb(n, k))            # 10
15
120
120
10

Julia

n, k = 5, 2
sum(1:n)          # 15
prod(1:n)         # 120
factorial(n)      # 120
binomial(n, k)    # 10

Why it matters for statistics

Statistical models are written in this notation: likelihoods are products if(xi)\prod_i f(x_i), expectations are sums ixipi\sum_i x_i p_i, and independence assumptions (X ⁣ ⁣ ⁣YX \perp\!\!\!\perp Y) justify factoring joint distributions. Fluency here is the prerequisite for everything that follows.