Find all real matrices such that $X^{3}-4X^{2}+5X=\begin{pmatrix} 10 & 20 \\ 5 & 10 \end{pmatrix}$ The following question come from the 1998 Romanian Mathematical Competition:

Find all matrices in $M_2(\mathbb R)$ such that $$X^{3}-4X^{2}+5X=\begin{pmatrix} 10 & 20 \\ 5 & 10 \end{pmatrix}$$

Can you guy please help me? Thanks a lot!
 A: There is a matrix $U$ such that 
$$U^{-1}\begin{pmatrix} 10 & 20 \\ 5 & 10 \end{pmatrix} U=\begin{pmatrix} 20 & 0 \\ 0&0 \end{pmatrix}.$$ 
Let $Y=U^{-1}XU$, then $Y^{3}-4Y^{2}+5Y=\begin{pmatrix} 20 & 0 \\0 & 0 \end{pmatrix}$. The matrix $Y$ then commutes with $\begin{pmatrix} 20 & 0 \\ 0&0 \end{pmatrix}$ and so is diagonal. Let $Y=\begin{pmatrix} a & 0 \\ 0&b \end{pmatrix}.$
Then $a^{3}-4a^{2}+5a=20,b^{3}-4b^{2}+5b=0.$ The only real solutions are $a=4,b=0.$ 
Then $X$ is uniquely determined as $UYU^{-1}$. If we did not know  that $X=\begin{pmatrix} 2 & 4 \cr 1 & 2 \end{pmatrix}$ we could find it using the matrix $U$.
A: Let $X=\begin{pmatrix} a & b \cr c & d \end{pmatrix}$. Then the matrix equation immediately gives that $d=a$ and $b=4c$. Now it is easy to solve the last equations in $a$ and $c$. The only real solution is $a=2$ and $c=1$, and hence
$$
X=\begin{pmatrix} 2 & 4 \cr 1 & 2 \end{pmatrix}.
$$
For complex numbers there are several other solutions, e.g., 
$a=\frac{i + 6}{2},\; c= \frac{2- i }{4}$, or $a=-\frac{\sqrt{-5}}{2},\;c=-\frac{\sqrt{-5}}{4}$.
A: Let $p$ be the polynomial in question and $R$ be the right hand side. Note that $R$ is equivalent to $D=\operatorname{diag} (20,0)$.
Let $V^{-1}RV = D$, then since $V^{-1}p(X)V = p(V^{-1}XV) = D$, we can look for solutions
to $p(X)=D$ and then conjugate back to get the original solutions.
Note that $De_1 = 20 e_1, D e_2 = 0$. Hence $p(X)e_1 = 20e_1$, $p(X)e_2 = 0$.
If $\lambda$ is an eigenvalue of $X$ then $p(\lambda)$ is an eigenvalue of $p(X)$,
hence $X$ has distinct eigenvalues and $p(\lambda_1) = 20, p(\lambda_1) = 0$.
Hence $e_1,e_2$ are eigenvectors of $X$ (this is the key here).
In particular, $X$ is diagonal, so the problem reduces to solving $p(x) = 0$ (roots $0, 2 \pm i$) to get $X_{22}$ and $p(x)=20$ (roots $4,\pm \sqrt{5}i$) to get $X_{11}$ and seeing what combinations work.
Since the matrix is real, we see that $X$ must have roots $4,0$ and so $X = \operatorname{diag} (4,0)$.
To finish, we need to conjugate, if we let 
$V= \begin{bmatrix} 2 & -2 \\ 1 & 1\end{bmatrix}$, then
$V X  V^{-1} = \begin{bmatrix} 2 & 4 \\ 1 & 2\end{bmatrix}$.
A: Here is an other possibility to proceed. The Romanian NMO "should not know" the linear algebra related to diagonalization and/or Jordan forms for matrices, but for $2\times 2$ matrices it is a standard idea to use Cayley-Hamilton, since having the trace $t$ and the determinant $d$ of a matrix $A$ it is an exercise for matrix operations (theoretically also done in the classes) to check $A^2-tA+d=0$. In this sense, we may work as follows, using as much as possibly the arithmetics of the polynomial ring $\Bbb R[x]$.

The given matrix $A$ with entries $10, 20, 5, 10$ has trace $20$, and determinant zero. Let $g$ be the characteristic polynomial of $A$, so $g(A) = A^2-20A=0$. The unknown matrix $X$ satisfies for the polynomial $f(x)=x^3-4x^2+5x$ the given relation $f(x)=A$. So 
$$
\begin{aligned}
h(x):=g(f(x))
&=x^2(x^2 - 4x + 5)^2 - 20x(x^2 - 4x + 5)
\\
&=(x^2 - 4x + 5)(x^2 + 5)(x - 4)x
\end{aligned}
$$
annihilates $X$. 
Let $p\in\Bbb R[x]$ be the (monic) minimal polynomial of $X$. 
It has degree two, (else we get a contradiction with $f(X)=A$,) so it divides $h$. 


*

*The first factor is excluded immediately as a value for $p$, because this would imply $A=f(X)=Xp(X)=0$. 

*The second factor is also excluded as a value for $p$,  because else $f(x)-20=(x^2+5)(x-4)$ has the factor $(x^2+5)$, so $A-20I=(f-20)(A) =0$, again a contradiction.

*It follows $p(x)=x(x-4)=x^2-4x$. The rest obtained by division with rest of $f(x)=\color{gray}{x^3-4x^2}+5x$ by $p(x)=x^2-4x$ is $5x$, so we obtain:
$$
A=f(X)=5X\ .
$$
This brings the only matrix operation in the game
$$
X=\frac 15A=\begin{bmatrix}2&4\\1&2\end{bmatrix}\ .
$$
A: dan_fulea mentioned in another answer that the contestants are not expected to know diagonalisation or Jordan form. So, I will give a more elementary solution below. Let
$$
A=uv^T=\pmatrix{2\\ 1}\pmatrix{1&2}.
$$
The equation in question is equivalent to
$$
X^3-4X^2+5X=5A.\tag{1}
$$
One can easily verify that $A^2=4A$ and $X=A$ is a solution to $(1)$. In general, if $X$ satisfies $(1)$, we must have $XA=AX$, i.e. $Xuv^T=uv^TX$. Therefore $Xu=ku$ and $v^TX=kv^T$ for some common real factor $k$, and $XA=AX=kA$. It follows from $(1)$ that
\begin{aligned}
X^3A-4X^2A+5XA&=5A^2,\\
k^3A-4k^2A+5kA&=20A,\\
k^3-4k^2+5k-20&=0,\\
(k-4)(k^2+5)&=0.
\end{aligned}
Therefore $k=4$ and $XA=AX=4A$. Since $A^2=4A$, if we put $Y=X-A$, we get
$YA=AY=0$ or $Yuv^T=uv^TY=0$. Hence $Y$ must be a real scalar multiple of
$$
B=\pmatrix{2\\ -1}\pmatrix{1&-2}
$$
and $X=A+bB$ for some real scalar $b$. As $X=A$ is a solution to $(1)$, $AB=BA=0$ and $B^2=4B$, if we substitute $X=A+bB$ into $(1)$, we get
\begin{aligned}
b^3B^3-4b^2B^2+5bB&=0,\\
16b^3-16b^2+5b&=0,\\
b(16^2-16b+5)&=0,\\
b&=0.
\end{aligned}
Hence the only solution to $(1)$ is given by $X=A$.
