Introduction to Random Variables

In probability theory, a random variable is a variable whose possible values are numerical outcomes of a random phenomenon. Unlike a regular variable in algebra that takes on a specific value, a random variable can take on different values with certain probabilities.

Random variables are mathematical functions that map outcomes from a sample space to numerical values. They provide a way to quantify and analyze random events.

Example

Consider tossing a fair coin twice. Let X be the random variable representing the number of heads obtained. Then X can take values 0, 1, or 2, with probabilities P(X = 0) = 1/4, P(X = 1) = 1/2, and P(X = 2) = 1/4.

Discrete Random Variables

A discrete random variable is a random variable that can take on only a countable number of distinct values, such as integers or a finite set of values.

Key Characteristics

  • Can take on distinct, separate values
  • The set of possible values can be listed (finite or countably infinite)
  • Described by a Probability Mass Function (PMF)
  • PMF gives the probability of each possible value

Common Examples

  • Number of heads in a sequence of coin flips
  • Number of defective items in a batch
  • Count of customers arriving at a store
  • The sum of dice rolls

Visualization of a Discrete Random Variable

Probability Mass Function (PMF) for the number of heads in 3 coin tosses

Common Discrete Distributions

Bernoulli

Models a single trial with two outcomes (success/failure)

Learn More

Binomial

Number of successes in a fixed number of independent trials

Learn More

Poisson

Count of events occurring in a fixed interval

Learn More

Continuous Random Variables

A continuous random variable is a random variable that can take on any value within a continuous range or interval.

Key Characteristics

  • Can take on any value within an interval
  • The set of possible values is uncountable (infinite)
  • Described by a Probability Density Function (PDF)
  • The probability of any exact value is zero
  • Probabilities are calculated over intervals

Common Examples

  • Height or weight of a randomly selected person
  • Time until a component fails
  • Temperature at a specific location
  • Distance traveled by a particle

Visualization of a Continuous Random Variable

Probability Density Function (PDF) for a normal distribution

Common Continuous Distributions

Normal

Bell-shaped distribution central to statistics

Learn More

Uniform

Equal probability over an interval

Learn More

Exponential

Models time between events

Learn More

Discrete vs Continuous: Key Differences

Feature Discrete Random Variables Continuous Random Variables
Possible Values Countable, distinct values Uncountable, any value in an interval
Probability Description Probability Mass Function (PMF) Probability Density Function (PDF)
Probability at a Point Can be positive (P(X = x) ≥ 0) Always zero (P(X = x) = 0)
Cumulative Probability Sum of individual probabilities Integral of the density function
CDF Step function Smooth function
Expected Value Calculation $E[X] = \sum_x x \cdot P(X = x)$ $E[X] = \int_{-\infty}^{\infty} x \cdot f(x) \, dx$

Interactive Exploration

Select a type of random variable to visualize its properties:

Select a distribution type and click "Generate" to visualize it.