Mathwords logoReference LibraryMathwords

Random Variable

A random variable is a variable whose value is determined by the outcome of a random process. It assigns a number to each possible result of an experiment, such as the number of heads when flipping three coins.

A random variable is a function that maps each outcome in a sample space to a real number. Random variables are classified as discrete if they take on a countable number of values (such as integers), or continuous if they can take on any value within an interval. Random variables are typically denoted by capital letters like XX or YY, while specific observed values are written in lowercase as xx or yy.

Key Formula

μX=E(X)=ixiP(X=xi)\mu_X = E(X) = \sum_{i} x_i \cdot P(X = x_i)
Where:
  • XX = the random variable
  • μX\mu_X = the mean (expected value) of the random variable
  • xix_i = each possible value the random variable can take
  • P(X=xi)P(X = x_i) = the probability that the random variable equals a particular value

Worked Example

Problem: Let X be the random variable representing the number of heads when flipping a fair coin twice. Find the probability distribution and the expected value of X.
Step 1: List all possible outcomes of flipping a coin twice and count the heads for each.
{HH,HT,TH,TT}\{HH, HT, TH, TT\}
Step 2: Identify the possible values of X. You can get 0, 1, or 2 heads, so X can equal 0, 1, or 2.
Step 3: Find the probability for each value. Out of 4 equally likely outcomes: TT gives 0 heads, HT and TH give 1 head, and HH gives 2 heads.
P(X=0)=14,P(X=1)=24=12,P(X=2)=14P(X=0) = \frac{1}{4}, \quad P(X=1) = \frac{2}{4} = \frac{1}{2}, \quad P(X=2) = \frac{1}{4}
Step 4: Calculate the expected value by multiplying each value of X by its probability and summing.
E(X)=014+112+214=0+0.5+0.5=1E(X) = 0 \cdot \frac{1}{4} + 1 \cdot \frac{1}{2} + 2 \cdot \frac{1}{4} = 0 + 0.5 + 0.5 = 1
Answer: The expected value of X is 1. On average, you get 1 head when flipping a fair coin twice.

Visualization

Why It Matters

Random variables are the foundation of statistics and probability theory. They give you a way to move from describing events in words ("it rains tomorrow") to working with numbers and formulas. Insurance companies use them to model claim amounts, pollsters use them to describe survey responses, and scientists use them to quantify measurement uncertainty.

Common Mistakes

Mistake: Confusing a random variable with a regular algebraic variable.
Correction: An algebraic variable like xx in 2x+3=72x + 3 = 7 has a single unknown value to solve for. A random variable represents many possible values, each with an associated probability. It describes a process, not an equation to solve.
Mistake: Forgetting that the probabilities in a discrete probability distribution must sum to 1.
Correction: When you list out P(X=xi)P(X = x_i) for every possible value, the total must equal exactly 1. If it doesn't, the distribution is incomplete or contains an error.

Related Terms

  • ProbabilityMeasures how likely each value of the variable is
  • Expected ValueThe long-run average of a random variable
  • EventA set of outcomes that a random variable maps to numbers
  • OutcomeIndividual result assigned a numerical value