Given
$$A = \begin{bmatrix} \pi-1 & 1\\ -1 & \pi+1 \end{bmatrix}$$
I need to calculate its cosine, $\cos(A)$. Typically, I use diagonalisation to approach this type of problems:
$$\cos(A) = P \cos(D) P^{-1}$$
However, in this problem, the eigenvalues of the matrix are equal: $\lambda_1=\pi, \lambda_2=\pi$. Thus, there are no two linearly independent vectors and the method will not work.
Are there any alternative approaches?
Besides MacLaurin series expansion of $\cos(A)$, which does not work either since $A$ does not turn into a zero matrix at some point when multiplied by itself $n$ times.
When you do the Jordan decomposition, you get $A = SJS^{-1}$ with $$ S = \begin{pmatrix}1&1\\1&2\end{pmatrix}\quad\text{and}\quad J = \begin{pmatrix}\pi&1\\0&\pi\end{pmatrix}. $$ You find that $$ J^n = \begin{pmatrix}\pi^n&n\pi^{n-1}\\0&\pi^n\end{pmatrix}. $$ Since $A^n = SJ^nS^{-1}$, this implies \begin{align} \cos(A) &= \sum_{n=0}^\infty \frac{(-1)^nA^{2n}}{(2n)!} = S\left(\sum_{n=0}^\infty \frac{(-1)^nJ^{2n}}{(2n)!}\right)S^{-1}\\ &= S\left(\sum_{n=0}^\infty \frac{(-1)^n}{(2n)!}\begin{pmatrix}\pi^{2n}&2n\pi^{2n-1}\\0&\pi^{2n}\end{pmatrix}\right)S^{-1}\\ &= S\begin{pmatrix}\cos(\pi)&\sum_{n=0}^\infty\frac{2n\pi^{2n-1}}{(2n)!}\\0&\cos(\pi)\end{pmatrix}S^{-1} = S\begin{pmatrix}-1&\sum_{n=1}^\infty\frac{(-1)^n\pi^{2n-1}}{(2n-1)!}\\0&-1\end{pmatrix}S^{-1}\\ &= S\begin{pmatrix}-1&-\sin(\pi)\\0&-1\end{pmatrix}S^{-1} = -I_2. \end{align}