Cambridge 9709 · Mathematics (9709) A2 · Chapter 30 · S2 - Continuous Random Variables

S2: Continuous Random Variables

Summarized revision notes, free to read. Sit the matching past papers in any Paperverse world when you are done.

Introduction

Hey there! So far in statistics, we've mostly dealt with discrete random variables—things you can count, like the number of heads in a coin toss. But what about things you measure? Think height, weight, or the time it takes to run a race. These can take on any value in a range, and that's where Continuous Random Variables come in. It's a whole new ball game! 🤩<br><br>In this chapter, we're going to dive into the world of smooth, continuous data. First, we'll meet the Probability Density Function (PDF), which is like the rulebook for a continuous variable. Then, we'll learn how to calculate the mean and variance using our old friend, integration. Finally, we'll put it all together to find probabilities and percentiles, answering questions like 'What's the chance the bus arrives in the next 5 minutes?' It might sound tricky, but it's just about seeing probability as an area under a curve. Let's get started!

Properties of Probability Density Functions6.3

Alright, let's dive into Probability Density Functions, or PDFs. In S1, we dealt with discrete random variables – like the number you get when you roll a die (you can get a 2 or a 3, but not 2.5). Now in S2, we're levelling up to continuous random variables, which can take any value in a range. Think about the exact time you wait for your food delivery, the length of your favourite song, or the precise height of a person. It's not just whole numbers; it's decimals galore.<br><br>A PDF, written as $f(x)$, is basically a curve that models the probability distribution for these continuous variables. It has two golden rules you absolutely have to know. They're like the non-negotiable terms and conditions of the math world.<br><br>First, $f(x) \ge 0$ for all $x$. This just means the graph of the PDF never dips below the x-axis. It makes perfect sense, right? Probability can't be negative. You can't have a -20% chance of your crush texting you back. It's either 0% or higher. Simple.<br><br>Second, and this is the big one, the total area under the curve is always equal to 1. In calculus terms, that's $\int_{-\infty}^{\infty} f(x) \, dx = 1$. This is like saying the probability of something happening is 100%. The chance that your bus arrives at some point in time is 1. The chance that your gaming PC's temperature is some value within its operating range is 1. A graph showing a generic curve for f(x) entirely above the x-axis. The total area between the curve and the x-axis is shaded and labelled 'Total Area = 1'. This rule is super important because it allows us to find unknown constants in the function, often called 'k', by setting up an integral and making it equal to 1. We call this finding the 'normalising constant'.

Worked Example: Finding the Normalising Constant6.3

Problem The continuous random variable $X$ has a probability density function $f(x)$ given by:<br>$$ f(x) = \begin{cases} k(4-x^2) & 0 \le x \le 2 \\ 0 & \text{otherwise} \end{cases} $$<br>Find the value of the constant $k$.

Step 1 Okay, first things first. We know that for any PDF, the total area under the curve must equal 1. This is our non-negotiable starting point. We'll set up a definite integral for our function over its given domain and set it equal to 1. $$ \int_{0}^{2} f(x) \, dx = 1 $$

Step 2 Now, let's substitute our function into the integral. The domain for our function is from $x=0$ to $x=2$. Everywhere else it's zero, so we don't need to worry about other intervals. $$ \int_{0}^{2} k(4-x^2) \, dx = 1 $$

Step 3 Time for some calculus! Since $k$ is just a constant, we can pull it outside the integral to make life easier. Then we integrate the function $(4-x^2)$ with respect to $x$. $$ k \left[ 4x - \frac{x^3}{3} \right]_{0}^{2} = 1 $$

Step 4 Next, we evaluate the integral by plugging in the limits. We substitute the upper limit (2) and subtract what we get when we substitute the lower limit (0). $$ k \left( \left( 4(2) - \frac{2^3}{3} \right) - \left( 4(0) - \frac{0^3}{3} \right) \right) = 1 $$

Step 5 Let's simplify that expression. The second bracket is just zero, which is nice. Now we just have a simple equation to solve for our mystery constant, $k$. $$ k \left( 8 - \frac{8}{3} \right) = 1 \implies k \left( \frac{24}{3} - \frac{8}{3} \right) = 1 \implies k \left( \frac{16}{3} \right) = 1 $$

Step 6 And for the final move! Just a little bit of algebraic rearranging to isolate $k$. And boom, we've found our normalising constant. GG! ✨ $$ k = \frac{3}{16} $$

Probability and Percentiles from a PDF6.3

