Math & Statisticsbeginner4 min

Bayes’ Theorem

How to update a belief with new evidence, and why gut feeling fails on rare events.

Bayes' theorem tells you how to update a belief when new evidence arrives. You start with how likely something was before, then adjust it by how well the evidence fits. The classic interview trap is the rare disease test. If only one person in a thousand has the disease, a test that is 99 percent accurate still flags far more healthy people than sick ones, simply because healthy people vastly outnumber the sick. In ML, the same idea powers Naive Bayes and Bayesian optimisation.

Math & Statisticsbeginner4 min

Central Limit Theorem

Why averages look like a bell curve, whatever shape the data started with.

The Central Limit Theorem (CLT) states that the sample mean of N independent, identically distributed (i.i.d.) random variables with finite variance approaches a Normal distribution N(μ, σ²/N) as N → ∞, regardless of the underlying population distribution. In ML and experimentation, CLT powers confidence intervals, hypothesis testing (z-test, t-test), A/B testing variance estimation, and mini-batch gradient descent stability.

Math & Statisticsbeginner4 min

Law of Large Numbers

Why averages settle down to the true value as you collect more data.

The Law of Large Numbers (LLN) guarantees that the sample mean X̄_N of N independent, identically distributed (i.i.d.) random variables converges to the true population expectation μ as N → ∞. The Weak LLN proves convergence in probability; the Strong LLN proves almost sure convergence. LLN underpins Monte Carlo integration, empirical risk minimization in ML, A/B testing sample size stability, and casino profitability.

Math & Statisticsbeginner4 min

Expectation & Variance

The two numbers that describe almost any distribution: where it sits and how spread it is.

Expectation E[X] is the probability-weighted average of all possible values of random variable X. Variance Var(X) = E[(X - E[X])²] measures expected squared deviation from the mean, with properties Var(aX + b) = a²Var(X). In machine learning, E[X] and Var(X) form the foundation of loss functions, MSE bias-variance decomposition, batch normalization, and weight initialization.

Math & Statisticsbeginner4 min

Covariance vs Correlation

Covariance tells you direction; correlation tells you direction and strength independent of scale.

Covariance Cov(X,Y) = E[(X - E[X])(Y - E[Y])] measures joint variability of two random variables, but its magnitude depends on measurement units. Pearson Correlation r = Cov(X,Y) / (σ_X σ_Y) normalizes covariance to [-1, +1], providing a scale-invariant measure of linear association. Key interview topics include Pearson vs Spearman correlation, covariance matrix construction, and correlation vs causation.

Math & Statisticsbeginner5 min

Distributions You Must Know

The handful of distributions that come up again and again in ML interviews.

A distribution describes how likely each possible outcome is, and picking the right one tells you which loss function to use. For counts: Bernoulli is one yes-or-no trial, binomial is the number of successes across several trials, and Poisson is how many events happen in a fixed time, like calls per hour. For measurements: the normal distribution is the familiar bell curve, exponential is the waiting time between events, and beta describes uncertainty about a probability itself, such as a click rate.

Math & Statisticsbeginner4 min

Type I vs Type II Errors

False alarms versus missed cases, and why cutting one usually raises the other.

Statistical decisions suffer from two distinct error modes: Type I Error (α - False Positive / False Alarm) occurs when we reject a true null hypothesis H₀. Type II Error (β - False Negative / Missed Detection) occurs when we fail to reject a false null hypothesis H₀. Statistical Power (1 - β) is the probability of correctly detecting a real effect. Balancing α and β is a cost trade-off driven by business risk.

Math & Statisticsbeginner4 min

Vector Norms (L1, L2, L∞)

Different ways to measure a vector's size, and why L1 makes weights zero.

A norm measures how big a vector is, and different norms measure size in different ways. The L1 norm adds up the absolute values, like walking city blocks, and as a penalty it pushes many weights to exactly zero, which is why Lasso picks features. The L2 norm is ordinary straight-line distance, and as a penalty it shrinks all weights smoothly, which is Ridge. The L-infinity norm is just the single largest value, useful when the worst case is what matters.

Math & Statisticsbeginner4 min

Dot Product & Cosine Similarity

