I have the following problem:
- If today is a sunny day, a probability that it will rain tomorrow is $0.2$.
- If today is a rainy day, a probability that it will be sunny tomorrow is $0.4$.
I need to find the probability that if it's rainy on the third of May, it will also rain on the third of June.
My initial idea was to write a program that will create the binary tree with all possible combinations and then I just traverse through all of them and sum the probabilities accordingly, but unfortunately, I have to do this by hand, so any help is very welcome.
Best Answer
A binary tree is definitely a possible way to solve this problem.
Another way to think about it though is maybe in the language or linear algebra.
We can represent day as the vector: $\begin{pmatrix} s \\ r\end{pmatrix}$ where $s$ is the probability of sun on that day and $r$ represents the chance of rain, and then the matrix: $$\begin{pmatrix} 0.8 & 0.4 \\ 0.2 & 0.6 \end{pmatrix}$$ would represent the transition function from one day to another.
So if we have rain on the 3rd of May, the probability vector for the 4th of May will be $\begin{pmatrix} 0.8 & 0.4 \\ 0.2 & 0.6 \end{pmatrix} \begin{pmatrix} 0 \\ 1\end{pmatrix}$.
More generally, $$\begin{pmatrix} 0.8 & 0.4 \\ 0.2 & 0.6 \end{pmatrix}^n \begin{pmatrix} 0 \\ 1\end{pmatrix}$$ the probability vector for the nth day after the 3rd of May. For your problem, I think $n = 31$.
edit I notice now that SmileyCraft makes a good point to diagonize this transition matrix and this makes the power easier to work with.