Probability & distributions
A return is a random variable — you cannot know tomorrow’s, only its distribution of possibilities. Trading is the business of taking bets whose average outcome is positive while surviving the tails. This chapter builds the vocabulary — expectation, variance, the Normal, and crucially why markets are not Normal — that the rest of the course reasons in.
Random variables & expected value#
A random variable is a quantity whose value is uncertain — a trade’s return, tomorrow’s move. Its expected value is the probability-weighted average outcome: the long-run mean if you could replay the bet forever. For a discrete variable:
and for a continuous one, the integral against its density :
Expectation is linear: , always, even when and are dependent. This is the engine behind expectancy — a strategy’s edge is just the expected value of one trade, and the total is the sum of the parts. It is the single most important quantity in the whole course.
Proof: linearity of expectation#
Linearity is worth proving once because it holds unconditionally — no independence required — and that is exactly what makes expectancy add up trade by trade.
Let be the joint probability of and . By definition,
Split the sum and pull the constants out:
The inner sums are just the marginals — and — so
Nothing above assumed and were independent — the joint distribution carried all the dependence, and it dropped out.
Random variables, PDF and CDF#
Two functions fully describe a continuous random variable. The cumulative distribution function (CDF) gives the probability of landing at or below a level — it runs monotonically from 0 to 1:
The probability density function (PDF) is its derivative, , so probability is area under the density: . A single point has zero probability; only intervals carry mass. The CDF is the object behind quantiles and VaR (later on this page); the PDF is the bell curve you picture.
Variance & standard deviation#
Expectation tells you the center; variance tells you the spread. It is the expected squared distance from the mean:
The far-right form is the one you actually compute with. Expand the square inside the expectation and use linearity, remembering is a constant:
Since , the middle term is and it collapses:
A useful corollary: because a variance can never be negative, always — a special case of Jensen for the convex function .
Squaring makes it awkward to read (units of return-squared), so we usually quote the standard deviation , which is back in the units of the return itself. In finance is called volatility, and it is the denominator of the Sharpe ratio and the raw material of position sizing.
A key scaling fact: for independent returns, variance adds over time, so volatility grows with the square root of the horizon. Daily vol annualises as . That shows up again in the standard error and in the Sharpe annualisation — it is the same idea each time.
Covariance, correlation & diversification#
Variance describes one variable in isolation. Covariance measures how two move together — the expected product of their deviations from their means:
Positive covariance: when one is above its mean the other tends to be too. The second form comes from the same expand-and-cancel trick as the variance identity (indeed ). Covariance is hard to read on its own because its units are the product of the two variables’ units, so we normalise it into the unitless correlation coefficient:

