Continuous random variables: probability density functions, expectation, variance
Continuous Random Variables
What is a Continuous Random Variable?
A continuous random variable can take any value within a range (often all real numbers). Think of it like measuring the exact height of a plant: you could get 10.3 cm, 10.31 cm, 10.311 cm, and so on—there are infinitely many possibilities.
Probability Density Function (PDF)
For a continuous variable \(X\), the PDF \(f(x)\) gives the relative likelihood of \(X\) being near a particular value.
- Area under the curve over an interval \([a,b]\) equals the probability that \(X\) falls in that interval: $$P(a \le X \le b)=\int_a^b f(x)\,dx$$
- Two key properties:
- \(f(x)\ge 0\) for all \(x\)
- \(\displaystyle\int_{-\infty}^{\infty} f(x)\,dx = 1\)
📌 Analogy: Imagine a smooth hill. The height of the hill at each point represents how likely you are to land there if you roll a ball down the hill. The total area of the hill is always 1, just like total probability.
Example: Uniform Distribution on \([0,1]\)
The simplest PDF is the uniform distribution where every value in \([0,1]\) is equally likely.
| \(x\) | \(f(x)\) |
|---|---|
| \(0 \le x \le 1\) | \(1\) |
| otherwise | \(0\) |
Check: \(\displaystyle\int_0^1 1\,dx = 1\). ??
Expectation (Mean) of a Continuous Variable
The average value you would expect if you could repeat the experiment infinitely many times.
Formula: $$\displaystyle\mu = E[X] = \int_{-\infty}^{\infty} x\,f(x)\,dx$$
📌 Analogy: If you have a jar of marbles of different weights, the expectation is the weight you would get if you could weigh a marble from the jar a million times and average all the weights.
Example (Uniform \([0,1]\)):
$$E[X] = \int_0^1 x \cdot 1\,dx = \left[\frac{x^2}{2}\right]_0^1 = \frac12$$
Variance and Standard Deviation
Variance measures how spread out the values are around the mean.
Formula: $$\displaystyle\sigma^2 = \operatorname{Var}(X) = \int_{-\infty}^{\infty} (x-\mu)^2\,f(x)\,dx$$
Standard deviation is the square root of variance: $$\sigma = \sqrt{\operatorname{Var}(X)}$$
📌 Analogy: Think of a classroom where everyone's height is measured. Variance tells you how much the heights differ from the average height.
Example (Uniform \([0,1]\)):
$$\operatorname{Var}(X) = \int_0^1 (x-\tfrac12)^2\,dx = \frac{1}{12} \approx 0.0833$$ $$\sigma = \sqrt{\tfrac{1}{12}} \approx 0.289$$
Normal Distribution (The “Bell Curve”)
One of the most important PDFs in statistics.
PDF: $$f(x) = \frac{1}{\sigma\sqrt{2\pi}}\exp\!\Bigl(-\frac{(x-\mu)^2}{2\sigma^2}\Bigr)$$
Key facts:
- Mean \(=\mu\)
- Variance \(=\sigma^2\)
- About 68 % of the area lies within \(\mu\pm\sigma\)
- About 95 % lies within \(\mu\pm2\sigma\)
- About 99.7 % lies within \(\mu\pm3\sigma\)
📌 Exam tip: When a question asks for “the probability that a normally distributed variable lies between two values”, remember to standardise using \(Z=\frac{X-\mu}{\sigma}\) and use Z‑tables or calculator functions.
Exam Tips & Quick Checks
- Always check that your PDF integrates to 1.
- For expectation, if you can’t integrate directly, use symmetry or known results (e.g., for a uniform distribution on \([a,b]\), \(E[X] = \frac{a+b}{2}\)).
- Variance can also be found using \( \operatorname{Var}(X) = E[X^2] - (E[X])^2 \).
- When given a piecewise PDF, split the integral at the points where the function changes.
- Remember that for any continuous variable, \(P(X=x)=0\). Probabilities are always for intervals.
- Use emojis or colour coding in your notes to remember key formulas: e.g., green for expectation, blue for variance.
💡 Practice Question: A continuous random variable \(X\) has PDF $$f(x)=\begin{cases} 2x & \text{if } 0\le x\le1\\ 0 & \text{otherwise} \end{cases}$$ Find \(E[X]\) and \(\operatorname{Var}(X)\).
Solution sketch: \(E[X] = \int_0^1 2x^2\,dx = \frac{2}{3}\). \(E[X^2] = \int_0^1 2x^3\,dx = \frac{1}{2}\). \(\operatorname{Var}(X) = \frac{1}{2} - \left(\frac{2}{3}\right)^2 = \frac{1}{18}\).
Revision
Log in to practice.