I happened to run into the Google foobar invitation when browsing the web. It is the doomsday-fuel problem led me here.
This artical is just note for patrickJMT markov Chain videos
Introduction example
Say we have two company sell a same kind of product. A shares 20% of the market, B shares 80% of the market.
A decide to launch an advertising campaign which will make
- Those who use A, 90% will still use A
- Those who use B, 70% will start to use A
This change will happen once a week as the campaign goes on.
Transition Graph
Probability Matrix and State Matrix
1 | import numpy as np |
Obtain the next state
Intuitive method
$$
A=(0.2 \times 0.9)+(0.8 \times 0.7) = 0.74
$$
$$
B = (0.8 \times 0.3) + (0.2 \times 0.1) = 0.26
$$
Matrix Calculation
1 | S1 = np.matmul(S0,P) |
1 | S2 = np.matmul(S1,P) |
1 | S3 = np.matmul(S2,P) |
==If the campaign goes on, will A’s market share converge???==
1 | for i in range(20): |
It converges.
$$
0.875 \times 0.9 + 0.125 \times 0.7 = 0.875
$$
$$
0.875\times 0.1 + 0.125\times 0.7 = 0.125
$$
We call this final S matrix a stationary matrix
and the final state a steady state
of the system.
Question
- Does every markov Chain has a unique
stationary matrix
? - If a markov Chain has a
stationary matrix
will the successive matrix always approach it ?
Both answer is NO! Only a regular
markov chain has these properties
Regular markov Chain
A transition matrix P is regular if some power of P has only positive entries.(NO zeros) A Markov chain is a regular Markov chain if its transition matrix is regular.
Find the stationary matrix
We only need to solve the equation below for any given P
$$
S \times P = S
$$
It alwasy converge
1 | S0 |
Abosrbing Markov Chain
An abosorbing state is a state where has no way to leave that state.
We can easily determine if a matrix has absorbing state if we have labels in order.
1 | """ |
Definition
A Markov chain is an absorbing chain if:
A) there is at least one absorbing state.
B) It is possible to go from each non-absorbing state to at least one absorbing state in a finite number of steps.
Standard form of absorbing Markov Chain
In a transition matrix, if all the absorbing states precede all the nonabsorbing states, the matrix is said to be in standard form. Standard forms are very useful in determining limiting matrices for absorbing Markov chains.
A standard form transition matrix can be partitioned into 4 submatrix
$$
P = \begin{bmatrix} I & 0\
R&Q
\end{bmatrix}
$$
I is an identity matrix and O is the zero matrix
Limiting Matrix
powers of P approach a limiting matrix P* where each row of P* is equal to the stationary matrix S if S exists
1 | np.matmul(P,P) |
We have a formula for P*
$$
P* = \begin{bmatrix}
I & 0\
FR&0
\end{bmatrix}, F = (I-Q)^{-1}
$$
$F$ is called the fundamental matrix for $P$
Properties of P*
P*[i][j]
gives the long-run probability from state i to state j- sum of that row in $F$ is the average number of trials it will take to go from that non-absorbing state to a arbitrary absorbing state
The problem
1 | Doomsday Fuel |
1 | from fractions import gcd |
- A view from linear algebra perspective is also heuristic MIT 18.06 (using the Eigen values and Eigen vectors)