How do I get the logarithm of a matrix using another matrix as a base? $$
        \begin{bmatrix}
        0.8 &amp; 0.2 &amp; 0 \\
        0 &amp; 0.5 &amp; 0.5 \\ 
        0 &amp; 0 &amp; 1 \\
        \end{bmatrix} = T
$$

$$
        \begin{bmatrix}
        0 &amp; 0 &amp; 1 \\
        0 &amp; 0 &amp; 1 \\
        0 &amp; 0 &amp; 1 \\
        \end{bmatrix} = F
$$

This is a Markov Chain for a virus (well, sick, immune) and I'm trying to find out the exact number of cycles (and thus the exact amount of time) that the virus will last. 

$T^x = F$ becomes $x = \log_{T} F$. From there... I just have no clue.
The eigenvalues of your $T$ matrix are $0.8,0.5,1$
The 1 eigenvalue corresponds to the $[1,1,1]^T$ vector which is found last column in your matrix. So far so good.
When multiplying, what happens is that the eigenvalues multiply on themselves. So the eigenvalues of $T^k$ will be $0.8^k,0.5^k,1^k$ and as you know the power function will not totally zero any non-zero base, but it will get arbitrarily close as $k$ increases.


So a better question is something like "after how long time can we say with at least X% certainty that we are in this distribution?"

You can calculate the expected probability of being in last state after k hops :

 [1/3,1/3,1/3]*T^k*[0;0;1]


or
$$\frac{1}{3}\begin{bmatrix}1&amp;1&amp;1\end{bmatrix}\begin{bmatrix}
    0.8 &amp; 0.2 &amp; 0 \\
    0 &amp; 0.5 &amp; 0.5 \\ 
    0 &amp; 0 &amp; 1 \\
    \end{bmatrix}^{\,k}\begin{bmatrix}0\\0\\1\end{bmatrix}$$

Where 1/3 chance of starting in any position. Set k=1 and you should get 50% which you can check by hand.

What you may want to check is then to solve for when this expressions gets "close enough" to 1.

Here is a plot of the above expression for $k\in[1,32]$: As you can see, gets closer and closer but never quite hits $100\%$.
The eigenvalues of your $T$ matrix are $0.8,0.5,1$
The 1 eigenvalue corresponds to the $[1,1,1]^T$ vector which is found last column in your matrix. So far so good.
When multiplying, what happens is that the eigenvalues multiply on themselves. So the eigenvalues of $T^k$ will be $0.8^k,0.5^k,1^k$ and as you know the power function will not totally zero any non-zero base, but it will get arbitrarily close as $k$ increases.


So a better question is something like "after how long time can we say with at least X% certainty that we are in this distribution?"

You can calculate the expected probability of being in last state after k hops :

 [1/3,1/3,1/3]*T^k*[0;0;1]


or
$$\frac{1}{3}\begin{bmatrix}1&amp;1&amp;1\end{bmatrix}\begin{bmatrix}
    0.8 &amp; 0.2 &amp; 0 \\
    0 &amp; 0.5 &amp; 0.5 \\ 
    0 &amp; 0 &amp; 1 \\
    \end{bmatrix}^{\,k}\begin{bmatrix}0\\0\\1\end{bmatrix}$$

Where 1/3 chance of starting in any position. Set k=1 and you should get 50% which you can check by hand.

What you may want to check is then to solve for when this expressions gets "close enough" to 1.

Here is a plot of the above expression for $k\in[1,32]$: As you can see, gets closer and closer but never quite hits $100\%$.