Given a $2 \times 2$ matrix $A$ with $A^3=O$, find the sum of all the entries of matrix $A^2$ 
Given a matrix $$A=\begin{bmatrix} a & b\\c &d \end{bmatrix}$$ satisfying
$$A^3=O$$ find the sum of all the elements of matrix $A^2$.

My try:
Since $A$ is $2 \times 2$ matrix it can be expressed as
$$A^2=pA+qI$$ where $p$ and $q$ are some scalars. Then we have
$$A^3=pA^2+qA=O$$
So
$$p(pA+qI)+qA=O$$  that is
$$A=\frac{-pq}{p^2+q} I$$
So
$$A^2=\frac{p^2q^2}{(p^2+2q)^2} I$$
so sum  of elements of $A^2$ is $\frac{2p^2q^2}{(p^2+2q)^2}$. But the answer is zero. Can I know my mistake?
 A: A matrix $A\in M_n(K)$ satisfying $A^m=0$ for some $m\ge 1$ is nilpotent. Then we automatically have $A^n=0$, because the characteristic polynomial of $A$ is $\chi_A(t)=t^n$ and hence $A^n=0$ by Cayley-Hamilton. So in your case it follows that $A^2=0$. Hence the sum of all elements is zero here. (Also in your approach you have used Cayley-Hamilton.)
A: Your solution is absolutely correct. when $A^3=0$ we have the characteristic equation of $A$ as 
$$ A^2=tr(A)A-|A|I$$  
But since $A^3=0$ we have$|A|=0$  Hence characteristic equation reduces to
$$A^2=tr(A)A \tag{1}$$ So
$$A^3=tr(A)A^2=\left(tr(A)\right)^2A=0$$  which means either $tr(A)=0$ or $A=0$
if $A=0$ sum of elements of $A^2$ is obviously zero as $A^2$ is also null. Well if $tr(A)=0$ then $A^2$ is again null from $(1)$. So in either way $A^2=0$ so sum of elements of $A^2$ is zero as per your book answer.
A: Taking a path filled with work the matrix 
$$A=\left(\begin{matrix} a & b\\c & d \end{matrix}\right)$$
with the condition $A^3 = O_{2}$ leads to the set of equations
\begin{align}
a^3 + 2 a b c + b c d &=0 \\
c( a^2 + a d + b c + d^2 ) &= 0 \\
b( a^2 + ad + bc + d^2 ) &= 0 \\
a b c + 2 b c d + d^3 &= 0.
\end{align}
If $b=c=0$ then it is evident that $a^3 = d^3 = 0$. If $b\neq 0$, or equivalently $c \neq 0$ then the equations reduce to
\begin{align}
a^3 + 2 a b c + b c d &=0 \\
a^2 + a d + b c + d^2 &= 0 \\
a b c + 2 b c d + d^3 &= 0.
\end{align}
Some possible solutions can be then found to be: $(a,b,c,d) \in \{(0,b,0,0), (0,0,c,0), (a,-a,a,-a)\}$.
This then leads to the set of matrices being:
\begin{align}
A \in \left\{ \left(\begin{matrix} 0 & 0\\0 & 0 \end{matrix}\right), \left(\begin{matrix} 0 & b\\0 & 0 \end{matrix}\right), \left(\begin{matrix} 0 & 0\\c & 0 \end{matrix}\right), \left(\begin{matrix} a & -a\\a & -a \end{matrix}\right) \right\}.
\end{align}
In this set the sum of the elements is then $\{0,b,c\}$. These matrices demonstrate that $A^2 = O_{2}$ and $A^3 = O_{2}$ and $tr(A) = 0$.
Another example may be seen as:
$$A=\left(\begin{matrix} a & b\\c & a \end{matrix}\right)$$
for which
$$A^3 = \left(\begin{matrix} a(a^2 + 3 b c) & b(3a^2 + c)\\c(3 a^2 + b) & a(a^2 + 3 b c) \end{matrix}\right).$$
Taking $b = c= \frac{1}{9}$ leads to
$$A^3 = \frac{1+ 27 a^2}{81} \, \left(\begin{matrix} 3a & 1\\1 & 3a \end{matrix}\right).$$ 
Now it is left to solve $1 + 27 a^2 = 0$, or $a = \pm i/(3 \sqrt{3})$ for which
\begin{align}
A \in \left\{ \frac{1}{9} \, \left(\begin{matrix} i \sqrt{3} & 1\\1 & i \sqrt{3} \end{matrix}\right), \frac{1}{9} \, \left(\begin{matrix} - i \sqrt{3} & 1\\1 & - i \sqrt{3} \end{matrix}\right) \right\}.
\end{align}
The sum of the elements is $\{\frac{2(1+i\sqrt{3})}{9}, \frac{2(1-i \sqrt{3})}{9}\}$, $tr(A) \in \{\pm \frac{2i \sqrt{3}}{9}\}$, $Det(A) = - \frac{4}{81}$.
From Show that a matrix... the equation, with $t=tr(A)$ and $d = Det|A|$,
$A^2 - t \, A + d \, I_{2} = 0_{2}$ as been established. Multiplying this by $A$ and using the equation to reduce the resulting equation yields
$$A^{3} + (d - t^2) \, A + t d \, I_{2} = 0_{2}.$$ 
Since $A^3 = 0_{2}$ then $(d - t^2) \, A = - t d \, I_{2}$, or
$$A_{2} = - \frac{t \, d}{d - t^{2}} \, I_{2}.$$ 
The question asks about the sum of the elements of $A$ for which, by this last equation, it can be seen that
$$A_{\text{sum}} = - \frac{2 \, t \, d}{d - t^2}.$$
In essence the matrix has been diagonalized and it can be stated that
$$t = - \frac{2 \, t \, d}{d - t^2}$$
which reduces to $t^{2} = 3 d$, ie $Tr(A_{2}) = 3 \, Det(A_{2})$. The matrices presented in this solution all satisfy this requirement.
A: There are two issues with your argument. First, you are confusing the matrix entries $p,q$ with the coefficients in the characteristic polynomial -- you should have $A^2=\operatorname{tr}(A)A-\det(A)I$, not $A^2=pA+qI$. Second, it can happen (in fact, it is necessarily true) that both the trace and determinant of $A$ are zero, so the fraction $\frac{-\operatorname{tr}(A)\det(A)}{\operatorname{tr}(A)^2+\det(A)}$ can be invalid because of division by zero.