Alright, let's get into it. With continuous random variables, the probability of $X$ being exactly one specific value is zero. Think about it: what are the odds your bus arrives at precisely 8:15:00.000... AM? Infinitesimally small! Instead, we care about the probability that $X$ falls within a range, like your bus arriving between 8:15 and 8:20. To find this probability, $P(a < X < b)$, we find the area under the Probability Density Function (PDF) graph between points $a$ and $b$. And how do we find the area under a curve? You guessed it – integration! It's the ultimate tool for this job. You simply calculate the definite integral of the PDF, $f(x)$, from $a$ to $b$: $P(a < X < b) = \int_{a}^{b} f(x) \,dx$. A graph of a generic PDF curve, like a skewed bell shape. The x-axis is labelled 'x' and the y-axis is 'f(x)'. The area under the curve between two points, 'a' and 'b' on the x-axis, is shaded in. An integral sign formula is written next to it.<br><br>Now, let's talk about medians and percentiles. The median ($m$) is just the 50th percentile – it's the value that splits the entire probability distribution right down the middle. 50% of the data is below it, 50% is above it. It's like finding the exact halfway point in a gaming level. To find it, we set up an integral from the lowest possible value of $X$ (let's call it $x_{min}$) up to the median, $m$, and set the total probability (the area) equal to 0.5. So, we solve the equation: $\int_{x_{min}}^{m} f(x) \,dx = 0.5$. This same logic applies to any percentile! If you want to find the 80th percentile (the value that 80% of the data is below), you just set the integral equal to 0.80. For the $k^{th}$ percentile, you solve for $p$ in $\int_{x_{min}}^{p} f(x) \,dx = \frac{k}{100}$. It's a super powerful way to understand the spread and key points of your data.

Worked Example: Delivery Time Analysis6.3

Problem The waiting time, $T$ minutes, for a food delivery has a probability density function given by $f(t) = \frac{1}{32}(t-2)$ for $2 \le t \le 10$, and $f(t)=0$ otherwise.<br>a) Find the probability that the waiting time is between 5 and 7 minutes.<br>b) Find the median waiting time.

Step 1 For part (a), we need to find $P(5 < T < 7)$. This means we need to integrate the PDF, $f(t)$, from the lower limit of 5 to the upper limit of 7. This integral represents the area under the curve between these two points. $$P(5 < T < 7) = \int_{5}^{7} \frac{1}{32}(t-2) \,dt$$

Step 2 Now, let's solve the integral. We can take the constant $\frac{1}{32}$ outside. The integral of $(t-2)$ is $\frac{t^2}{2} - 2t$. Then we evaluate this at the limits 7 and 5. $$\frac{1}{32} \left[ \frac{t^2}{2} - 2t \right]_{5}^{7} = \frac{1}{32} \left( (\frac{7^2}{2} - 2(7)) - (\frac{5^2}{2} - 2(5)) \right) = \frac{1}{32} ((24.5 - 14) - (12.5 - 10)) = \frac{1}{32}(10.5 - 2.5) = \frac{8}{32} = 0.25$$

Step 3 For part (b), we need to find the median time, $m$. The median is the value where the cumulative probability is 0.5. So, we'll set up an integral from the start of the domain (which is $t=2$) up to $m$, and set it equal to 0.5. $$\int_{2}^{m} \frac{1}{32}(t-2) \,dt = 0.5$$

Step 4 Let's solve this integral equation for $m$. We perform the same integration as before, but with $m$ as the upper limit. This will give us an equation in terms of $m$. $$\frac{1}{32} \left[ \frac{t^2}{2} - 2t \right]_{2}^{m} = 0.5$$

Step 5 Now, substitute the limits and simplify. This will lead to a quadratic equation. We'll solve it and choose the value of $m$ that actually lies within our domain of $2 \le t \le 10$. $$\frac{1}{32} \left( (\frac{m^2}{2} - 2m) - (\frac{2^2}{2} - 2(2)) \right) = 0.5 \\ (\frac{m^2}{2} - 2m) - (2 - 4) = 16 \\ \frac{m^2}{2} - 2m + 2 = 16 \\ m^2 - 4m + 4 = 32 \\ (m-2)^2 = 32 \\ m-2 = \pm\sqrt{32} = \pm 4\sqrt{2}$$

Step 6 We get two possible solutions for $m$: $m = 2 + 4\sqrt{2} \approx 7.66$ and $m = 2 - 4\sqrt{2} \approx -3.66$. Since the time $T$ must be between 2 and 10, we discard the negative solution. So, the median waiting time is 7.66 minutes. $$m = 2 + 4\sqrt{2} \approx 7.66 \text{ minutes (3 s.f.)}$$

Mean and Variance of a Continuous Random Variable6.3

