TradeLabs AILearn

Random Variables

A random variable assigns numbers to uncertain outcomes, like a trade's profit. Learn discrete and continuous variables, expectation and variance, with examples.

Intermediate3 min readUpdated 3 Oct 2026
Markdown
Read firstBayes' Theorem
Lesson 6 of 46

A random variable is a way of describing an uncertain quantity with numbers. Tomorrow's return on a stock, the profit from your next trade and the number of trades that win this month are all random variables: you do not know their values in advance, but you can describe the range of possible values and how likely each is. Random variables are the building blocks of statistics, risk models and option pricing.

Discrete and continuous random variables#

TypeTakes valuesExamplesDescribed by
DiscreteCountable valuesNumber of winning trades in 10; whether a prediction market resolves yes (1) or no (0)Probability mass function
ContinuousAny value in a rangeDaily return; time until a price level is hitProbability density function

Describing a random variable#

MeasureMeaningLesson
Expected value (mean)The long run average valueExpected Value
Variance and standard deviationHow spread out the values areVariance and Standard Deviation
SkewnessWhether outcomes lean to one sideSkewness and Kurtosis
KurtosisHow heavy the tails areSkewness and Kurtosis
DistributionThe full set of probabilitiesProbability Distributions Explained

A discrete example#

Expectation and variance rules#

For random variables X and Y and constants a and b:

E[aX + b] = a × E[X] + b
Var(aX + b) = a² × Var(X)
E[X + Y] = E[X] + E[Y]
Var(X + Y) = Var(X) + Var(Y) + 2 × Cov(X, Y)

The last rule shows why correlation matters for portfolio risk: if two positions are positively correlated, their combined variance is larger than the sum of their separate variances. See Covariance and Correlation and Diversification.

Sums of independent trades#

If you take n independent trades with the same distribution:

E[total] = n × E[X]
SD[total] = √n × SD[X]

Expected profit grows with n, but the standard deviation grows only with √n. That is why a positive edge becomes more reliable over many trades. In the example, 100 trades have an expected total of $2,400 and a standard deviation of about $1,370. See Law of Large Numbers.

Continuous returns#

Daily returns are usually modelled as continuous random variables. A common simple model treats them as normally distributed, though real returns have fatter tails. Prices are often modelled with a lognormal distribution because prices cannot go below zero. See Normal Distribution, Lognormal Distribution and Fat Tails.

Why this matters for traders#

  • Risk: standard deviation and tail measures describe how much you can lose.
  • Sizing: knowing the variance of trade outcomes helps set position sizes. See Position Sizing.
  • Pricing: option prices are expected values of random payoffs. See Black-Scholes Model.
  • Simulation: Monte Carlo methods generate random variables to test strategies. See Monte Carlo Simulation.

Bernoulli variables and prediction markets#

A Bernoulli random variable takes the value 1 with probability p and 0 otherwise. A prediction market share that pays $1 if an event happens is exactly this: its expected value is p dollars and its variance is p × (1 minus p). Variance is highest at p = 0.5, which is why coin flip markets swing the most, and lowest near 0 or 1. See Binomial and Bernoulli Distributions.

Frequently asked questions#

What is a random variable?#

A variable whose value depends on the outcome of a random process, such as the return of a stock tomorrow or the profit of a trade.

What is the difference between discrete and continuous random variables?#

Discrete random variables take countable values, like the number of winning trades; continuous ones can take any value in a range, like a return.

Why do random variables matter in trading?#

They let traders describe uncertain outcomes with measures like expected value and standard deviation, which underpin risk management, sizing and pricing.

Next, learn the measures of a typical value in Mean, Median and Mode.

Check your understanding

3 quick questions on this lesson. Get them all right to finish it.

Turn on JavaScript to take the quiz.

Finished this lesson?Sign in to save your progress across devices.
Next lessonMean, Median and ModeThe mean, median and mode measure the centre of data in different ways. Learn when each is best for trading data, how outliers distort averages and geometric means.

Mentioned in