Discrete Random Variables

Chapter 5

Sec 5.1: Discrete RVs & Distributions

Sec 5.2: Mean & Standard Deviation

Sec 5.3: Binomial Distribution

Sec 5.4: Poisson Distribution

Types of Random Variables

graph TD A[Random Variable] --> B[Discrete]A --> C[Continuous]B --> B1[Finite Values
Countable]B --> B2[Infinite Countable
Listable]C --> C1[Normal
Distribution]B1 --> D[Binomial]B2 --> E[Poisson]classDef main fill:#A10022,color:#fff,stroke:#333;classDef sub fill:#F8FAFC,stroke:#1E293B;class A,B,C main;class B1,B2,C1,C2,D,E sub;
Discrete Random Variable:A random variable whose possible values can be listed. Usually involves counting (e.g., #of siblings, # of heads).

Probability Distributions

Definitions

Probability Distribution
A listing of possible values ($X$) and their corresponding probabilities ($P(X=x)$).
$\sum P(X=x) = 1$

Probabilities must be between 0 and 1.

Practice: Find the Missing P(x)

x (Rating)P(x)
1 Star0.10
2 Stars0.25
3 Stars0.40
4 Stars?

Probability Histogram

Law of Large Numbers

In a large number of independent observations, the proportion of times each value occurs will approximate the probability distribution.

Total Surveyed: 0

Empirical vs Theoretical

Solid:Empirical |Dashed:Theoretical

Discrete or Continuous?

1. Weight of a newborn

2. Defective bulbs in a box

3. Time waiting for bus

Mean / Expected Value ($\mu$)

Finding $\mu = E[X]$

$\mu_X = \sum x \cdot P(X=x)$

The long-run average value of observations.


Result: $\mu = 1.3$

$x$$P(x)$$x \cdot P(x)$
00.200?
10.425?
20.275?
30.075?
40.025?
Sum:?

Standard Deviation ($\sigma$)

Definition Formula

$\sigma = \sqrt{\sum (x - \mu)^2 P(X=x)}$

Measures the spread or variability of the random variable (Average distance from the mean).

Computing Formula

$\sigma = \sqrt{\sum x^2 P(X=x) - \mu^2}$

Often easier for hand calculations as it avoids subtracting the mean at every step.

Binomial Foundations

Factorials ($n!$)

Product of the first $k$ positive integers.

$k! = k(k-1)\cdots2\cdot1$
$0! = 1$

Ex: $3! = 3 \times 2 \times 1 = 6$

Binomial Coefficient $\binom{n}{x}$

Number of ways to choose $x$ successes in $n$ trials.

$\binom{n}{x} = \frac{n!}{x!(n-x)!}$

Read as "n choose x".

Bernoulli Trials (Conditions)

Repeated trials are Bernoulli trials if these conditions are met:

B

Binary

Success ($s$) or Failure ($f$).

I

Independent

Trials must not affect each other.

N

Number

Fixed number of trials ($n$).

SSuccess Probability ($p$) must remain constant.
Binomial Random Variable ($X$): The total number of successes in $n$ Bernoulli trials.

The Binomial Formula

$P(X=x) = \binom{n}{x} p^x (1-p)^{n-x}$

Shape of Binomial Distributions

$p < 0.5$
Right Skewed

$p = 0.5$
Symmetric

$p > 0.5$
Left Skewed

From Coin to Bell Curve

Simulate Coin Flips

Prob ($p$) = 0.5 (Fair Coin)

Formula Shortcuts

Mean: $\mu = np$
SD: $\sigma = \sqrt{np(1-p)}$
Sampling without Replacement:Approximation valid if sample size $n \le 5\%$ of population size.

Solved Example: Binomial

Problem: A student guesses randomly on a 5-question T/F quiz. What is the probability of getting exactly 3 correct?

1. Identify Conditions (BINS):
Binary, Independent, $n=5$ Fixed, $p=0.5$ Constant.
2. Choose Formula:
$\binom{5}{3} (0.5)^3 (0.5)^{5-3}$
3. Calculate:
$\binom{5}{3} = \frac{5!}{3!2!} = 10 \quad | \quad (0.5)^3 = 0.125$
$P(3) = 10 \times 0.125 \times 0.25 = \mathbf{0.3125}$
4. Mean (Just for fun):
$\mu = n \cdot p = 5 \cdot 0.5 = 2.5$ expected correct answers.

Poisson Distribution

Modeling events occurring in a fixed interval of time or space.

Formula

$P(X=x) = e^{-\lambda} \frac{\lambda^x}{x!}$

$\lambda$: Average number of events per interval.

Stats

$\mu = \lambda$
$\sigma = \sqrt{\lambda}$
Approximation Rule:Poisson can approximate Binomial if $n \ge 100$ and $np \le 10$. Then set $\lambda = np$.

Visualizing Poisson ($\lambda$)

Rain Simulation

Drops: 0

Even with a steady rate $\lambda$, the count ($x$) varies randomly.

Binomial vs Poisson

Binomial: Counting Successes in $n$ trials.
Poisson: Counting Events in an interval (Time/Area).

Why Approximate? Easier to calculate$e^{-\lambda}$ than massive factorials in Binomial.

Solved Example: Poisson

Problem: A coffee shop averages 4 customers per minute during rush hour. What is the probability of getting exactly 6 customers in the next minute?

1. Identify Parameter:
$\lambda = 4$ (Average rate), $x = 6$ (Target number)
(Interval is "next minute", matching rate unit)
2. Choose Formula:
$P(6) = \frac{e^{-4} 4^6}{6!}$
3. Calculate:
$e^{-4} \approx 0.0183 \quad | \quad 4^6 = 4096 \quad | \quad 6! = 720$
$P(6) = \frac{0.0183 \times 4096}{720} = \mathbf{0.1042}$
4. Stats:
Expected: $\mu = \lambda = 4$ customers.
SD: $\sigma = \sqrt{4} = 2$ customers.

Chapter 5 Summary

DistributionParametersMean ($\mu$)Std Dev ($\sigma$)
General DiscreteTable of $x, P(x)$$\sum x P(x)$$\sqrt{\sum (x-\mu)^2 P(x)}$
Binomial$n, p$$np$$\sqrt{np(1-p)}$
Poisson$\lambda$$\lambda$$\sqrt{\lambda}$

Binomial R Code


# n=10, p=0.5
dbinom(3, size=10, prob=0.5) # Exactly 3
pbinom(3, size=10, prob=0.5) # 3 or less
                        

Poisson R Code


# lambda=4
dpois(6, lambda=4) # Exactly 6
ppois(6, lambda=4) # 6 or less