For any real , a variance is non-negative, so
The right side is a quadratic in that is never negative, so its discriminant must be :
Taking square roots gives , which is exactly . Equality () happens only when and are perfectly linearly related. ■
Covariance is the whole reason diversification works. The variance of a two-position book is
When the two edges are uncorrelated the cross term vanishes and risk adds in quadrature — combined volatility grows like , not 2 — so the book’s return-to-risk improves. Negative covariance shrinks it further. This is the formal statement of “don’t put all your risk in one bet.”
Independent vs merely uncorrelated#
Independence means — knowing one tells you nothing about the other. Independence implies , but the converse is false. Correlation only sees linear co-movement; two variables can be strongly dependent yet have zero correlation. Classic case: symmetric about 0 and — is completely determined by , yet . In markets, tail dependence hides here: assets that look uncorrelated day to day can crash together, a nonlinear link a single will never show.
Conditional probability & Bayes’ theorem#
Trading is decision-making under partial information, and the language for updating beliefs as evidence arrives is conditional probability. The probability of given that occurred is
Rearranged, this says the joint probability factors two symmetric ways — — and equating the two halves gives Bayes’ theorem:
Write the definition of conditional probability both ways for the same joint event:
Solve the second for the shared numerator, , and substitute into the first:
The pieces have names worth knowing: is the prior (belief before evidence), the likelihood, the posterior (belief after evidence).
Let = “the strategy has a real edge” and = “its backtest looks good.” Suppose real edges are rare — — a real edge almost always backtests well, , but so do a lot of flukes, . Then
A gorgeous backtest lifts your confidence from 5% only to about 14% — still probably noise. Because the base rate of true edges is low, one good backtest is weak evidence. This is the quantitative reason the course demands permutation tests, walk-forward, and out-of-sample data before believing an edge.
The law of iterated expectations#
The averaging counterpart of Bayes is the law of iterated expectations(the “tower rule”): averaging the conditional average recovers the overall average.
The inner is a random variable — a different number for each value of . Averaging it over the distribution of weights each conditional mean by how often that condition occurs, and by the definition of the marginal that is just . For trading it means your overall expectancy is the probability-weighted blend of your per-regime expectancies: a strategy that only makes money in one regime has its edge diluted by how rarely that regime shows up.
The Normal distribution#
The Normal (Gaussian) is the bell curve, fully described by just its mean and standard deviation :
It earns its central place because sums of many small independent shocks tend toward it (the central limit theorem, next chapter), and because its thin tails make the math tractable. Under a Normal, outcomes cluster tightly: about 68% land within , 95% within , and 99.7% within . A 5-sigma day should happen roughly once every 14,000 years.
Fat tails — why returns aren’t Normal#
Markets did not read the textbook. Real return distributions are fat-tailed(leptokurtic): the peak is taller and narrower, and — the part that matters — the tails are far heavier than a Normal allows. Those “once every 14,000 years” 5-sigma days show up several times a decade. October 1987 was a ~20-sigma move under a Normal fit; under a Normal it is impossible, yet it happened.

You can see the same fact in real data. Below is edgekit’s return-distribution chart — a histogram of realised returns with a Normal fit laid over it. The overflowing tail bars are the risk a Normal model would have told you to ignore.

Skew & kurtosis#
Mean and variance are the first two moments. The next two describe the shape that fat tails live in.
Skewness#
The third standardised moment — the asymmetry of the distribution:
Negative skew means a long left tail: many small gains punctuated by rare large losses — the classic shape of short-option and mean-reversion strategies (and it is how a lot of blow-ups feel: fine, fine, fine, catastrophe). Positive skew is the opposite: many small losses and occasional large wins, the signature of trend-following. A Normal has zero skew.
Kurtosis#
The fourth standardised moment — how heavy the tails are:
A Normal has kurtosis 3, so people quote excess kurtosis : positive means fatter-than-Normal tails. Financial returns routinely show large positive excess kurtosis. High kurtosis is the formal statement of “fat tails.”
VaR & CVaR#
Since the tail is where you get hurt, we measure it directly. Value at Risk at confidence (say 95%) is the loss threshold you only breach of the time — the -quantile of the loss distribution:
VaR has a notorious flaw: it tells you the threshold you will breach but says nothing about how bad things get once you do. Conditional VaR (also Expected Shortfall) fixes that — it is the average loss in the worst of cases:
CVaR is the number to prefer, especially with fat tails: it looks into the tail rather than stopping at its edge. Because both are just quantiles and conditional means of the historical loss series, you estimate them empirically rather than from a Normal formula — which, again, would understate them.
import numpy as np
# empirical VaR / CVaR from a return series (no Normal assumption)
losses = -returns # losses as positive numbers
var95 = np.quantile(losses, 0.95) # breached 5% of the time
cvar95 = losses[losses >= var95].mean() # average loss beyond VaR
print(f"95% VaR: {var95:.3%}")
print(f"95% CVaR: {cvar95:.3%}") # always >= VaR; the honest tail numberIn practice you rarely trust a single historical tail estimate — the worst case in your sample is just the worst case you happened to see. edgekit’s Monte-Carlo tools resample the return stream thousands of times to build a distribution of terminal outcomes and drawdowns, giving you a bootstrapped tail rather than the one lucky (or unlucky) path history handed you. That is the subject of Monte Carlo.
Next: we only ever see a sample of the true distribution, so how much can we trust it? — Statistics for traders.


