Determine diagonal matrices that verify an equation 
Determine all diagonal matrices $X$ of order $3$ that verify the equation $X^2 - X - 21 = 0$.

I came up to this problem, but I don't know how to solve it. Nay thoughts please. 
 A: This is a matrix equation, do not mix matrices and numbers.
I assume the equation to solve is $$X^2-X-2I={\bf{0}},$$ where $I$ states for the matrix $I=\begin{pmatrix} 1&0&0\\0&1&0\\0&0&1\end{pmatrix}$ and the RHS is the matrix  $\begin{pmatrix} 0&0&0\\0&0&0\\0&0&0\end{pmatrix}.$
As said in a comment, we need to solve the quadratic equation $$r^2-r-2=0,$$ or equivalently $$(r+1)(r-2)=0.$$ The solutions are $-1$ and $2.$
EDIT 
The convenient diagonal matrices have $-1$ or $2$ as diagonal entries.
A: Follows a fully worked example of "how to do this" as requested by our OP JOJO in her/his comment to the question itself:
$X$ being a $3 \times 3$ diagonal matrix it may be written
$X = \begin{bmatrix} x_1 & 0 & 0 \\ 0 & x_2 & 0 \\ 0 & 0 & x_3 \end{bmatrix}; \tag 1$
then
$X^2 = \begin{bmatrix} x_1^2 & 0 & 0 \\ 0 & x_2^2 & 0 \\ 0 & 0 & x_3^2 \end{bmatrix}; \tag 2$
thus
$\begin{bmatrix} x_1^2 - x_1 - 21 & 0 & 0 \\ 0 & x_2^2 - x_2 - 21 & 0 \\ 0 & 0 & x_3^2 - x_3 - 21 \end{bmatrix} = X^2 - X - 21I = 0; \tag 3$
it is now easily seen that
$ x_i^2 - x_i - 21 = 0, \; 1 \le i \le 3; \tag 4$
we may now deploy the quadratic formula:
$x_i = \dfrac{-(-1) \pm \sqrt{(-1)^2 - 4(-21)}}{2} = \dfrac{1 \pm \sqrt{85}}{2}, \; 1 \le i \le 3; \tag 5$
returning to (1), since each of the $x_i$ may take on either of the two values (5), we see there are precisely $2^3 = 8$ possible matrices $X$ satisfying (2).
Nota Bene: I have taken the equation satisfied by $X$ to be 
$X^2 - X - 21I = 0, \tag 6$
rather than
$X^2 - X - 2I = 0, \tag 7$
as was done by user376343 in her/his answer; but since either equation has $2$ real roots, there are $8$ possible matrices $X$ in either case.  End of Note.
