# 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.

• Algebraic operations on diagonal matrices are the same as applying those operations directly on the elements of the diagonal. So, that $X^2-X-21=0$ means that for each entry $d$ of the diagonal one must have $d^2-d-21=0$. So, the condition is equivalent to each entry of the diagonal is one of the two roots of the polynomial $x^2-x-21=0$. – MoonLightSyzygy Jan 7 at 19:26
• Can you please give me an example on how to do this? Thank you – JOJO Jan 7 at 19:40
• Why are you subtracting a scalar from a matrix? – Rodrigo de Azevedo Jan 8 at 7:26

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.

• I believe that there are eight solutions, not just two. – egreg Jan 7 at 22:23
• Right. Thank you. – user376343 Jan 7 at 23:10
• The first line just criticises what is a common notational convenience. – ancientmathematician Jan 8 at 7:34
• @ancientmathematician from my side it was not criticism. In the first, well accepted comment, the author uses 21 which doesn't give "nice" results. In a school exercise, it is probable that the right quadratic equation is that from my solution. Moreover, the first comment was not clear to OP. Thus I explained also the possible "I" instead of 1. – user376343 Jan 8 at 10:12

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.