# Probability it rains on random day

## Problem

State of the weather in city can be modeled with simple probability. After rainy day it will rain the next day with probability of $$0.5$$ and after sunny day it will be sunny next day with probability of $$0.9$$. Let vector $$\vec{x_n}$$ be

$$\vec{x_n} = \begin{bmatrix} \text{probability of sunny weather at day n} \\ \text{probability of rainy day at day n} \end{bmatrix}$$

Probability of rainy and sunny weather for $$n+1$$:th day can be solved with matrix equation

$$x_{n+1} = \begin{bmatrix} 0.9 & 0.5 \\ 0.1 & 0.5 \end{bmatrix} x_n$$

We can assume that $$\vec{x_0}=\begin{bmatrix}1 & 0\end{bmatrix}^T$$. What happens when $$x_{\infty}$$ ? What are probabilities for random day when $$n\rightarrow \infty$$

## Attempt to solve

First we compute eigenvalues and eigenvectors for our matrix. We can compute eigenvalues easily by utilizing two facts about eigenvalues. $$1)$$ sum of eigenvalues is same as trace. $$2)$$ product of eigenvalues is same as determinant. Let matrix $$A$$ be

$$\textbf{A} = \begin{bmatrix} 0.9 & 0.5 \\ 0.1 & 0.5 \end{bmatrix}$$

Then we can note the equation as

$$x_{n+1}=\textbf{A}x_n$$

Then we can solve eigenvalues.

$$\begin{cases} \lambda_1 + \lambda_2 = \text{Tr}(\textbf{A}) \\ \lambda_1\cdot \lambda_2= \det(\textbf{A}) \\ \end{cases}$$

$$\implies \begin{cases} \lambda_1 + \lambda_2 = 0.9 + 0.5 \\ \lambda_1\cdot \lambda_2= 0.9\cdot 0.5 - 0.5 \cdot 0.5 \\ \end{cases}$$

$$\implies \begin{cases} \lambda_1 + \lambda_2 = 1.4 \\ \lambda_1\cdot \lambda_2= 0.4 \\ \end{cases}$$

$$\implies \lambda_1 = 0.4,\lambda_2 = 1$$

Eigenvectors can be acquired by solving $$\vec{x}$$ from equation $$(\textbf{A}-\lambda I)\vec{x}=\vec{0}$$

$$\begin{bmatrix} 0.9 - \lambda & 0.5 \\ 0.1 & 0.5 - \lambda \end{bmatrix} \begin{bmatrix} x_1 \\ x_2 \end{bmatrix} = \begin{bmatrix} 0 \\ 0 \end{bmatrix}$$

Now we have eigenvectors

$$\lambda_1 \text{ gives } \vec{x_{\lambda1}} = \begin{bmatrix} 5 \\ 1 \end{bmatrix}, \lambda_2 \text{ gives } \vec{x_{\lambda2}} = \begin{bmatrix} -1 \\ 1 \end{bmatrix}$$

Eigenvectors are linearly independent so we can solve

$$w_1 \vec{x_{\lambda1}} + w_2 \vec{x_{\lambda2}} = \vec{x_0}$$

$$\implies w_1 \begin{bmatrix} 5 \\ 1 \end{bmatrix} + w_2 \begin{bmatrix} -1 \\ 1 \end{bmatrix} = \begin{bmatrix} 1 \\ 0 \end{bmatrix}$$

$$\implies \begin{bmatrix} 5 & -1 \\ 1 & 1 \end{bmatrix} \begin{bmatrix} w_1 \\ w_2 \end{bmatrix} = \begin{bmatrix} 1 \\0 \end{bmatrix}$$

$$\implies w_1=1/6, w_2=-1/6$$

I can write the original equation as:

$$x_{n+1}=\textbf{A}^n \vec{x_{0}} = w_1 \cdot \lambda_1^n \cdot \vec{x_{\lambda1}}+w_2 \cdot \lambda_2^n \cdot \vec{x_{\lambda2}}$$

$$x_{n+1} = w_1 \cdot 0.4^n \cdot \begin{bmatrix} 5 \\ 1 \end{bmatrix} + w_2 \cdot 1^n \cdot \begin{bmatrix} -1 \\ 1 \end{bmatrix} \implies w_2 \begin{bmatrix} -1 \\ 1 \end{bmatrix}, \text{ when } k \rightarrow \infty$$

Then we have $$P("\text{sunny}")= -1w_1$$ and $$p(\text{"it is raining"})=w_1$$

$$P("\text{sunny}") = \frac{1}{6} \approx 16.67\%$$ $$P("\text{raining}") = -\frac{1}{6} \approx -16.67\%$$

Which is quite confusing that i have negative probability ? I think something went wrong with these calculations but i cannot see what ?

• A quick way to get the answer is to note that the probability that it is raining on one day far in the future must be the same as it is on the next day. Thus $p_r=.5\times p_r+.1\times (1-p_r)\implies p_r=\frac 16$
– lulu
Nov 27, 2018 at 20:14

It's all good except for the fact that the eigenvalue $$\lambda_1=0.4$$ yields as eigenvector $$(-1,1)$$ and eigenvalue $$\lambda_2=1$$ the eigenvector $$(5,1)$$ (that is, the other way around).
Being so, at the end you would have that $$\lim_{n\to\infty}w_2\,\lambda_2^n\,\vec{x}_{\lambda_2} = w_2\,(5,1)=(5/6, 1/6)$$