How we measure whether two embeddings mean the same thing.

Dot Product and Cosine Similarity are the two core metrics for comparing vectors in machine learning. Dot product u · v = ∑ u_i v_i = ||u|| ||v|| cos(θ) combines both directional alignment and vector magnitude. Cosine similarity normalizes by vector lengths, measuring purely directional angle alignment cos(θ) on a [-1, 1] scale. When vectors are pre-normalized to unit length (||u|| = 1), Dot Product and Cosine Similarity become 100% mathematically identical.

Math & Statisticsbeginner4 min

Correlation vs Causation

Two things moving together does not mean one causes the other.

Correlation vs Causation is a foundational distinction in data science and empirical inference. Correlation measures linear statistical association between variables P(Y | X), while Causation measures the intervention effect P(Y | do(X)) of changing X directly. Correlation does not imply causation due to Spurious Correlations, Reverse Causality, and Unobserved Confounders.

Math & Statisticsintermediate4 min

Conditional Independence

When two linked things stop being linked once you know a third.

Two things are conditionally independent if, once you know a third thing, learning one tells you nothing more about the other. Ice cream sales and drownings both rise in summer, so they look linked. But once you know the temperature, ice cream sales tell you nothing extra about drownings. This matters because it lets models break a huge, tangled probability problem into small separate pieces. Naive Bayes relies on it heavily, and so do Bayesian networks and causal reasoning.

Math & Statisticsintermediate4 min

Maximum Likelihood Estimation

Pick the settings that make your data look most likely. That is the whole idea.

Maximum Likelihood Estimation (MLE) estimates parameters θ of a probability distribution by maximizing the Likelihood function L(θ) = P(X | θ). For i.i.d. data, we maximize Log-Likelihood log L(θ) = ∑ log P(x_i | θ) because log turns products into computationally stable sums. MLE forms the statistical foundation for parameter fitting in OLS Linear Regression (under Gaussian noise), Logistic Regression, and Neural Networks (via Cross-Entropy).

Math & Statisticsintermediate4 min

MAP vs MLE

Two ways to fit a model, and how a prior belief quietly becomes regularisation.

Both pick the best settings for a model from data. Maximum likelihood, or MLE, picks whatever settings make the observed data most likely, and nothing else. MAP adds a prior belief about what sensible settings look like before seeing any data, which makes it a regularised version of MLE. Believing weights should be small and bell-shaped around zero gives you L2 regularisation, and a sharper, spikier belief gives you L1. With lots of data, the evidence outweighs the belief and the two agree.

Math & Statisticsintermediate5 min

Hypothesis Testing & p-values

How to make statistical decisions under uncertainty without being tricked by random noise.

Hypothesis testing evaluates whether an observed effect is statistically significant or merely random chance. We set a Null Hypothesis H₀ (no effect) and Alternative Hypothesis H₁ (effect exists), compute a test statistic, and derive a p-value: P(Data | H₀). If p-value < significance level α (typically 0.05), we reject H₀. Key interview topics include Type I vs Type II errors, p-value misinterpretations, Z-test vs t-test, and effect size vs p-value.

Math & Statisticsintermediate4 min

Statistical Power & Sample Size

Can your experiment actually detect the effect you are looking for?

Statistical Power is the probability that a hypothesis test correctly detects a real effect when one truly exists (1 - Type II error rate beta). Standard experimental design targets 80% statistical power (power = 0.80). Power depends on four interconnected variables: significance level alpha, effect size, sample size N, and population variance. Running an underpowered A/B test leads to false negatives, wasting engineering effort by discarding winning product features.

Math & Statisticsintermediate4 min

Confidence Intervals

What a confidence interval really means, which is not what most people think.

A Confidence Interval (CI) provides a range of plausible values for an unknown population parameter based on sample data. A 95% Confidence Interval means that if you repeated the exact sampling process 100 times, 95 of those calculated intervals would contain the true population parameter. Confidence intervals combine sample mean, standard error, and critical z-score (or t-score). They provide far richer context than single point estimates or p-values alone.

Math & Statisticsintermediate5 min

A/B Testing End to End

The gold standard for product decision-making at tech companies.

