# 6: Random Variables and Probability Distributions

Source: https://cca.twango.dev/AP-Statistics/chapter-6

# 6: Random Variables and Probability Distributions

A **random variable** assigns a numerical value to the outcome of a chance process. Discrete variables have countable possible values; continuous variables range over an interval.

## Discrete distributions

For probabilities $p(x)$, require $p(x)\ge0$ and $\sum_xp(x)=1$.

$$
\mu_X=E(X)=\sum_xxp(x),
$$

$$
\sigma_X^2=\sum_x(x-\mu_X)^2p(x),\qquad
\sigma_X=\sqrt{\sum_x(x-\mu_X)^2p(x)}.
$$

> [!warning] Review correction
> The original standard-deviation formula omitted the square root; the unsquared-root sum is the **variance**.

## Linear transformations

For $Y=a+bX$:

$$
\mu_Y=a+b\mu_X,\qquad \sigma_Y=|b|\sigma_X,\qquad
\sigma_Y^2=b^2\sigma_X^2.
$$

Adding a constant shifts the mean but leaves spread unchanged. Multiplication scales standard deviation by the **absolute** value of the multiplier.

## Combining random variables

Means always add or subtract:

$$
E(X\pm Y)=\mu_X\pm\mu_Y.
$$

For **independent** variables, variances add for both a sum and a difference:

$$
\operatorname{Var}(X\pm Y)=\sigma_X^2+\sigma_Y^2.
$$

More generally, covariance matters:

$$
\operatorname{Var}(aX+bY)=a^2\sigma_X^2+b^2\sigma_Y^2+2ab\operatorname{Cov}(X,Y).
$$

> [!warning] Review correction
> The original notes added variances without stating independence. Standard deviations themselves do not generally add.

## Binomial distribution

$X$ counts successes in a fixed number $n$ of independent trials with two outcomes and constant success probability $p$.

$$
P(X=k)=\binom nkp^k(1-p)^{n-k},\qquad k=0,\ldots,n.
$$

$$
\mu_X=np,\qquad \sigma_X=\sqrt{np(1-p)}.
$$

## Geometric distribution

$X$ counts the number of independent trials **up to and including the first success**, with constant success probability $p>0$; $X\ge1$.

$$
P(X=k)=(1-p)^{k-1}p,\qquad
\mu_X=\frac1p,\qquad
\sigma_X=\frac{\sqrt{1-p}}p.
$$

## Normal distributions

A linear combination of **independent normal** random variables is normal. Use the mean and variance rules above. Normal marginals alone, without independence or joint normality, do not guarantee a normal sum.

Related: [[chapter-5|Probability rules]] · [[chapter-8|Sampling distributions]]
