I have a Markov matrix that looks like this:
\begin{align} P = \begin{pmatrix} 1 - p && q \\ p && 1 - q \end{pmatrix} \end{align}
Now, I want to prove that the following formula by eigenvalues
\begin{align} P^n = \dfrac{1}{p+q}\begin{pmatrix} q && q \\ p && p \end{pmatrix} + \dfrac{(1-p-q)^n}{p+q}\begin{pmatrix} p && -q \\ -p && q \end{pmatrix} \end{align}
Currently, I have found that eigenvalues are 1 and 1-p-q, and based on \begin{align} \det(P - \lambda E) = 0 \end{align} I did get the two matrices in the formula above, however, I have no idea about how to write the relationship between them, please help me. Thank you for any advice!
You already found the eigenvalues $\lambda_1 = 1$, $\lambda_2 = 1 - p - q$, along with their eigenvectors $v_1 = \begin{pmatrix} q/p\\ 1 \end{pmatrix}$, $v_2 = \begin{pmatrix} 1\\ -1 \end{pmatrix}$. So you can diagonalize your matrix as $P = VDV^{-1}$, where $V = \begin{pmatrix} v_1 & v_2 \end{pmatrix} = \begin{pmatrix} q/p & 1\\ 1 & -1 \end{pmatrix}$, and $D = \begin{pmatrix} 1 & 0\\ 0 & 1 - p - q \end{pmatrix}$. (In general, if $P$ is $n \times n$ and you found eigenvalues $\lambda_1, \dots, \lambda_n$ and independent eigenvectors $v_1, \dots, v_n$, then you can diagonalize it as $P = VDV^{-1}$, where $V = \begin{pmatrix} v_1 & \dots & v_n \end{pmatrix}$ - i.e., arrange the eigenvectors in columns, and $D = \begin{pmatrix} \lambda_1 & \ & \ \\ \ & \ddots & \ \\ \ & \ & \lambda_n \end{pmatrix}$.)
When you take $n$-th power, you get \begin{align*} P^n & = VD^n V^{-1}\\ & = \begin{pmatrix} q/p & 1\\ 1 & -1 \end{pmatrix} \begin{pmatrix} 1 & 0\\ 0 & (1 - p - q)^n \end{pmatrix} V^{-1}\\ & = \begin{pmatrix} q/p & 1\\ 1 & -1 \end{pmatrix} \begin{pmatrix} 1 & 0\\ 0 & (1 - p - q)^n \end{pmatrix} \begin{pmatrix} \frac{p}{p + q} & \frac{p}{p + q}\\ \frac{p}{p + q} & -\frac{q}{p + q} \end{pmatrix} \end{align*}
If you actually compute this matrix multiplication, you will get $$ \frac{p}{p + q}\begin{pmatrix} q/p + (1 - p - q)^n & q/p - q/p(1 - p - q)^n\\ 1 - (1 - p - q)^n & 1 + q/p(1 - p - q)^n \end{pmatrix} $$ You can break it into two parts - one that has a factor of $(1 - p - q)^n$, which simplifies to $\frac{(1 - p - q)^n}{p + q}\begin{pmatrix} p & -q\\ -p & q \end{pmatrix}$, the other without $(1 - p - q)^n$, which simplifies to $\frac{1}{p + q} \begin{pmatrix} q & q\\ p & p \end{pmatrix}$.