Canadian flagMath101 · Independent Ontario learning libraryCreated and edited by Kamran
Probability and StatisticsGrades 9–123 min read

Random Variables

A random variable assigns a numerical value to each outcome of a random process, creating a probability distribution.

Cheat sheet
A random variable turns outcomes into numbers so probability questions can be analyzed with algebra and statistics.

Definition

A random variable $X$ is a function that assigns a real number to each outcome in a sample space. The capital letter names the variable; lowercase values such as $x$ represent possible outcomes of that variable.

For two coin tosses, $X$ might count heads. Then outcomes TT, HT, TH, HH map to $0,1,1,2$.

Discrete and continuous variables

A discrete random variable has countable possible values, such as number of absences or goals. A continuous random variable can take any value in an interval, such as time, height, or temperature under an idealized model.

Discrete probabilities are assigned to points; continuous probabilities are represented by areas over intervals.

Probability mass function

For a discrete variable, the probability mass function gives

$$ p(x)=P(X=x). $$

It must satisfy

$$ p(x)\ge0 $$

and

$$ \sum_xp(x)=1. $$

A table of values and probabilities is a valid distribution only when both conditions hold.

Worked example: number of heads

The value $1$ has higher probability because two sample outcomes map to it.

Cumulative probability

The cumulative distribution function is

$$ F(x)=P(X\le x). $$

For a discrete variable, it adds all probabilities at or below $x$. It never decreases and eventually approaches $1$.

Questions using “at most” correspond to $\le$, while “at least” corresponds to $\ge$ and may be easier through a complement.

Expected value

The mean or expected value of a discrete random variable is

$$ E[X]=\sum_xxP(X=x). $$

It is the long-run average over many repetitions, not necessarily a value the variable can actually take.

For the two-coin example, $E[X]=0(1/4)+1(1/2)+2(1/4)=1$.

Variance and spread

Variance measures average squared distance from the mean:

$$ \operatorname{Var}(X)=E[(X-\mu)^2]. $$

Standard deviation is its square root. Two random variables can share the same expected value while differing greatly in risk or variability.

Transforming a random variable

If $Y=aX+b$, then

$$ E[Y]=aE[X]+b. $$

Variance satisfies

$$ \operatorname{Var}(aX+b)=a^2\operatorname{Var}(X). $$

Adding a constant shifts outcomes without changing spread; scaling multiplies standard deviation by $|a|$.

Building a model

Define exactly what $X$ measures, list its possible values, and combine sample outcomes that produce the same value. Assign probabilities from equally likely outcomes, observed frequencies, or a stated model.

The validity of conclusions depends on whether the probability model matches the process.

Common mistakes

Treating the random variable as the random process itself. It is a numerical mapping of outcomes.

Assigning equal probabilities to variable values because sample outcomes are equal. Multiple outcomes may map to one value.

Accepting probabilities that do not total $1$. Check the distribution.

Interpreting expected value as a guaranteed next outcome. It is a long-run average.

Confusing discrete point probability with continuous probability. Continuous models use interval area.

Quick self-check

  • What numerical quantity does $X$ represent?
  • Is it discrete or continuous?
  • Have all possible values and their probabilities been included?
  • Are probabilities nonnegative and total $1$?
  • Do “at least” and “at most” translate to correct inequalities?
  • Are mean and spread interpreted as model summaries rather than guarantees?

Explore the idea

Probability sampler

Change one quantity at a time and connect what moves to Random Variables.

Works offline

success other outcome

What the model is showing Static example: with probability 0.50 over 20 trials, the expected count is 10 and the binomial variance is 5. A single observed count can differ.
Check your understanding

Try it yourself

Hints are part of learning. Open one whenever it makes the next step feel possible.

1 practice question
Question 1Read a discrete distribution · Gentle

Two fair coins are tossed and X counts heads. What is P(X ≥ 1)?

End of lesson

Nice work making it this far.

Understanding grows through return visits. Save this lesson, try the practice, or continue when you are ready.

Lesson complete

That one is yours now.

Random Variables is saved to My Learning. Take the win—you earned it.

1Your Math101 collectionlesson completed
Search 464 published lessons, 123 answer guides, courses, and learning tools.
Your experience

Settings

Ontario math tutoringWork with KamranBook ↗