To Find $A^{50}$ $$A=\begin{bmatrix}1 & 0&0\\1 & 0&1\\0&1&0\end{bmatrix}$$
Find $A^{50}$  ?
Now from Cayley–Hamilton theorem, I get $A^3-A^2-A+I=0$ and $A^{50}=(A^4)^{12}A^2$ so I found $A^4$ which is $-2A-I$, then we have $A^{50}=B^{12}A^2$ where $B =A^4$ was calculated, now should I again use Cayley–Hamilton theorem to find $B^{12}$ or is there a better possibility?

Let $f(x) = x^3-x^2-x-1 = (x^2-1)(x-1) = (x-1)^2(x+1)$.
Since $f(A) = 0$, we want to find polynomial $q(x), r(x)$ such that 
$$x^{50} = q(x)f(x) + r(x)\tag{*1}$$
with $\deg r(x) \le \deg f(x) - 1 = 2$. If we can figure out what is $r(x)$, then
$$A^{50} = q(A)f(A) + r(A) = r(A)$$
Write $r(x)$ as $a x^2 + b x + c$. To fix the coefficients, evaluate both side of $(*1)$ at
$1$ and $-1$ and the derivative at the double root $1$, we get:
$$
\begin{cases}
1  &= a + b + c\\
1  &= a - b + c\\
50 &= 2a + b
\end{cases}
\quad\implies\quad
\begin{cases}
a  &= 25\\
b  &= 0\\
c  &= 24\\
\end{cases}
\quad\implies\quad
r(x) = 25 x^2 - 24.
$$
As a result,
$$A^{50} = 25 A^2 - 24 I 
= 25 \begin{pmatrix}
1 & 0 & 0\\
1 & 1 & 0\\
1 & 0 & 1
\end{pmatrix}
- 24 \begin{pmatrix}
1 & 0 & 0\\
0 & 1 & 0\\
0 & 0 & 1
\end{pmatrix}
= 
\begin{pmatrix}
1 & 0 & 0\\
25 & 1 & 0\\
25 & 0 & 1
\end{pmatrix}
$$
