Determining probability of a rainy day 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.
 A: 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.
A: $\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$
$$
\left\{\begin{array}{rcl}
\ds{P_{n}} & \ds{\equiv} & Rainy\ Probability\ \mbox{at the}\ n_{th}\ \mbox{Day}
\\
\ds{P_{1}} & \ds{=} & \ds{1}
\\
\ds{P_{31}} & \ds{=} & \ds{\large ?} 
\end{array}\right.
$$
$\ds{P_{n}}$ is given by
\begin{align}
&P_{n}  = \pars{1 - P_{n - 1}}0.2 + P_{n - 1}\pars{1 - 0.4}\,,\qquad P_{1} = 1
\\[5mm]
\implies &\pars{P_{n} - {1 \over 3}} - {2 \over 5}\pars{P_{n - 1} - {1 \over 3}} = 0
\\[5mm]
\implies &
\bbx{P_{n} = {1 \over 3} + {5 \over 3}\pars{2 \over 5}^{n}}
\\[5mm] \implies &
P_{31} =
{310440858205875333091 \over 931322574615478515625} \approx
\bbox[#ffd,10px,border:1px groove navy]{0.3333}
\end{align}