A/B testing evaluates product changes by splitting users randomly into Control (A) and Treatment (B) variants. End-to-end execution requires hypothesis definition, metric selection (Guardrail vs Primary), sample size calculation based on Minimum Detectable Effect (MDE) and Power (80%), randomized unit assignment, AA validation, and statistical testing. Key interview topics include sample ratio mismatch (SRM), peeking pitfall, novelty effects, and network spillovers.

Math & Statisticsintermediate5 min

Bayesian vs Frequentist

Two ways of thinking about probability, and what each one lets you say.

The two camps disagree about what probability means. A frequentist treats the true value, like a conversion rate, as fixed but unknown, and asks how often a method would be right over many repeated experiments. That gives p-values and confidence intervals. A Bayesian treats the value as uncertain, starts with a belief about it, and updates that belief with data. That gives a direct statement like a 95 percent chance the rate is in this range, which is what most people wrongly think a confidence interval means.

Math & Statisticsintermediate4 min

Eigenvectors & Eigenvalues

The directions a matrix only stretches, never turns, and why ML cares.

For a square matrix A, an eigenvector v is a non-zero vector that satisfies Av = λv. The scalar λ is the corresponding eigenvalue, representing the factor by which v is stretched or shrunk. In machine learning, eigenvectors define principal component axes in PCA, stationary distributions in Markov Chains (PageRank), spectral graph embeddings, and singular values in SVD.

Math & Statisticsintermediate5 min

Rank, Invertibility & Null Space

Why two copies of the same feature break linear regression.

The rank of a matrix is how many of its columns carry genuinely new information rather than repeating combinations of the others. A square matrix with full rank can be inverted, meaning you can undo it and solve for a unique answer. If some columns are combinations of others, information is duplicated and no unique answer exists. This bites in linear regression: if two features are perfectly related, like height in centimetres and in inches, the standard formula breaks because its matrix has no inverse.

Math & Statisticsintermediate5 min

Gradients, Jacobians & Hessians

Slopes, tables of slopes, and curvature: the calculus behind training.

These are three ways of measuring how a function changes. The gradient is a list of slopes, one per input, pointing where the loss rises fastest, so gradient descent steps the opposite way. The Jacobian is the same idea for a function with several outputs, a full table of slopes, and it is what backpropagation chains together layer by layer. The Hessian measures how the slopes themselves change, which is the curvature: whether you sit in a bowl, on a ridge or at a saddle.

Math & Statisticsintermediate5 min

Chain Rule Behind Backprop

The one rule from calculus that makes backpropagation possible.

Backpropagation (Backprop) is the algorithmic application of the multivariable calculus Chain Rule for computing exact loss gradients with respect to all trainable neural network weights. For composed functions y = f(g(x)), the chain rule multiplies local Jacobian matrices: dy/dx = (dy/dg) · (dg/dx). Reverse-Mode Automatic Differentiation traverses computation graphs backward from loss L, caching intermediate activation values to compute all N weight gradients in a single backward pass with O(N) compute complexity.

Math & Statisticsintermediate5 min

Convexity & Why It Matters

Why some models always find the best answer and neural networks do not.

A convex function is shaped like a bowl: draw a straight line between any two points on its curve, and the line never dips below it. That one property guarantees there is no false bottom, so any minimum you find is the best one. Linear regression, logistic regression and SVMs all have convex losses, which is why they train reliably. Deep neural networks do not. Their losses are full of saddle points and flat regions, yet gradient descent still finds good solutions surprisingly often.

Math & Statisticsintermediate5 min

Entropy, Cross-Entropy & KL Divergence

Uncertainty, surprise and the gap between two distributions, all in one family.

Entropy measures how unpredictable something is: a fair coin has high entropy, a coin that always lands heads has none. Cross-entropy measures how surprised your model is, on average, by what actually happens, so it is low when the model gives high probability to the right answers. KL divergence is the extra surprise caused by using your model instead of the truth. In training the true labels never change, so minimising cross-entropy and minimising KL divergence are exactly the same thing.

Math & Statisticsintermediate5 min

The Curse of Dimensionality

Add enough features and every point becomes roughly as far as every other.

