A bakery sells bags of six rolls. Each roll's weight varies a little, and so does the bag's. How likely is a full bag to be underweight? A call centre receives about three calls an hour, at random. How likely is a quiet hour with no calls at all? A cup of coffee cools faster when it is hotter. How hot will it be in ten minutes? These are the kinds of questions HL students of Maths AI answer with the ideas in this lesson.
They share one theme: describing change and variation with a model, then using the model to make a prediction you can trust. The statistics here builds on the normal and binomial distributions you already know, and the differential equations build on derivatives. None of it is a big leap; each step is small and sensible.
Linear combinations of random variables
For random variables X and Y and constants a, b:
E(aX+bY)=aE(X)+bE(Y).
If X and Y are independent,
Var(aX±bY)=a2Var(X)+b2Var(Y).
Notice the plus sign for both sum and difference: subtracting a random quantity adds uncertainty, it does not remove it. Also notice that X1+X2 (two separate items) is different from 2X (one item doubled): Var(X1+X2)=2Var(X), but Var(2X)=4Var(X). If X and Y are normal, so is any linear combination.
The Poisson distribution
The Poisson distributionX\sim\text{Po}(m) models the number of events in a fixed interval of time or space when events happen singly, independently and at a constant mean rate:
P(X=k)=\frac{m^ke^{-m}}{k!},\qquad E(X)=\operatorname{Var}(X)=m.
If X\sim\text{Po}(m) and Y\sim\text{Po}(n) are independent, then X+Y\sim\text{Po}(m+n). A quick check that a Poisson model is sensible: the mean and variance of the data should be roughly equal.
Confidence intervals for a mean
When the population standard deviation is unknown, a confidence interval for the mean \mu uses the t distribution with n-1 degrees of freedom:
\bar x\pm t^*\frac{s_{n-1}}{\sqrt n}.
The GDC computes it from data or summary statistics. A 95\% interval means that the method captures the true mean in about 95\% of samples; it does not mean that \mu moves around.
Differential equations
A differential equation links a function with its derivative. Two models appear again and again:
Growth or decay proportional to size:\dfrac{dy}{dt}=ky has solution y=y_0e^{kt}.
Cooling towards a surrounding temperature T_s:\dfrac{dT}{dt}=-k(T-T_s) has solution T=T_s+(T_0-T_s)e^{-kt}.
Many equations of the form \dfrac{dy}{dx}=f(x)g(y) can be solved by separating variables: rewrite as \dfrac{1}{g(y)}\,dy=f(x)\,dx, integrate both sides, and use the initial condition to find the constant.
When an equation cannot be solved exactly, Euler's method builds an approximate solution step by step with step size h:
x_{n+1}=x_n+h,\qquad y_{n+1}=y_n+h\times\frac{dy}{dx}\Big|_{(x_n,y_n)}.
Each step follows the tangent for a short distance; smaller steps usually give better approximations.
Similar exercises
Exercise 1
Independent random variables X and Y have E(X)=50, \operatorname{Var}(X)=16, E(Y)=30 and \operatorname{Var}(Y)=9. Find E(2X-Y) and \operatorname{Var}(2X-Y).
What you need and how to start
What you need:\operatorname{Var}(aX-bY)=a^2\operatorname{Var}(X)+b^2\operatorname{Var}(Y).
Show solution
The mean is E(2X-Y)=2(50)-30=70.
Because X and Y are independent, \operatorname{Var}(2X-Y)=2^2(16)+(-1)^2(9)=64+9=73; the variances add even though we subtract.
So E(2X-Y)=70 and \operatorname{Var}(2X-Y)=73.
Answer.70 and 73.
Exercise 2
For X\sim\text{Po}(2.5), find P(X=0) and P(X=4).
What you need and how to start
What you need:P(X=k)=\dfrac{m^ke^{-m}}{k!}.
Show solution
The number of events in a fixed interval with mean 2.5 follows a Poisson distribution, so we substitute m=2.5 into the Poisson formula P(X=k)=\dfrac{m^ke^{-m}}{k!}. For k=0, since 2.5^0=1 and 0!=1, P(X=0)=e^{-2.5}\approx0.0821.
State three conditions under which a Poisson distribution is a suitable model for the number of cars passing a point in a minute.
What you need and how to start
What you need: single, independent events at a constant mean rate.
Show solution
The cars must pass one at a time (singly), the passing of one car must not affect when the next passes (independently), and the mean number of cars per minute must stay the same during the period considered (constant rate).
So the model is suitable at a steady time of day, but not, for example, when cars arrive in groups after a traffic light.
Answer. Singly, independently, constant mean rate.
Exercise 4
Solve \dfrac{dy}{dx}=3y with y=4 when x=0.
What you need and how to start
What you need:\dfrac{dy}{dx}=ky gives y=y_0e^{kx}.
Show solution
The rate of change is proportional to y, so we separate variables: \dfrac1y\,dy=3\,dx. Integrating both sides gives \ln y=3x+c, so y=Ae^{3x}.
The condition y=4 when x=0 gives A=4.
So y=4e^{3x}.
Answer.y=4e^{3x}.
Exercise 5
Solve \dfrac{dy}{dx}=\dfrac{2x}{y} with y=3 when x=0, for y>0.
What you need and how to start
What you need: separate to y\,dy=2x\,dx.
Show solution
Separating variables gives y\,dy=2x\,dx, and integrating both sides gives \dfrac{y^2}{2}=x^2+c.
Do not forget the constant: it is what the initial condition fixes. The condition y=3 when x=0 gives c=\dfrac92, so y^2=2x^2+9.
So, since y>0, y=\sqrt{2x^2+9}.
Answer.y=\sqrt{2x^2+9}.
Applied exercises
Exercise 6
Customers arrive at a small shop at random at a mean rate of 4 every 10 minutes. Find the probability that more than 3 customers arrive in a 10-minute period.
What you need and how to start
What you need:P(X>3)=1-P(X\le3) with X\sim\text{Po}(4).
Show solution
The number of customers in 10 minutes is X\sim\text{Po}(4), since they arrive singly, independently and at a constant mean rate.
Then P(X>3)=1-P(X\le3)\approx1-0.4335=0.567, using the GDC for the cumulative probability.
So the probability of more than 3 customers is about 0.567.
Answer. About 0.567.
Exercise 7
A cup of coffee at 90^\circC cools in a room at 20^\circC according to \dfrac{dT}{dt}=-0.1(T-20), with t in minutes. Find the temperature after 10 minutes.
What you need and how to start
What you need:T=T_s+(T_0-T_s)e^{-kt}.
Show solution
This is the cooling model with T_s=20, T_0=90 and k=0.1, so T=20+70e^{-0.1t}.
After 10 minutes, T=20+70e^{-1}\approx45.8^\circC.
So the coffee is about 45.8^\circC after 10 minutes.
Answer. About 45.8^\circC.
Exercise 8
For \dfrac{dy}{dx}=0.2y with y=2 when x=0, use Euler's method with h=0.5 to estimate y when x=1, and compare with the exact value.
What you need and how to start
What you need: two steps, each multiplying y by 1+0.5(0.2)=1.1.
Show solution
Each step gives y_{n+1}=y_n+0.5(0.2y_n)=1.1y_n, so y_1=2.2 and y_2=2.42.
The exact solution is y=2e^{0.2x}, so at x=1 it is 2e^{0.2}\approx2.443.
So Euler's method gives 2.42, slightly below the exact value 2.443.
Answer.2.42; exact 2.443.
Exercise 9 Challenge
A box holds 6 apples, each with mass normally distributed with mean 150 g and standard deviation 10 g, independently. The empty box has mass with mean 200 g and standard deviation 5 g. Find the probability that a full box weighs more than 1150 g.
What you need and how to start
What you need: the total is X_1+\dots+X_6+B, not 6X+B.
Show solution
The total mass W=X_1+X_2+\dots+X_6+B has mean 6(150)+200=1100 g.
Since the six apples and the box are independent, \operatorname{Var}(W)=6(10^2)+5^2=625, so the standard deviation is 25 g, and W is normal.
Then P(W>1150)=P\left(Z>\dfrac{1150-1100}{25}\right)=P(Z>2)\approx0.0228.
So about 2.28\% of full boxes weigh more than 1150 g.
Answer. About 0.0228.
Mini test
Marked like the Vietnamese graduation exam: Part I 0.25 points per question; Part II up to 1 point per question (1, 2, 3, 4 correct statements give 0.1, 0.25, 0.5, 1 point); Part III 0.5 points per question.
Part I. Multiple choice
Question 1. Independent X and Y have standard deviations 6 and 8. The standard deviation of X+Y is
Answer: C.
\sqrt{36+64}=10.
Question 2. For X\sim\text{Po}(4), \operatorname{Var}(X) is
Answer: A.
For a Poisson distribution the variance equals the mean.
Question 3. The solution of \dfrac{dy}{dt}=0.3y with y(0)=5 is
Answer: D.
Growth proportional to size is exponential.
Question 4. Euler's method with step h uses
Answer: B.
y_{n+1}=y_n+h\times\text{gradient at }(x_n,y_n).
Part II. True or false
Question 1. Calls arrive as \text{Po}(2) per minute. Decide whether each statement is true or false.
a) The mean number per minute is 2.
b) The number in 3 minutes is \text{Po}(6).
c)P(X=0)=e^{-2} for one minute.
d) The variance per minute is 4.
Answer: a) True; b) True; c) True; d) False.
The variance equals the mean, 2.
Part III. Short answer
Question 1. Find \operatorname{Var}(3X) if \operatorname{Var}(X)=2.
Answer: 18.
3^2\times2=18.
Question 2. Using Euler's method on \dfrac{dy}{dx}=2 with y(0)=1 and h=0.5, find y at x=1.
Answer: 3.
Two steps of 0.5\times2=1.
Show answers and explanations
Part I, question 1: C. \sqrt{36+64}=10.
Part I, question 2: A. For a Poisson distribution the variance equals the mean.
Part I, question 3: D. Growth proportional to size is exponential.
Part I, question 4: B. y_{n+1}=y_n+h\times\text{gradient at }(x_n,y_n).
Part II, question 1: a) True; b) True; c) True; d) False. The variance equals the mean, 2.
Part III, question 1: 18. 3^2\times2=18.
Part III, question 2: 3. Two steps of 0.5\times2=1.
Solutions and answers
Try each exercise on your own first, then check here.
Exercise 1.
The mean is E(2X-Y)=2(50)-30=70.
Because X and Y are independent, \operatorname{Var}(2X-Y)=2^2(16)+(-1)^2(9)=64+9=73; the variances add even though we subtract.
So E(2X-Y)=70 and \operatorname{Var}(2X-Y)=73.
Answer.70 and 73.
Exercise 2.
The number of events in a fixed interval with mean 2.5 follows a Poisson distribution, so we substitute m=2.5 into the Poisson formula P(X=k)=\dfrac{m^ke^{-m}}{k!}. For k=0, since 2.5^0=1 and 0!=1, P(X=0)=e^{-2.5}\approx0.0821.
The cars must pass one at a time (singly), the passing of one car must not affect when the next passes (independently), and the mean number of cars per minute must stay the same during the period considered (constant rate).
So the model is suitable at a steady time of day, but not, for example, when cars arrive in groups after a traffic light.
Answer. Singly, independently, constant mean rate.
Exercise 4.
The rate of change is proportional to y, so we separate variables: \dfrac1y\,dy=3\,dx. Integrating both sides gives \ln y=3x+c, so y=Ae^{3x}.
The condition y=4 when x=0 gives A=4.
So y=4e^{3x}.
Answer.y=4e^{3x}.
Exercise 5.
Separating variables gives y\,dy=2x\,dx, and integrating both sides gives \dfrac{y^2}{2}=x^2+c.
Do not forget the constant: it is what the initial condition fixes. The condition y=3 when x=0 gives c=\dfrac92, so y^2=2x^2+9.
So, since y>0, y=\sqrt{2x^2+9}.
Answer.y=\sqrt{2x^2+9}.
Exercise 6.
The number of customers in 10 minutes is X\sim\text{Po}(4), since they arrive singly, independently and at a constant mean rate.
Then P(X>3)=1-P(X\le3)\approx1-0.4335=0.567, using the GDC for the cumulative probability.
So the probability of more than 3 customers is about 0.567.
Answer. About 0.567.
Exercise 7.
This is the cooling model with T_s=20, T_0=90 and k=0.1, so T=20+70e^{-0.1t}.
After 10 minutes, T=20+70e^{-1}\approx45.8^\circC.
So the coffee is about 45.8^\circC after 10 minutes.
Answer. About 45.8^\circC.
Exercise 8.
Each step gives y_{n+1}=y_n+0.5(0.2y_n)=1.1y_n, so y_1=2.2 and y_2=2.42.
The exact solution is y=2e^{0.2x}, so at x=1 it is 2e^{0.2}\approx2.443.
So Euler's method gives 2.42, slightly below the exact value 2.443.
Answer.2.42; exact 2.443.
Exercise 9.
The total mass W=X_1+X_2+\dots+X_6+B has mean 6(150)+200=1100 g.
Since the six apples and the box are independent, \operatorname{Var}(W)=6(10^2)+5^2=625, so the standard deviation is 25 g, and W is normal.
Then P(W>1150)=P\left(Z>\dfrac{1150-1100}{25}\right)=P(Z>2)\approx0.0228.
So about 2.28\% of full boxes weigh more than 1150 g.
Answer. About 0.0228.
Mini test: answers
Part I, question 1: C. \sqrt{36+64}=10.
Part I, question 2: A. For a Poisson distribution the variance equals the mean.
Part I, question 3: D. Growth proportional to size is exponential.
Part I, question 4: B. y_{n+1}=y_n+h\times\text{gradient at }(x_n,y_n).
Part II, question 1: a) True; b) True; c) True; d) False. The variance equals the mean, 2.
Part III, question 1: 18. 3^2\times2=18.
Part III, question 2: 3. Two steps of 0.5\times2=1.