VivaPrep
← All modules

Math for AI

Linear algebra, probability, statistics, calculus intuition — no heavy proofs.

Start here

Not theorem-proving — working intuition for the handful of math ideas ML leans on daily. Four families:

  • Linear algebra — the language of data. A dataset is a grid of numbers (matrix); one example is a list of numbers (vector). The measures how similar two vectors are — shows up from recommendations to .
  • Probability & statistics — how ML reasons about uncertainty. A rarely says "definitely fraud," it says "87% likely." updates a probability given new evidence; distributions (normal, Bernoulli, Poisson) are the standard shapes randomness follows.
  • Calculus — how a learns. A is the slope: nudge the input, how much does the output move? Training is repeatedly asking "which way should each move to shrink the loss" — exactly what a answers. The extends this to functions-of-functions (a ) — and are the same idea.

You won't derive any of this from scratch — you need to explain what each piece means and why it's used, in plain words.

Core threads

  • Linear algebra: a matrix is a linear transformation; eigenvectors are directions that don't rotate under that transformation, eigenvalues are how much they stretch — this is the intuition behind (find directions of max ). = number of independent directions/information in a matrix.
  • Probability: — P(A|B) = P(B|A)P(A)/P(B) — updates belief given new evidence; classic viva format is a word problem (disease testing, spam filter). Know (mean of a distribution) and (spread) cold.
  • Distributions: Normal (continuous, symmetric, bell curve — most natural measurements), Bernoulli (single binary trial, e.g. click/no-click), Binomial (n Bernoulli trials), Poisson (count of rare events in fixed interval — e.g. fraud transactions/hour).
  • Calculus: = rate of change = slope; the entire training loop is "compute the of loss w.r.t. , step opposite to it." Know the σ'(x) = σ(x)(1-σ(x)) and the by heart — it *is* .

Viva angle

Expect word-problem Bayes questions ("a test is 99% accurate, disease prevalence is 1% — you test positive, what's the actual probability you have it?" — answer: much lower than 99%, this is the classic base-rate fallacy trap). Practice 5 of these until instant.

Visual reference

Bayes' theorem as a tree

1000 peopledisease (1%) — 10healthy (99%) — 990test + : ~10test − : ~0test + (false alarm): ~10test − : ~980≈10 real positives vs ≈10 false alarms → only ~50% of "+" results are real
Even with a 99%-accurate test, a 1% base rate means most positive results come from the huge healthy group's false alarms, not the small sick group — the base-rate fallacy.

Eigenvector intuition

vAv = λv
Transforming vector v by matrix A gives Av — still pointing along the same line, just stretched by factor λ. That unchanged direction is the eigenvector.

Gradient descent & learning rate

lossgood LRLR too high (overshoots)LR too low (crawls)
A good learning rate takes steady steps down the loss bowl to the minimum. Too small crawls painfully slowly; too large overshoots and can bounce out of the bowl entirely.

Cheatsheet

Bayes' theorem

P(A|B) = P(B|A)·P(A) / P(B)

Update belief given new evidence.

Eigen equation

A·v = λ·v

v = eigenvector, λ = eigenvalue.

Expectation

E[X] = Σ x·P(x)

Probability-weighted average.

Variance

Var(X) = E[(X − E[X])²]

Spread around the mean.

Chain rule

dy/dx = f'(g(x))·g'(x)

The math behind backprop.

Distributions at a glance

DistributionModels…Example
NormalContinuous, symmetric measurementsTransaction amounts (log scale)
BernoulliSingle binary trialIs this one transaction fraud?
Binomialn Bernoulli trialsFraud count in n transactions
PoissonRare events per fixed intervalFraud alerts per hour
  • = number of independent directions of information in a matrix.
  • = eigenvectors of the covariance matrix, ranked by ( captured).
  • : sample means trend normal regardless of the original distribution.
  • A rare condition + an imperfect test ⇒ most positives are false positives (base-rate fallacy).

Further study

Question bank

18 questions
#1Mediumprobabilitybayes

A disease affects 1% of a population. A test is 99% accurate (both and specificity). You test positive — what's the actual probability you have the disease?

#2Mediumlinear-algebra

What are eigenvectors and eigenvalues, intuitively? How does this connect to ?

#3Mediumlinear-algebra

What does the of a matrix tell you?

#4Easyprobability

Define and of a random variable. Why do both matter for understanding a distribution?

#5Mediumprobabilitydistributions

Compare Normal, Bernoulli, and Poisson distributions — give a real-world (ideally fintech) example of each.

#6Easycalculus

What is a , intuitively, and why is it the mathematical backbone of training?

#7Mediumcalculuschain-rule

State the and explain why it's essential for training neural networks.

#8Mediumprobabilitybayes

An SMS spam filter flags 5% of all legitimate messages as spam (false positive rate) and correctly catches 95% of actual spam. If 20% of all messages are spam, and a message is flagged, what's the probability it's actually spam?

#9Mediumstatistics

What is the , and why does it matter in practice?

#10Easylinear-algebrasimilarity

What does the between two vectors tell you, intuitively? How is it used in ML?

#11Mediuminformation-theoryentropy

What's the intuition behind entropy in information theory, and how does cross-entropy connect to the used for classification?

#12Hardinformation-theorykl-divergence

What is KL divergence, intuitively — how does it capture "how different" two probability distributions are?

#13Mediumstatisticsmle

What is Maximum Likelihood Estimation, at a high level?

#14Mediumstatisticshypothesis-testing

In plain language, what's a p-value, and what's the difference between a Type I and Type II error? Give an example.

#15Mediumstatisticsconfidence-interval

What does a 95% confidence interval actually mean? Why is the common interpretation wrong?

#16Easystatisticscorrelation

What's the difference between covariance and correlation, and why is correlation easier to interpret?

#17Hardcalculusoptimization

Why does a convex make optimization easier — what does convexity actually guarantee?

#18Easystatisticscausality

Why doesn't correlation imply causation? Give an example, and name what can create a spurious correlation.