Copyright © University of Cambridge. All rights reserved.

'Rain or Shine' printed from https://nrich.maths.org/

Show menu


Ling Xiang Ning from Raffles Institution, Singapore got very close to cracking this one and Edward of Blue Coat School, Coventry sent a good solution. You could do this analytically but, like Edward, you can use a calculator (or a computer program) to work out the 30 steps in the calculation for the days in June. At each step the calculation is the same (this is called iteration).

(i) p(tomorrow is dry | today is wet) = 1 - p(tomorrow is wet | today is wet)


= 1- 0.7


= 0.3

p(tomorrow is dry | today is dry) = 1 - p(tomorrow is wet | today is dry)


= 1- 0.2


= 0.8

(ii) Let p(June 1st is wet) = p and p(June 1st is dry) = 1- p

Then p(June 2nd is wet) = 0.7p + 0.2(1- p)

= 0.5p + 0.2
Also p(June 2nd is dry) = 0.3p + 0.8(1 - p)

= 0.8 - 0.5p

These two probabilities add up to 1.

(iii) Making the simplification that each day's weather depends ONLY on the weather the day before, and using the method shown in (ii), you can find the probabilities of wet weather for each of the days of June.

Whatever value you take for p on the first day, just keep multiplying by 0.5 and adding 0.2 over and over again.

Let's say you know it was wet on June 1st then p=1 and you can use this in your calculation of p(July 1st is wet | June 1st is wet).

For part (iv), if you knew June 1st was dry then you can use p=0 in the calculation of p(July 1st is wet | June 1st is dry) .

p(June 3rd is wet ) = 0.5 (p(June 2nd is wet)) + 0.2

= 0.5 (0.5p + 0.2) + 0.2

= 0.52 p + 0.2(0.5 + 1)
p(June 4th is wet) = 0.5 (p(June 3rd is wet)) + 0.2

= 0.53p + 0.2(0.52 + 0.5 + 1)

What is this expression for June 30th ? , What about July 1st?

For part (v) use your answers for parts (iii) and (iv). Then you can try any value of p between 0 and 1 and do the same sort of calculation for any month in the future not knowing yet what the weather will be like on the first day of that particular month. What do you discover?

Hopefully here's the solution to 'Rain or Shine' says Edward Toman, age 17, of Blue Coat School, Coventry.

Edward's solution follows. Well done Edward!

i)0.3 and 0.8 respectively
ii)0.5p+0.2
iii)approx. 0.4
iv)approx. 0.4

To get the last two answers I used my calculator. It has a 'double sequence' function, which allows you to put two sequences down which are related. Here are my two functions.

U(n)=0.7U(n-1) + 0.2V(n-1)
V(n)=0.3U(n-1) + 0.8V(n-1)
Set: n=1, U(n)=1 V(n)=0, for starting with a wet day
or n=1, U(n)=0 V(n)=1, for starting with a dry day.

U(n) and V(n) simply mean the probability of 'wet' and 'dry' respectively on day 'n'. They rely on the previous result of the day before.

It does not matter whether the starter day is 'wet' or 'dry' as the overall probability tends towards 0.4 for 'wet' and 0.6 for 'dry'.

Below is an example of how this problem might be tackled analytically - note it requires knowledge of linear difference equations which are not covered in most A-level syllabi however as noted in the solution the techniques used are very similar to those used with linear differential equations and so hopefully should be understandable by someone who has covered these topics in an A-level Further Maths course (or equivalent).

Let $D_n$ be the event that it is dry on day $n$ (and $\overline{D_n}$ that it is wet)

