Equilibrium probabilities in simple 3-state Markov chain

markov chainsprobability

Consider the following problem, from Tijms's Understanding Probability:

The much feared Professor Frank N. Stone gives varying versions of an oral examination in assembly line fashion, with students taking
the exam one after the other. Each version of the exam may be categorized as
difficult, normal or easy. After a difficult exam, the next exam will be difficult
with probability 0.2, will be normal with probability 0.5, and will be easy with
probability 0.3. After normal and easy exams, these probabilities are 0.5, 0.25
and 0.25. Let's say you take the exam without any knowledge of the difficulty
factor of the preceding exams. What is the probability that you will get a difficult exam? What is this probability if you know that your friend had an easy exam, five exams previously?

Let's call the states "hard exam", "medium exam", "easy exam" respectively 1, 2, 3.

The transition probability matrix is:
$$
P=\begin{bmatrix}
0.2 & 0.5 & 0.3 \\
0.5 & 0.25 & 0.25 \\
0.5 & 0.25 & 0.25
\end{bmatrix}
$$

To answer the first question, we need to compute the unique equilibrium probabilities. Let's call these $\pi_1, \pi_2, \pi_3$ respectively for the hard, medium and easy exams.

We have to solve the linear system:
$$
\begin{gathered}
\pi_1 + \pi_2 + \pi_3 = 1 \\
\pi_2 = \frac12\pi_1 + \frac14 \pi_2 + \frac14\pi_3 \\
\pi_3 = \frac12\pi_1 + \frac14 \pi_2 + \frac14\pi_3.
\end{gathered}
$$

This is not the only choice of equations, but it should be a legit choice.
The solutions are:
$$
\pi_1 = \pi_2 = \pi_3 = \frac13.
$$

So the required probability, $\pi_1$, should be $1/3$.

For the second question, I compute the entry in the third row, first column of the matrix $P^6$. This gives a probability of 0.3856.

These results however are wrong (the probabilities should be 0.2692 and 0.3836). What am I doing wrong?

Edit: reading the answer by @CoolRobloxKid12 I realized that the linear system is wrong: it should be written by columns, not by rows:

$$
\begin{gathered}
\pi_1 + \pi_2 + \pi_3 = 1 \\
\pi_1 = \frac15\pi_1 + \frac12 \pi_2 + \frac12\pi_3 \\
\pi_2 = \frac12\pi_1 + \frac14 \pi_2 + \frac14\pi_3.
\end{gathered}
$$

The solutions are:
$$
\begin{gathered}
\pi_1=\frac{5}{13} & \pi_2=\frac{9}{26} & \pi_3=\frac{7}{26},
\end{gathered}
$$

and indeed $\frac{7}{26}$ is about 0.2692.

Best Answer

Ok, so from how I learned this, the transition matrix $P$ has column-sums adding up to 1 and I treat $x^{k + 1} = Px^k$, where $k$ is the $k$th step. This means the $P$ that I'm using is the transpose of your $P$, and I'll denote it $P_0$.

  1. To calculate equilibrium solutions, find the eigenvector whose eigenvalue is 1 for $P_0$ and scale it so that its terms sum to 1. That means solving the linear system (You're finding Null($P_0 - \lambda I$) where $\lambda = 1$): $$-0.8x_1 + 0.5x_2 + 0.5x_3 = 0$$ $$0.5x_1 -0.75x_2 + 0.25x_3 = 0$$ $$0.3x_1 + 0.25x_2 -0.75x_3 = 0$$ Then scale your solution so the terms sum up to 1.

  2. Find $x^6 = P_0^6x^0$. Here, $x^0 = \begin{bmatrix} 0 \\ 0 \\ 1\end{bmatrix}$ since the test 5 iterations ago was easy. The first entry of $x^6$ should be the probability that the upcoming exam will be hard.