<s>[INST] Eigenvalues of an almost diagonal matrix I know that the eigenvalue of a diagonal matrix is simply the values in the diagonal. However, if I have a matrix of the following form:
$$
\begin{bmatrix}
a & b & 0 & 0 \\
b & c & 0  & 0 \\
0 & 0 & d & e \\
0 & 0 & e & f
\end{bmatrix}.
$$
Is there a closed form way to express the eigenvalues of this matrix? I can derive the eigenvalue of the smaller blocks along the diagonal, but how does it relate to the overall matrix?
 [/INST] The eigenvalues of a block diagonal matrix are the eigenvalues of each block. The corresponding eigenvectors are the eigenvectors of each block padded with zeros. For example:
The eigenvalues of the matrix $$A = \begin{bmatrix}4 & 3 \\ 3 & 4 \end{bmatrix}$$ are $7$ and $1$, and the corresponding eigenvectors are respectively $$\begin{bmatrix}1/\sqrt{2}\\ 1/\sqrt{2} \end{bmatrix} \quad \text{and} \quad \begin{bmatrix}1/\sqrt{2}\\ -1/\sqrt{2} \end{bmatrix}.$$
The eigenvalues of the matrix $$B = \begin{bmatrix}2 & 1 & 0 \\ 1 & 2 & 1 \\ 0 & 1 & 2\end{bmatrix}$$ are $2+\sqrt{2}$, $2$, and $2-\sqrt{2}$ and the corresponding eigenvectors are respectively $$\begin{bmatrix}1/2 \\ -1/\sqrt{2} \\ 1/2\end{bmatrix}, \quad \begin{bmatrix}-1/\sqrt{2} \\ 0 \\ 1/\sqrt{2}\end{bmatrix}, \quad \text{and} \quad \begin{bmatrix}1/2 \\ 1/\sqrt{2} \\ 1/2\end{bmatrix}.$$
The eigenvalues of the matrix $$\begin{bmatrix}A & 0 \\ 0 & B \end{bmatrix} = \begin{bmatrix}4 & 3 & 0 & 0 & 0 \\ 3 & 4 & 0 & 0 & 0 \\ 0 & 0 & 2 & 1 & 0 \\ 0 & 0 & 1 & 2 & 1 \\ 0 & 0 & 0 & 1 & 2 \end{bmatrix}$$ are $7$, $1$, $2+\sqrt{2}$, $2$, and $2-\sqrt{2}$, and the corresponding eigenvectors are respectively $$\begin{bmatrix}1/\sqrt{2}\\ 1/\sqrt{2} \\ 0 \\ 0 \\ 0\end{bmatrix}, \quad \begin{bmatrix}1/\sqrt{2}\\ -1/\sqrt{2} \\ 0 \\ 0 \\ 0\end{bmatrix}, \quad \begin{bmatrix}0 \\ 0 \\ 1/2 \\ -1/\sqrt{2} \\ 1/2\end{bmatrix}, \quad \begin{bmatrix}0 \\ 0 \\ -1/\sqrt{2} \\ 0 \\ 1/\sqrt{2}\end{bmatrix}, \quad \text{and} \quad \begin{bmatrix}0 \\ 0 \\ 1/2 \\ 1/\sqrt{2} \\ 1/2\end{bmatrix}.$$
</s>