Absorbing markov chain calculator
This calculator is for finding the expected number of steps or time for absorbing starting from each of the transient states. This matrix describes the transitions of a Markov chain. This matric is also called as probability matrix, transition matrix, etc.
You can see a sample solution below. Enter your data to get the solution for your question
$$ \displaylines{---} $$
$$ \displaylines{ \mathbf{\color{Green}{Let's\;call\;All\;possible\;states\;as\;}}
\begin{bmatrix}
1 & 2 & 3 & 4 & \end{bmatrix}
\\ \\
\mathbf{\color{Green}{First\;we\;have\;to\;create\;Stochastic\;matrix}}
\\ \\
Stochastic\;matrix\;=\;P=
\begin{bmatrix}
* & 1 & 2 & 3 & 4 & \\ \\
1 & 0.5 & 0.5 & 0.0 & 0.0 & \\ \\
2 & 0.0 & 0.5 & 0.5 & 0.0 & \\ \\
3 & 0.5 & 0.0 & 0.0 & 0.5 & \\ \\
4 & 0.0 & 0.0 & 0.0 & 1.0 & \end{bmatrix}
\\ \\
\mathbf{\color{Green}{Absorbing\;states\;are\;}}
\mathbf{\color{Red}{4}}
\\ \\
\mathbf{\color{Green}{Now\;we\;have\;to\;make\;matrix\;Q}}
\\ \\
\mathbf{\color{Green}{Q\;is\;formed\;by\;removing\;all\;absorbing\;states\;from\;original\;matrix}}
\\ \\
Q=
\begin{bmatrix}
* & 1 & 2 & 3 & \\ \\
1 & 0.5 & 0.5 & 0.0 & \\ \\
2 & 0.0 & 0.5 & 0.5 & \\ \\
3 & 0.5 & 0.0 & 0.0 & \end{bmatrix}
\\ \\
\mathbf{\color{Green}{Now\;we\;make\;matrix\;N\;using\;below\;formula\;}}
\mathbf{\color{Red}{N\;=\;(I-Q)^{-1}}}
\\ \\
\mathbf{\color{Green}{Where\;I\;is\;Identity\;matrix}}
\\ \\ \Rightarrow
\left (
\begin{bmatrix}
1 & 0 & 0 & \\ \\
0 & 1 & 0 & \\ \\
0 & 0 & 1 & \end{bmatrix}
\mathbf{\color{Red}{-}}
\begin{bmatrix}
0.5 & 0.5 & 0.0 & \\ \\
0.0 & 0.5 & 0.5 & \\ \\
0.5 & 0.0 & 0.0 & \end{bmatrix}
\right )
^{ \mathbf{\color{Red}{-1}}}
\\ \\ \Rightarrow
\left (
\begin{bmatrix}
0.5 & -0.5 & 0.0 & \\ \\
0.0 & 0.5 & -0.5 & \\ \\
-0.5 & 0.0 & 1.0 & \end{bmatrix}
\right )
^{ \mathbf{\color{Red}{-1}}}
\\ \\ \Rightarrow
\mathbf{\color{Green}{N\;=\;}}
\begin{bmatrix}
4.0 & 4.0 & 2.0 & \\ \\
2.0 & 4.0 & 2.0 & \\ \\
2.0 & 2.0 & 2.0 & \end{bmatrix}
\\ \\
\mathbf{\color{Green}{The\;expected\;number\;of\;steps\;starting\;from\;each\;of\;the\;transient\;states\;is}}
\\ \\
\mathbf{\color{Green}{t\;=\;N*}}
\begin{bmatrix}
1
\\ \\
1
\\ \\
1
\end{bmatrix}
\\ \\ \Rightarrow
\begin{bmatrix}
4.0 & 4.0 & 2.0 & \\ \\
2.0 & 4.0 & 2.0 & \\ \\
2.0 & 2.0 & 2.0 & \end{bmatrix}
\mathbf{\color{Red}{*}}
\begin{bmatrix}
1
\\ \\
1
\\ \\
1
\end{bmatrix}
\\ \\ \Rightarrow
\begin{bmatrix}
10.0
\\ \\
8.0
\\ \\
6.0
\end{bmatrix}
\\ \\
\mathbf{\color{Green}{Therefore,\;}}
\mathbf{\color{Green}{Expected\;number\;of\;steps\;if\;started\;from\;state\;1\;=\;}}
\mathbf{\color{Red}{10.0}}
\\ \\
\mathbf{\color{Green}{Expected\;number\;of\;steps\;if\;started\;from\;state\;2\;=\;}}
\mathbf{\color{Red}{8.0}}
\\ \\
\mathbf{\color{Green}{Expected\;number\;of\;steps\;if\;started\;from\;state\;3\;=\;}}
\mathbf{\color{Red}{6.0}}
\\ \\
} $$