← Math learning path
Quick reference · Math
Formula sheet
Every formula you will meet in the course, said in plain words, with where machine learning uses it. Use it to check a line, then return to the lesson that explains why.
Algebra and functions
| Formula | In words | Where ML uses it |
|---|
y = m·x + b | A straight line: m is the slope, b is where it crosses the y-axis. | Linear regression: ŷ = w·x + b |
|---|
m = (y₂ − y₁) / (x₂ − x₁) | Slope: rise over run. | The weight is a slope: change in prediction per unit of the input. |
|---|
a^m · a^n = a^(m+n), (a^m)^n = a^(mn) | Powers add when you multiply, multiply when you stack. | Squared error, polynomial features. |
|---|
log(a·b) = log a + log b | Logs turn products into sums. | Log-likelihood, log loss: sums are easier to optimise than products. |
|---|
e^(ln x) = x, ln(e^x) = x | Exponential and log undo each other. | Softmax and sigmoid. |
|---|
σ(z) = 1 / (1 + e^(−z)) | Sigmoid: squeezes any number into 0 to 1. | Logistic regression probabilities. |
|---|
|a| = a if a ≥ 0, −a if a < 0 | Absolute value: distance from zero. | Mean absolute error, L1 penalty. |
|---|
Algebra and functions lessons →
Vectors and matrices
| Formula | In words | Where ML uses it |
|---|
u·v = u₁v₁ + u₂v₂ + … + uₙvₙ | Dot product: multiply matching entries and add. | Every weighted sum: w·x. |
|---|
‖v‖ = √(v₁² + v₂² + … + vₙ²) | Length of a vector (L2 norm). | Distances in kNN, ridge penalty. |
|---|
‖v‖₁ = |v₁| + … + |vₙ| | L1 norm: add the absolute entries. | Lasso penalty. |
|---|
cos θ = u·v / (‖u‖ ‖v‖) | Cosine similarity: do they point the same way? | Text and embedding similarity. |
|---|
(AB)ᵢⱼ = row i of A · column j of B | Matrix product. Inner sizes must match: (m×n)(n×p) = (m×p). | A whole layer of a neural network: XW. |
|---|
(AB)ᵀ = BᵀAᵀ | Transpose flips rows and columns; it reverses a product. | Deriving normal equations. |
|---|
det [[a, b], [c, d]] = ad − bc | 2×2 determinant: how much a matrix scales area. | Invertibility check. |
|---|
A v = λ v | Eigenvector: A only stretches it by λ. | PCA, covariance structure. |
|---|
w = (XᵀX)⁻¹ Xᵀ y | Least-squares weights in one step. | Linear regression, the closed form. |
|---|
Linear algebra lessons →
Calculus
| Formula | In words | Where ML uses it |
|---|
f′(x) = lim (f(x+h) − f(x)) / h | Derivative: the rate of change at one point. | How much the loss changes when a weight changes. |
|---|
d/dx xⁿ = n·xⁿ⁻¹ | Power rule. | Squared error: d/dw w² = 2w. |
|---|
d/dx (f + g) = f′ + g′, d/dx (c·f) = c·f′ | Sum and constant rules. | Loss = sum over rows. |
|---|
d/dx f(g(x)) = f′(g(x)) · g′(x) | Chain rule: multiply the rates along the chain. | Backpropagation. |
|---|
d/dx eˣ = eˣ, d/dx ln x = 1/x | Two derivatives to remember. | Log loss, softmax. |
|---|
σ′(z) = σ(z)(1 − σ(z)) | Derivative of the sigmoid. | Logistic regression gradient. |
|---|
∇L = (∂L/∂w₁, …, ∂L/∂wₙ) | Gradient: one slope per weight. | The direction of steepest increase. |
|---|
w ← w − η · ∇L | Gradient descent: step downhill. η is the learning rate. | Training almost every model. |
|---|
∫ₐᵇ f(x) dx | Area under a curve between a and b. | Probability density, expected values. |
|---|
Derivatives lesson →
Probability
| Formula | In words | Where ML uses it |
|---|
P(A) = favourable / total | Chance when outcomes are equally likely. | Class frequencies. |
|---|
P(A or B) = P(A) + P(B) − P(A and B) | Do not double count the overlap. | |
|---|
P(A and B) = P(A) · P(B) (independent) | Independent events multiply. | Naive Bayes assumption. |
|---|
P(A | B) = P(A and B) / P(B) | Chance of A once you know B happened. | Every conditional model: P(churn | features). |
|---|
P(A | B) = P(B | A) · P(A) / P(B) | Bayes' rule: flip the condition. | Naive Bayes, medical tests. |
|---|
E[X] = Σ x · P(x) | Expected value: the long-run average. | Expected loss and expected cost. |
|---|
Var(X) = E[(X − μ)²] = E[X²] − μ² | Variance: average squared distance from the mean. | Bias–variance. |
|---|
Binomial: P(k) = C(n, k) pᵏ (1−p)ⁿ⁻ᵏ | k successes in n tries. | Likelihood of coin-flip data. |
|---|
Normal: f(x) = 1/(σ√(2π)) · e^(−(x−μ)²/(2σ²)) | The bell curve with mean μ and spread σ. | Noise assumptions, z-scores. |
|---|
Probability lessons →
Statistics
| Formula | In words | Where ML uses it |
|---|
mean = (x₁ + … + xₙ) / n | The balance point. | Baselines, centring. |
|---|
median = middle value when sorted | Half above, half below. Ignores outliers. | Skewed data such as prices. |
|---|
s² = Σ(xᵢ − x̄)² / (n − 1) | Sample variance. Divide by n for a whole population. | Scaling features. |
|---|
s = √s² | Standard deviation: typical distance from the mean, in the data's units. | Standardising. |
|---|
z = (x − μ) / σ | How many standard deviations from the mean. | StandardScaler, outlier checks. |
|---|
cov(x, y) = Σ(xᵢ − x̄)(yᵢ − ȳ) / (n − 1) | Do they move together? | PCA. |
|---|
r = cov(x, y) / (sₓ · s_y) | Correlation: covariance on a −1 to 1 scale. | Feature screening. Not causation. |
|---|
SE = s / √n | Standard error of a mean: how much a sample mean wobbles. | Error bars, tests. |
|---|
95% interval ≈ x̄ ± 1.96 · SE | A range built by a method that covers the truth 95% of the time. | Reporting accuracy honestly. |
|---|
Statistics lessons →
Hypothesis tests
| Formula | In words | Where ML uses it |
|---|
H0: no difference. H1: there is one. | State the boring claim and the claim you hope to support, before looking. | Every test. |
|---|
α = 0.05 | The false-alarm rate you accept, chosen in advance. | Significance level. |
|---|
z = (x − μ) / σ | Distance from the mean in standard deviations. | Known spread or large samples. |
|---|
t = (x̄ − μ₀) / (s / √n), df = n − 1 | Sample mean against a claim, in standard errors. Fatter tails than z. | Small samples, unknown spread. |
|---|
t = (x̄₁ − x̄₂) / √(s₁²/n₁ + s₂²/n₂) | Two independent groups (Welch). | A/B tests, group comparisons. |
|---|
t = d̄ / (s_d / √n) | Paired: the average of the differences over its standard error. | Two models on the same folds. |
|---|
p-value = P(statistic at least this extreme | H0 true) | How surprising the data is if there is no difference. Not the chance H0 is true. | Deciding: reject H0 if p < α. |
|---|
Cohen's d = (x̄₁ − x̄₂) / pooled s | Effect size: the gap in standard deviations. About 0.2 small, 0.5 medium, 0.8 large. | Is it big enough to matter? |
|---|
Type I = false alarm (rate α). Type II = a miss. Power = 1 − Type II. | The two ways to be wrong, and the chance of catching a real effect. | Planning sample size. |
|---|
Bonferroni: use α / m for m tests | Keep the overall false-alarm rate near α when you run many tests. | Testing many features or models. |
|---|
Normal, z, t and hypothesis tests →
Loss, metrics and regularisation
| Formula | In words | Where ML uses it |
|---|
MAE = (1/n) Σ |yᵢ − ŷᵢ| | Average miss, in the target's units. | Regression reporting. |
|---|
MSE = (1/n) Σ (yᵢ − ŷᵢ)², RMSE = √MSE | Average squared miss; punishes big misses. | Training linear models. |
|---|
R² = 1 − Σ(yᵢ − ŷᵢ)² / Σ(yᵢ − ȳ)² | Share of the variation explained, against guessing the mean. | Regression reporting. |
|---|
log loss = −(1/n) Σ [y ln p + (1−y) ln(1−p)] | Heavy penalty for confident wrong probabilities. | Logistic regression, neural nets. |
|---|
accuracy = (TP + TN) / all | Share right. | Balanced classes only. |
|---|
precision = TP / (TP + FP), recall = TP / (TP + FN) | Of those flagged, how many right; of the real ones, how many caught. | Churn, fraud. |
|---|
F1 = 2 · precision · recall / (precision + recall) | One number balancing both. | |
|---|
Ridge: loss + λ Σ wⱼ², Lasso: loss + λ Σ |wⱼ| | Penalise large weights to reduce overfitting. | Regularisation. |
|---|
error = bias² + variance + noise | Where a model's mistakes come from. | Choosing model flexibility. |
|---|
Optimization lessons →