Alright, let's get into the mean and variance for continuous random variables. Think of the mean, or Expected Value $E(X)$, as the ultimate average. If you recorded a random variable (like the time it takes you to beat a certain game level) an infinite number of times, $E(X)$ is the average you'd expect to get. It’s like your long-term K/D ratio. For discrete data, you'd multiply each outcome by its probability and add them up. Since we're continuous now (like a smooth audio waveform, not choppy samples), we swap the summation for an integral. The formula is your new best friend: $$E(X) = \int_{-\infty}^{\infty} x f(x) \,dx$$ Basically, we're integrating the value $x$ multiplied by its 'probability density' $f(x)$ over its entire possible range. A diagram showing a PDF curve. An arrow points to the E(X) value on the x-axis, labelling it the 'balance point' or 'center of mass' of the shape.<br><br>Now, what about variance, $Var(X)$? Variance is all about the spread or consistency. Is your part-time job shift length super predictable (low variance) or does it change wildly week-to-week (high variance)? A low variance is like your ping in a game being super stable; high variance is major lag spikes. The formula looks a bit intense, but it's a breeze once you break it down: $$Var(X) = \int_{-\infty}^{\infty} x^2 f(x) \,dx - [E(X)]^2$$ Let's decode this. The first part, $\int x^2 f(x) \,dx$, is just the 'mean of the squares', which we call $E(X^2)$. The second part is just the mean, $E(X)$, squared. So, the mantra to remember is: Variance equals the mean of the squares minus the square of the mean. You calculate $E(X)$ first, then you calculate $E(X^2)$ using a very similar integral, and finally, you plug them into the simple formula: $Var(X) = E(X^2) - [E(X)]^2$. Easy peasy. You've got this!

Worked Example: Mean and Variance from a PDF6.3

Problem The time, $X$ hours, that a student spends on their part-time job on a Saturday can be modelled by a continuous random variable with the probability density function $f(x) = \frac{3}{32}x(4-x)$ for $0 \le x \le 4$, and $f(x)=0$ otherwise. Find the mean and variance of the time spent working.

Step 1 First up, let's find the mean, $E(X)$. We need to calculate the integral of $x \times f(x)$ between the given limits of 0 and 4. Let's expand the expression inside the integral first to make it easier to handle. $$E(X) = \int_{0}^{4} x f(x) \,dx = \int_{0}^{4} x \left[\frac{3}{32}x(4-x)\right] \,dx = \frac{3}{32} \int_{0}^{4} (4x^2 - x^3) \,dx$$

Step 2 Now we just do the integration, applying the power rule. Then we'll substitute the limits (4 and 0) to get our final value for the mean. $$\frac{3}{32} \left[ \frac{4x^3}{3} - \frac{x^4}{4} \right]_{0}^{4} = \frac{3}{32} \left[ \left( \frac{4(4)^3}{3} - \frac{(4)^4}{4} \right) - (0) \right] = \frac{3}{32} \left[ \frac{256}{3} - 64 \right] = \frac{3}{32} \left[ \frac{64}{3} \right] = 2$$

Step 3 Great, the mean is 2 hours. Now for the variance. First, we need the 'mean of the squares', $E(X^2)$. The setup is almost identical, but we integrate $x^2 \times f(x)$ instead. $$E(X^2) = \int_{0}^{4} x^2 f(x) \,dx = \int_{0}^{4} x^2 \left[\frac{3}{32}x(4-x)\right] \,dx = \frac{3}{32} \int_{0}^{4} (4x^3 - x^4) \,dx$$

Step 4 Time to integrate this new expression and substitute the limits, just like we did for the mean. $$\frac{3}{32} \left[ \frac{4x^4}{4} - \frac{x^5}{5} \right]_{0}^{4} = \frac{3}{32} \left[ x^4 - \frac{x^5}{5} \right]_{0}^{4} = \frac{3}{32} \left[ (4^4 - \frac{4^5}{5}) - (0) \right] = \frac{3}{32} \left[ 256 - \frac{1024}{5} \right] = \frac{3}{32} \left[ \frac{256}{5} \right] = \frac{24}{5} = 4.8$$

Step 5 We have all the pieces! Now we use the magic formula: $Var(X) = E(X^2) - [E(X)]^2$. We just plug in the values we found in steps 2 and 4. $$Var(X) = E(X^2) - [E(X)]^2 = 4.8 - (2)^2 = 4.8 - 4 = 0.8$$

Key Points to Remember

  • A Probability Density Function, $f(x)$, describes the likelihood of a continuous random variable. The two golden rules are: $f(x) \ge 0$ for all $x$, and the total area under the curve is always 1, so $\int_{-\infty}^{\infty} f(x) \,dx = 1$.
  • The mean (or expected value) is the balancing point of the distribution, found using $E(X) = \int_{-\infty}^{\infty} x f(x) \,dx$. The variance measures the spread, calculated by $Var(X) = E(X^2) - [E(X)]^2$, where $E(X^2) = \int_{-\infty}^{\infty} x^2 f(x) \,dx$.
  • Finding a probability like $P(a < X < b)$ is just finding the area under the curve between $a$ and $b$ by integrating: $\int_{a}^{b} f(x) \,dx$. To find the median, $m$, you solve the equation $\int_{-\infty}^{m} f(x) \,dx = 0.5$.

Revise this chapter in any of the ten Paperverse worlds