$$\mathrm{P} \left( \overline{D_{n+1}} \ | \ \overline{D_n} \right) = a; \ \ \mathrm{P} \left( \overline{D_{n+1}} \ | \ D_n \right) = b$$ $$ \begin{align} \Rightarrow \mathrm{P} \left( D_{n+1} \ | \ \overline{D_n} \right) = & 1 - \mathrm{P} \left(\overline{D_{n+1}} \ | \ \overline{D_n} \right) = 1 - a \\ \mathrm{P} \left( D_{n+1} \ | \ D_n \right) = & 1 - \mathrm{P} \left(\overline{D_{n+1}} \ | \ D_n \right) = 1 - b \\ \end{align} $$ $$ \begin{align} \mathrm{P} \left( D_{n+1} \right) = & \mathrm{P} \left(D_{n+1} \ | \ \overline{D_n} \right) \mathrm{P} \left( \overline{D_n} \right) + \mathrm{P} \left( D_{n+1} \ | \ D_n \right) \mathrm{P} \left( D_n \right) \\ & = (1-a) \ \mathrm{P} \left( \overline{D_n} \right) + (1-b) \ \mathrm{P} \left( D_n \right)\\ \end{align} $$ $$\mathrm{P} \left( \overline{D_n} \right) = 1 - \mathrm{P} \left( D_n \right)$$ $$ \begin{align} \Rightarrow \mathrm{P} \left( D_{n+1} \right) = & (1-a) \left( 1 - \mathrm{P} \left( D_n \right) \right) + (1-b) \ \mathrm{P} \left( D_n \right) \\ & = 1 - \mathrm{P} \left( D_n \right) - a + a \mathrm{P} \left( D_n \right) + \mathrm{P} \left( D_n \right) - b \mathrm{P} \left( D_n \right) \\ & = 1 - a + (a-b)\ \mathrm{P} \left( D_n \right) \\ \end{align} $$

Let $p_n = \mathrm{P} \left( D_n \right)$

$$\Rightarrow p_{n+1} = (1-a) + (a-b)\ p_n$$

This is what is called an 'inhomogeneous linear recurrence relationship' (a.k.a. linear difference equation) in $p_n$ of order 1. It is a discrete analogue of a differential equation and the methods for solving linear recurrence relationships are very similar to those for linear differential equations: the equivalent homogeneous equation is first solved and then a particular solution to account for the inhomogenity then found.

The homogeneous equivalent is:

$$q_{n+1} - (a-b)\ q_n = 0$$

Analogously to the initial assumption that the solution of an homogeneous second order linear differential equation $\left( a\frac{\mathrm{d^2}y}{\mathrm{d}x^2} + b\frac{\mathrm{d}y}{\mathrm{d}x} + cy = 0 \right)$ is of the form $y = \alpha e^{\lambda x}$ (where $\alpha$ is a constant), the solution to a linear difference equation is assumed to be of the form $y = \alpha \lambda^x$.

Therefore assuming $q_n = \alpha \lambda^n$ where $\alpha$ is some constant $\Rightarrow q_{n+1} = \alpha \lambda^{n+1}$

$$ \begin{align} \Rightarrow & \alpha \lambda^{n+1} - (a-b) \alpha \lambda^n = 0 \\ & \alpha \lambda^n \left[ \lambda - (a-b) \right] = 0 \\ \end{align} $$

Non-trivial solution $\Rightarrow \alpha \lambda^n \ne 0$

$$\therefore \ \lambda = a-b \Rightarrow q_n = \alpha (a-b)^n$$

To find the particular solution that corresponds to the inhomogeneous terms, let $p_n = \beta$ were $\beta$ is some constant

$$ \begin{align} \Rightarrow \beta = & (1-a) + (a-b) \ \beta \\ \beta (1 + b - a) = & 1 - a \\ \beta = & \frac{1 - a}{1 + b - a} \\ \end{align} $$

By superposition, the general solution is $p_n = q_n + \beta$

$$\therefore \ p_n = \frac{1-a}{1+b-a} + \alpha (a-b)^n$$

Using inital condition, $p_0 = p$

$$\Rightarrow p = \frac{1-a}{1+b-a} + \alpha \ \Rightarrow \ \alpha = p - \frac{1-a}{1+b-a}$$

Therefore the probablility of day $n$ being dry (where day 0 is June 1st) is:

$$\mathrm{P} \left( D_n \right) = \frac{1-a}{1+b-a} + \left( p - \frac{1-a}{1+b-a} \right) (a-b)^n$$ The values $a$ and $b$ are both non-zero, non-unity probabilities: $$0 < a < 1 \textrm{ and } 0 < b < 1 \Rightarrow |a-b| < 1$$ $$\therefore \ \lim_{n \to \infty} (a - b)^n = 0$$

Therefore for a large number of days $n$, the probability of it being a dry day tends to

$$\mathrm{P} \left( D_n \right) \approx \frac{1-a}{1+b-a}$$

and so becomes increasingly independent of the probability of it raining on the first day.

Substituting in the values given in the question $a=0.7$ and $b=0.2$

$$\Rightarrow \mathrm{P} \left( D_n \right) = \frac{1-0.7}{1+0.2-0.7} = \frac{0.3}{0.5} = 0.6$$