To set up the transition matrix, we'll arrange the probabilities in a matrix with the rows representing the current day's weather and columns representing the next day's weather. The given information will help us fill probablilities for the transition matrix.
Here's the transition matrix P:
```
| Sunny | Cloudy | Rainy
-------+-------+--------+-------
Sunny | 1/2 | 0 | 1/2
Cloudy | 1/3 | 0 | 2/3
Rainy | 2/3 | 1/6 | 1/6
```
P = [[1/2, 0, 1/2],
[1/3, 0, 2/3],
[2/3, 1/6, 1/6]]
For the probability of rain on Wednesday given it was sunny on Sunday, we'll need to find the state probabilities after 3 days (Sunday to Wednesday). To do this, we raise the transition matrix P to the power of 3:
P^3 = P x P x P
Computing P^3, we get:
P^3 = [[9/16, 1/16, 6/16],
[7/27, 2/27, 18/27],
[49/108, 7/108, 52/108]]
Now, let's use the initial state where it was sunny on Sunday:
The initial state vector is: [1, 0, 0]
Multiply the initial state vector by P^3 to get the state probabilities on Wednesday:
State probabilities = [1, 0, 0] x P^3 = [9/16, 1/16, 6/16]
The probability of rain on Wednesday is 6/16, or 0.375.
The weather on any given day in a particular city can be sunny, cloudy, or rainy. It has been observed to be predictable largely on the basis of the weather on the previous day. Specfically:
if it is sunny on one day, it will be sunny the next day 1/2 of the time, and never be cloudy the next day
if it is cloudy on one day, it will be sunny the next day 1/3 of the time, and never be cloudy the next day
if it is rainy on one day, it will be sunny the next day 2/3 of the time, and be cloudy the next day 1/6 of the time
Using 'sunny', 'cloudy', and 'rainy' (in that order) as the states in a system, set up the transition matrix for a Markov chain to describe this system.
Use your matrix to determine the probability that it will rain on Wednesday if it is sunny on Sunday.
find matrix P and probability of rain on wednesday
1 answer