For which values of $a$ the matrix is diagonalizable Given the following matrix:
$$B=\begin{bmatrix} 1 & 0 & 0 \\ 1 & 0 & a^2 \\ 1 & 1 & 0 \end{bmatrix}$$
I tried to find for which values of $a$, the matrix $B$ is diagonalizable.
I found that the characteristic polynomial is: $P_B(x) = (1-x)(x+a)(x-a)$.
(Stop reading here and skip to the Edit section below)  
Therefore I tried to find the eigenspace for each eigenvalue, but eventually concluded that:


*

*for $a=(-1)$, the eigenspaces are linearly dependent.

*for $a=1$, the trace of the diagonal form matrix (call it D) isn't equal to the trace of the matrix that's composed of the eigenvectors (call it Q).

*('a' must be 1 or (-1) according to the homogeneous equations with which I found the eigenspaces)


The diagonal form matrix that I have found (D):
$$D=\begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & -1 \end{bmatrix}$$
The matrix that's composed of the eigenvectors that I have found (Q):
$$Q=\begin{bmatrix} 0 & -1 & 0 \\ 1 & 2 & -1 \\ 1 & 1 & 1 \end{bmatrix}$$

Edit:
I have found a mistake in the row reduction process of the matrices...
So now we have:
The diagonal form matrix (D):
$$D=\begin{bmatrix} 1 & 0 & 0 \\ 0 & a & 0 \\ 0 & 0 & -a \end{bmatrix}$$
The matrix that's composed of the eigenvectors (Q):
$$Q=\begin{bmatrix} 1-\frac{a^2+1}{2} & 0 & 0 \\ \frac{a^2+1}{2} & a & -a \\ 0 & 1 & 1 \end{bmatrix}$$
D and Q should be similar, thus by comparing their trace, I have found that:
$a_1=(1+\sqrt{2})$ and $a_2=(1-\sqrt{2})$. Does it make sense?

Edit2 - To conclude:
I was confused about the relations between the matrices $B,Q \text{ and }D$:
At first I thought that matrices $Q \text{ and }D$ must be similar, but that isn't necessarily true!
Only matrices $B \text{ and }D$ must be similar.

Edit 3 - Response to Marc:
I understood everything until the last sentence. Also I tried an example using Wolfram Alpha on this matrix. Does it have something to do with a nilpotent characteristic of the matrix? Indeed I can compute $(B-pI)(B-qI)$ and also could've seen with the example that it's true, but don't understand the rules (or characteristics) which allow this to be true.
 A: The eigenvalues are $1, a, -a$ so if $a^2 \neq 1,$ then $A$ has three different eigenvalues so $A$ is diagonalizable.
Case $a^2 = 1$ :
the rank of $$A - I = \pmatrix{0&0&0\\1&-1&1\\1&1&-1}$$ is $2$ because the first and second columns are linearly independent, so the dimension of the null space of $A-I$ is $1$. Therefore when $a^2=1, A$ is not diagonalizable.  
added after the user1551's comment.
Case $a = 0$:
the rank of $A$ is $2$ therefore the null space of $A$ has dimension $1$ so again $A$ is not diagonalizable.
A: Given that the set of eigenvalues is $E=\{1,a,-a\}$, the matrix will be diagonalisable if and only if $P[B]=0$ where $P=\prod_{\lambda\in E}(X-\lambda)$ (a polynomial without repeated factors). If $E$ has $3$ elements then $P$ is the characteristic polynomial, and $P[B]=0$ always (by the Cayley-Hamilton theorem, or simply because you know that the characteristic polynomial having $n=3$ distinct roots of implies being diagonalisable). So there remain the following two cases to consider:


*

*Case $a=0$. Then $P=X(X-1)$, and $B$ is not diagonalisable since $B(B-I)\neq0$.

*Case $a^2=1$. Then $P=(X-1)(X+1)=X^2-1$, and $B$ is not diagonalisable since $B^2-I\neq0$.
