Find matrices that commute with $\operatorname{Diag}(1,1,-1)$.
Let, $A = \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1& 0 \\ 0 & 0 & -1 \end{bmatrix}$ . Then find $ S= \{B \in M_{3\times3}(\Bbb R) :AB=BA\}$ .
My attempt:
Bare computation yielded$$\left\{B\in M_{3\times3}(\Bbb R)\,\middle|\,B = \begin{bmatrix} c_1 & c_2 & 0 \\ c_3 & c_4& 0 \\ 0 & 0 & c_5 \end{bmatrix} , c_1,c_2,c_3,c_4,c_5 \in \Bbb R\right\} \subseteq S$$ but I am having trouble showing the reverse inclusion (if it is true!).
I was also tempted to use eigenvalues and eigenspaces to reach some conclusion by looking at the diagonal form of $A$ (displaying its eigenvalues), but can't get my way through!
Thanks in advance for help.
Yes, the reverse inclusion is true. Note that if$$B=\begin{pmatrix}b_{11}&b_{12}&b_{13}\\b_{21}&b_{22}&b_{23}\\b_{31}&b_{32}&b_{33}\end{pmatrix},$$then$$AB-BA=\begin{pmatrix}0&0&2b_{13}\\0&0&2b_{23}\\-2b_{31}&-2b_{32}&0\end{pmatrix}.$$Therefore, $AB=BA$ if and only if $b_{13}=b_{23}=b_{31}=b_{32}=0$.
Opposed to the direct computation, this is an approach via eigenspaces.
Let $M,N$ be any two matrices such that $MN=NM$. Let $c$ be an eigenvalue of $M$ and let's call $E_c$ to be the eigenspace associated to the eigen value $c$ .
Then for any $v \in E_c$ , $M(Nv)=(MN)v=(NM)v=N(Mv)=N(cv)=c(Nv)$ . So we get that, $N(E_c) \subset E_c$ .
Now back to our given problem. $A$ clearly has two eigenvalues : 1 and -1 with the former having multiplicity 2 and the latter having multiplicity 1.
A routine computation shows that, $E_1 = span\{(1,0,0),(0,1,0)\}$ and $E_{-1} = span\{(0,0,1)\}$.
So we get that, $B(1,0,0) \in E_1, B(0,1,0) \in E_1, B(0,0,1) \in E_{-1} $ i.e. $\exists c_1, \dots ,c_5\in \Bbb R$ such that ,$$B(1,0,0)=c_1(1,0,0)+c_2 (0,1,0) + 0(0,0,1)$$ $$B(0,1,0)=c_3(1,0,0)+c_4 (0,1,0)+0(0,0,1)$$ $$B(0,0,1)=0(1,0,0)+0 (0,1,0)+c_5(0,0,1)$$
And hence, in the standard basis, we get, $$B=\begin{bmatrix} c_1 & c_2 & 0 \\ c_3 & c_4 & 0 \\ 0 & 0 & c_5 \end{bmatrix}$$