Probability BasicsTopic #11 of 33

Random Variables

Discrete and continuous random variables, probability mass and density functions.

Overview

A random variable is a function that assigns a numerical value to each outcome in a sample space. It bridges probability theory with real-world data.

Types of Random Variables

TypeDescriptionExamples
DiscreteCountable valuesDice roll, number of defects
ContinuousAny value in an intervalHeight, weight, time

Discrete Random Variables

Probability Mass Function (PMF)

For discrete random variable XX:

P(X=x)=f(x)P(X = x) = f(x)

Properties:

  • f(x)0f(x) \geq 0 for all xx
  • f(x)=1\sum f(x) = 1

Cumulative Distribution Function (CDF)

F(x)=P(Xx)=txf(t)F(x) = P(X \leq x) = \sum_{t \leq x} f(t)

Properties:

  • 0F(x)10 \leq F(x) \leq 1
  • F(x)F(x) is non-decreasing
  • F()=0F(-\infty) = 0, F()=1F(\infty) = 1

Continuous Random Variables

Probability Density Function (PDF)

P(aXb)=abf(x)dxP(a \leq X \leq b) = \int_a^b f(x) \, dx

Properties:

  • f(x)0f(x) \geq 0 for all xx
  • f(x)dx=1\int_{-\infty}^{\infty} f(x) \, dx = 1
  • P(X=x)=0P(X = x) = 0 for any single point

CDF for Continuous Variables

F(x)=P(Xx)=xf(t)dtF(x) = P(X \leq x) = \int_{-\infty}^{x} f(t) \, dt

Relationship:

f(x)=dF(x)dxf(x) = \frac{dF(x)}{dx}

Key Formulas Summary

ConceptDiscreteContinuous
ProbabilityP(X=x)=f(x)P(X = x) = f(x)P(a<X<b)=f(x)dxP(a < X < b) = \int f(x)dx
CDFF(x)=f(t)F(x) = \sum f(t)F(x)=f(t)dtF(x) = \int f(t)dt
Sum/Integralf(x)=1\sum f(x) = 1f(x)dx=1\int f(x)dx = 1

Examples

Example 1: Discrete PMF

Rolling a fair die. XX = number on die.

P(X=x)=16for x=1,2,3,4,5,6P(X = x) = \frac{1}{6} \quad \text{for } x = 1, 2, 3, 4, 5, 6

Example 2: Discrete CDF

For the die:

F(3)=P(X3)=P(1)+P(2)+P(3)=36=0.5F(3) = P(X \leq 3) = P(1) + P(2) + P(3) = \frac{3}{6} = 0.5

Example 3: Continuous PDF

If f(x)=2xf(x) = 2x for 0x10 \leq x \leq 1:

P(0X0.5)=00.52xdx=[x2]00.5=0.25P(0 \leq X \leq 0.5) = \int_0^{0.5} 2x \, dx = \left[x^2\right]_0^{0.5} = 0.25

Example 4: Creating a PMF Table

Two coins flipped. XX = number of heads.

xx012
P(X=x)P(X=x)0.250.500.25

Joint Distributions

For two random variables XX and YY:

Discrete

P(X=x,Y=y)=f(x,y)P(X = x, Y = y) = f(x, y)

Marginal Distributions

P(X=x)=yP(X=x,Y=y)P(X = x) = \sum_y P(X = x, Y = y)

Independence

XX and YY are independent if:

P(X=x,Y=y)=P(X=x)×P(Y=y)P(X = x, Y = y) = P(X = x) \times P(Y = y)

Common Notation

SymbolMeaning
X,YX, YRandom variables
x,yx, ySpecific values
f(x)f(x)PMF or PDF
F(x)F(x)CDF
E(X)E(X)Expected value
Var(X)\text{Var}(X)Variance