1. The Geometry of Continuous Probability
A continuous random variable takes values in an uncountable continuum (such as the real interval $[a, b]$ or all of $\mathbb{R}$).
Because there are uncountably infinite points, the probability of a continuous random variable taking any exact single real value is strictly zero:
$$P(X = 3.14159265\dots) = 0$$
Instead of point probabilities, we assign probability to intervals via the area under a Probability Density Function (PDF) $f_X(x)$:
$$P(a \le X \le b) = \int_a^b f_X(x) , dx$$
text
2. Mathematical Formalism: PDF and CDF
2.1 The Probability Density Function (PDF)
A function $f_X: \mathbb{R} \to \mathbb{R}$ is a valid PDF if and only if:
- Non-negativity: $f_X(x) \ge 0$ for all $x \in \mathbb{R}$.
- Total Area Normalization: $$\int_{-\infty}^\infty f_X(x) , dx = 1$$
Critical Note on Scale: Unlike discrete PMFs, $f_X(x)$ is a density (probability per unit length), NOT a probability! Therefore, $f_X(x)$ can be strictly greater than 1. For example, if $X \sim \text{Uniform}(0, 0.1)$, then $f_X(x) = 10$ for $x \in [0, 0.1]$.
2.2 Relationship to the Cumulative Distribution Function (CDF)
The CDF $F_X(x)$ is continuous and differentiable almost everywhere:
$$F_X(x) = P(X \le x) = \int_{-\infty}^x f_X(t) , dt$$
By the Fundamental Theorem of Calculus:
$$f_X(x) = \frac{d}{dx} F_X(x)$$
2.3 Expectation and Variance of Continuous Variables
- Expectation: $$E[X] = \int_{-\infty}^\infty x f_X(x) , dx$$
- Law of the Unconscious Statistician (LOTUS): For any real-valued function $g(X)$: $$E[g(X)] = \int_{-\infty}^\infty g(x) f_X(x) , dx$$
- Variance: $$\text{Var}(X) = E[(X - \mu)^2] = \int_{-\infty}^\infty (x - \mu)^2 f_X(x) , dx = E[X^2] - (E[X])^2$$
3. Core Continuous Distributions
3.1 Continuous Uniform Distribution: $\mathcal{U}(a, b)$
Models an outcome equally likely to land anywhere in the interval $[a, b]$:
$$f(x) = \begin{cases} \frac{1}{b - a} & \text{if } a \le x \le b \ 0 & \text{otherwise} \end{cases}$$
- Mean: $E[X] = \frac{a + b}{2}$
- Variance: $\text{Var}(X) = \frac{(b - a)^2}{12}$
3.2 Exponential Distribution: $\text{Exp}(\lambda)$
Models the elapsed time between Poisson arrivals (e.g., time between incoming API calls or hardware failure time):
$$f(x) = \lambda e^{-\lambda x}, \quad x \ge 0$$
- CDF: $F(x) = 1 - e^{-\lambda x}$
- Mean: $E[X] = \frac{1}{\lambda}$
- Variance: $\text{Var}(X) = \frac{1}{\lambda^2}$
Continuous Memorylessness:
Just like the Geometric distribution in discrete time, the Exponential distribution is the only continuous distribution that is memoryless:
$$P(X > s + t \mid X > s) = \frac{P(X > s + t)}{P(X > s)} = \frac{e^{-\lambda(s+t)}}{e^{-\lambda s}} = e^{-\lambda t} = P(X > t)$$
3.3 Gaussian (Normal) Distribution: $\mathcal{N}(\mu, \sigma^2)$
The cornerstone of statistical physics, machine learning, and probability theory, parameterized by mean $\mu \in \mathbb{R}$ and variance $\sigma^2 > 0$:
$$f(x) = \frac{1}{\sigma \sqrt{2\pi}} \exp\left( -\frac{(x - \mu)^2}{2\sigma^2} \right)$$
text
The Standard Normal $Z \sim \mathcal{N}(0, 1)$:
Any normal variable $X \sim \mathcal{N}(\mu, \sigma^2)$ can be standardized via:
$$Z = \frac{X - \mu}{\sigma}$$
Its CDF is denoted by $\Phi(z)$:
$$\Phi(z) = \frac{1}{\sqrt{2\pi}} \int_{-\infty}^z e^{-t^2 / 2} , dt = \frac{1}{2} \left[ 1 + \text{erf}\left( \frac{z}{\sqrt{2}} \right) \right]$$
4. Change of Variables Theorem (Transformations of Random Variables)
Suppose $X$ is a continuous random variable with PDF $f_X(x)$, and $Y = g(X)$ where $g$ is a strictly monotonic, differentiable function. What is the PDF $f_Y(y)$?
Theorem (1D Change of Variables)
Let $x = g^{-1}(y)$. Then:
$$f_Y(y) = f_X(g^{-1}(y)) \left| \frac{d}{dy} g^{-1}(y) \right| = \frac{f_X(x)}{\left| g'(x) \right|}$$
Proof:
Assume $g$ is strictly increasing.
$$F_Y(y) = P(Y \le y) = P(g(X) \le y) = P(X \le g^{-1}(y)) = F_X(g^{-1}(y))$$
Differentiating both sides with respect to $y$ via the chain rule:
$$f_Y(y) = \frac{d}{dy} F_X(g^{-1}(y)) = f_X(g^{-1}(y)) \frac{d}{dy} g^{-1}(y)$$
For strictly decreasing $g$, a negative sign appears which is absorbed by the absolute value $|\cdot|$. $\blacksquare$
5. Algorithmic Application: The Box-Muller Transform
Computer pseudorandom number generators natively produce standard uniform numbers $U_1, U_2 \sim \mathcal{U}(0, 1)$. How do game engines and deep learning frameworks (PyTorch, TensorFlow) generate standard Normal samples $Z \sim \mathcal{N}(0, 1)$?
The Box-Muller Transform maps two independent standard uniform variables into two independent standard Gaussian variables:
$$Z_0 = \sqrt{-2 \ln U_1} \cos(2\pi U_2)$$
$$Z_1 = \sqrt{-2 \ln U_1} \sin(2\pi U_2)$$
Geometric Intuition:
Consider the 2D joint Gaussian PDF $f(z_0, z_1) = \frac{1}{2\pi} e^{-(z_0^2 + z_1^2)/2}$. In polar coordinates $(R, \Theta)$ with $z_0 = R \cos \Theta$ and $z_1 = R \sin \Theta$:
- $\Theta \sim \mathcal{U}(0, 2\pi) \implies \Theta = 2\pi U_2$
- $R^2 = z_0^2 + z_1^2 \sim \text{Exp}(1/2) \implies R = \sqrt{-2 \ln U_1}$
6. Python Implementation: Box-Muller & Density Verification
python
7. Key Takeaways
- PDF Values are Densities: $f_X(x)$ represents probability per unit length; only the integral $\int_a^b f_X(x)dx$ yields true probability.
- Point Probability is Zero: For any single value $c$, $P(X = c) = 0$.
- Exponential Distribution: The continuous analogue of the Geometric distribution, completely memoryless.
- Change of Variables: Differentiating transformed random variables requires the Jacobian determinant $|d(g^{-1}(y))/dy|$ to preserve probability mass.