As you add more features, the space your data lives in grows explosively, so the same number of data points ends up spread incredibly thin. Worse, in very high dimensions the distances between points become almost the same, so your nearest neighbour is barely nearer than the furthest one. That breaks methods built on distance, like k-nearest neighbours and k-means. The usual fixes are reducing dimensions with methods like PCA, choosing fewer and better features, or collecting much more data.

Math & Statisticsintermediate4 min

Simpson’s Paradox

A trend can reverse completely once you split the data into groups.

Simpson's Paradox occurs when a statistical trend or correlation observed in aggregated data reverses direction when the data is split into sub population subgroups. The paradox is driven by Confounding Variables that influence both group assignment and primary outcomes. Resolving Simpson's Paradox requires causal DAG modeling to determine whether to aggregate or disaggregate data based on real world causal relationships.

Math & Statisticsintermediate5 min

Markov Chains

Processes where only the present matters, not how you got there.

A Markov chain is a process that moves between states, where the next step depends only on where you are now, not on how you got there. Weather is a simple example: tomorrow's chance of rain depends only on today. The chain is described by a table of probabilities for moving from each state to every other. If every state can eventually reach every other and the chain does not cycle in a fixed rhythm, it settles into the same steady long-run mix, wherever it started.

Math & Statisticsadvanced4 min

Conjugate Priors

The prior that turns Bayesian updating into simple counting.

In Bayesian statistics you update a belief as data arrives, and that update usually means hard maths. A conjugate prior is a choice of starting belief that makes the update trivial, because the updated belief stays in the same family. With a Beta prior on a click rate, for example, updating is just adding your new clicks and non-clicks to two running counts. That is why Beta pairs with yes-or-no data, Dirichlet with category counts, and a normal prior with normally distributed measurements.

Math & Statisticsadvanced5 min

A/B Test Pitfalls: Peeking & Novelty

The common ways A/B tests lie to you, like peeking at results too early.

A/B Testing pitfalls corrupt experimental validity and lead teams to ship bad product features. Continuous Peeking (checking p-values daily without sample size correction) inflates false positive rates from 5% up to 30%+. Novelty and Primacy Effects cause temporary metric spikes or drops that fade over time. Sample Ratio Mismatch (SRM) occurs when the actual user split ratio deviates from the expected control/treatment assignment, signaling severe technical logging bugs.

Math & Statisticsadvanced5 min

Multiple Testing & Bonferroni

Test twenty things at once and one will look significant by pure luck.

If you run one test at a 5 percent significance level, you accept a 5 percent chance of a false alarm. Run twenty tests and you will probably get at least one false alarm by luck alone. That is the multiple testing problem, and it is why checking many metrics in one A/B test is risky. The Bonferroni correction divides your threshold by the number of tests, which is safe but strict. The Benjamini-Hochberg method controls the share of false discoveries instead, so it finds more real effects.

Math & Statisticsadvanced5 min

Singular Value Decomposition

Breaking any table of numbers into rotate, stretch, rotate. It powers PCA and more.

Singular value decomposition, or SVD, breaks any table of numbers into three simpler pieces: a rotation, a stretch along a few independent directions, and another rotation. The stretch amounts, called singular values, say how much each direction matters. Keep only the biggest few and throw the rest away, and you get the best possible compressed version of the original table. That one idea sits behind PCA, image compression, recommenders that fill in missing ratings, and early topic models for text.

Math & Statisticsadvanced5 min

LU, QR & Cholesky

LU, QR and Cholesky: three ways to split a matrix so equations solve fast.

These three methods split a matrix into simpler triangular pieces so that solving equations becomes quick and stable. LU splits it into a lower and an upper triangle, the general workhorse for solving systems of equations. QR splits it into a rotation and an upper triangle, the numerically safest way to fit linear regression. Cholesky only works on symmetric positive-definite matrices, such as covariance matrices, but there it runs about twice as fast as LU, so it is the standard choice.

Math & Statisticsadvanced4 min

Positive Definite Matrices

The matrix version of a positive number, and why it means one clear minimum.

A positive definite matrix is the matrix version of a positive number. Picture a loss surface: if the matrix describing its curvature is positive definite, the surface curves upward in every direction, like a bowl. A bowl has exactly one lowest point, so optimisation cannot get stuck anywhere else. In machine learning you meet them as covariance matrices, as the curvature at a true minimum of a loss, and as the kernel matrices an SVM needs for its maths to work.

