[Math] Probabilities – Traffic Light problem

probabilityprobability theorystatistics

Exercise :

Let it be that on a road trip, the probability of a traffic light having the same color as the previous one, is $p$. If the first traffic light is red with probability $a$ and green with $1-a$, calculate the probability of the third traffic light being green.

Attempt :

Let $R$ be the event of the traffic light being red and $R^c$ the event of the traffic light being green.

Then, for the first traffic light, it is :

$$P(R) = a$$

$$P(R^c) = 1-a$$

Also, let $S$ be the event of the next traffic light having the same color as the previous one. So :

$$P(S) = p$$

Now, to me it seems like it could be something involving Bayes Theorem, especially because we have $3$ traffic lights to check, which goes perfect with the denominator of Bayes, but I really cannot see how to continue on solving this one, basically I do not know how to start and choose between each case (green/red). I would really appreciate a thorough explanation/solution.

Best Answer

This actually has nothing to do with Bayes' theorem. Let the probability that the $n$th traffic light is red be $a_n$. Then we have $a_1 = a$. To obtain a recursive relation for $a_n$, we have two cases: either the previous light is red (probability $a_{n-1}$, and then probability $p$ that the $n$th light is also red), or the previous light is green (probability $1-a_{n-1}$, and then probability $1-p$ that the $n$th light changes to red). This yields $$a_n = pa_{n-1} + (1-p)(1-a_{n-1}).$$

We now have a recursive relation which we can use to solve for $a_3$ by working up from $a_1$.

Note: your problem is an example of what's called a Markov Chain. You can read more about it here.