Solve $A^2=B$ where $B$ is the $3\times3$ matrix whose only nonzero entry is the top right entry Find all the matrices $A$ such that  $$A^2= \left( \begin {array}{ccc} 0&0&1\\ 0&0&0 \\ 0&0&0\end {array} \right) $$  where $A$ is a $3\times 3$ matrix. 
$A= \left( \begin {array}{ccc} 0&1&1\\ 0&0&1 \\ 0&0&0\end {array} \right) $
 and 
$A= \left( \begin {array}{ccc} 0&1&0\\ 0&0&1 \\ 0&0&0\end {array} \right) $ work, 
but how can I find all the matrices?

I don't know about all solutions, but given one solution, you can generate an infinity many other solutions: Let
$$
P=
\begin{pmatrix}
1 & x & y\\
0 & 1 & z \\
0 & 0 & 1\\
\end{pmatrix}
$$
Note that 
$$
P^{-1}=
\begin{pmatrix}
1 & -x & xz-y\\
0 & 1 & -z \\
0 & 0 & 1\\
\end{pmatrix}
$$
If 
$$
A^2=
\begin{pmatrix}
0 & 0 & 1\\
0 & 0 & 0 \\
0 & 0 & 0\\
\end{pmatrix}
$$
then 
$$
(P^{-1}AP)^2=P^{-1}A^2P=
\begin{pmatrix}
1 & -x & xz-y\\
0 & 1 & -z \\
0 & 0 & 1\\
\end{pmatrix}
\begin{pmatrix}
0 & 0 & 1\\
0 & 0 & 0 \\
0 & 0 & 0\\
\end{pmatrix}
\begin{pmatrix}
1 & x & y\\
0 & 1 & z \\
0 & 0 & 1\\
\end{pmatrix}=
\begin{pmatrix}
0 & 0 & 1\\
0 & 0 & 0 \\
0 & 0 & 0\\
\end{pmatrix}
$$