Math & Statisticsadvanced5 min

Taylor Expansions in Optimization

Approximating a curve with a line or a bowl, which is how optimisers move.

A Taylor expansion approximates a complicated function near a point using simple pieces: its value there, its slope and its curvature. Using just the slope gives a straight-line approximation, and following that line downhill is exactly what gradient descent does. Adding the curvature gives a bowl-shaped approximation, and jumping straight to the bottom of that bowl is Newton's method. That is why Newton's method needs far fewer steps, but each step costs much more, since curvature is expensive to compute for large models.

Math & Statisticsadvanced5 min

Lagrange Multipliers

How to optimise something when you are not allowed to break a rule.

Lagrange Multipliers optimize a objective function f(x) subject to equality constraints g(x) = 0 or inequality constraints h(x) ≤ 0. The technique constructs the Lagrangian function L(x, λ) = f(x) + λ g(x). At constrained optimal points, the gradient of the objective function ∇f(x) must be parallel to the gradient of the constraint ∇g(x), yielding ∇f(x) + λ ∇g(x) = 0. For inequality constraints, the Karush-Kuhn-Tucker (KKT) conditions provide the necessary first-order optimality criteria, underpinning SVM dual formulations.

Math & Statisticsadvanced5 min

JS Divergence & Wasserstein Distance

Ways to measure how different two distributions are, and why GANs care.

Measuring distance between two probability distributions P and Q is a core problem in generative modeling (GANs, VAEs). Kullback-Leibler (KL) Divergence is asymmetric and explodes to infinity when distributions do not overlap. Jensen-Shannon (JS) Divergence symmetrizes KL divergence, producing a bounded metric [0, ln(2)]. Wasserstein Distance (Earth Mover's Distance) measures the minimal work required to transport probability mass from P to Q, providing smooth, non-vanishing gradients even when distributions have completely disjoint support.

Math & Statisticsadvanced5 min

Mutual Information

How much knowing one thing tells you about another, even when the link is not a straight line.

Mutual information measures how much knowing one thing reduces your uncertainty about another. If knowing someone's postcode tells you a lot about their income, the two share a lot of mutual information. Unlike correlation, which only catches straight-line relationships, it catches any kind of dependence, including curved or patchy ones, and it is zero only when the two are truly unrelated. It is used to pick useful features, and it is the idea behind contrastive learning, which trains models by matching related pairs.

Math & Statisticsadvanced5 min

Sampling: Bootstrap, MCMC, Importance

Bootstrapping, importance sampling and MCMC: learning about a distribution by drawing from it.

These methods learn about a distribution by drawing samples from it. Bootstrapping resamples your own data with replacement many times to see how much a result would vary, giving confidence intervals without assuming a formula. Importance sampling draws from an easier distribution and reweights the samples to correct for it, which helps with rare events. Markov chain Monte Carlo takes a long random walk designed so the places it visits follow the distribution you want, even when that distribution is too complex to sample directly.

Math & Statisticsadvanced5 min

Causal Inference: DAGs & Confounders

How to reason about what causes what, not just what moves together.

Causal Inference provides mathematical tools (Judea Pearl's Structural Causal Models and DAGs) to estimate true causal effects from observational data. Directed Acyclic Graphs (DAGs) represent causal assumptions visually with nodes (variables) and directed arrows (causal paths). Key graph structures include Confounders (common causes), Colliders (common effects), and Mediators (intermediate steps), determining which variables must be controlled or un-conditioned to block spurious backdoors.

Math & Statisticsadvanced5 min

Propensity Score Matching

Measuring an effect fairly when you could not run a proper experiment.

Propensity score matching estimates the effect of a treatment when you could not run a proper randomised experiment. The problem is that people who chose the treatment may differ from those who did not. So for each person you estimate the probability they would have received the treatment, given everything you know about them. That number is the propensity score. You then compare treated and untreated people with similar scores, which balances the visible differences. It cannot fix differences you never measured.

SCROLL · SAVE · TAP TO GO DEEPER