To find $A$ given that $2I + A +A^2 = B$ where $B$ is given. How to find a matrix $A$ such that the following holds:
$$2I + A +A^2 = B,$$ where the matrix $B$ is given. I tried with char poly of $B$ but not getting any idea.
Note that it is also given that $B$ is invertible.
P.S. $B = \begin{pmatrix}-2&-7&-4\\ \:12&22&12\\ \:-12&-20&-10\end{pmatrix}$.
 A: So, how about saying that $$(A+{I\over 2})^2=B-{7I\over 4}$$ and starting by finding the square roots of $B-{7I\over 4}$?
A: Here is an ad hoc method:
It is straightforward (if tedious) to find null spaces of
$B-2I, B-4I, (B-4I)^2$ and determine the Jordan form.
With $V=\begin{bmatrix} 3 & -1 & 1 \\ -6 & 1 & 0 \\ 6 & -1 & -1 \end{bmatrix}$ we see that
$V^{-1}BV = \begin{bmatrix} 4 & 1 & 0  \\ 0 & 4 & 0 \\ 0 & 0 & 2 \end{bmatrix}$, and since $2+0+0^2 = 2$ we can look for $A$ of the form
$A=\begin{bmatrix} \lambda & \alpha & 0  \\ 0 & \lambda & 0 \\ 0 & 0 & 0 \end{bmatrix}$.
Then from $A^2+A+2I=B$ we get $\lambda^2+\lambda +2 = 4$ and so $\lambda \in \{-2,1\}$.
Then we need $2 \alpha \lambda + \alpha = 1$ from which we get
$\alpha = {1 \over 2 \lambda +1}$.
Hence $\lambda =-2, \alpha = -{1 \over 3}$ and $\lambda =1, \alpha = {1 \over 3}$ are two solutions (or rather $V A V^{-1}$).
A: According to the other posts, we may assume that $B=\begin{pmatrix}4&1&0\\0&4&0\\0&0&2\end{pmatrix}$. Note that $B$ is cyclic and that $AB=BA$; thus $A$ is a polynomial in $B$: $A=aI_3+bB+cB^2$.
Then $A$ is in the form -considered by copper.hat-
$A=\begin{pmatrix}u&p&0\\0&u&0\\0&0&v\end{pmatrix}$, where $2+u+u^2=4,2+v+v^2=2$. The sequel is easy; we obtain $4$ solutions

EDIT. We can also use the Mostafa's trick. 
Since $B-7/4I_3$ is cyclic invertible, it admits $2^k=4$ square roots (where $k$ is the number of its distinct eigenvalues). In the same way as above, $\sqrt{B-7/4I_3}$ is in the form 
$C=\begin{pmatrix}u&p&0\\0&u&0\\0&0&v\end{pmatrix}$, where $u^2=4-7/4,v^2=2-7/4$.
A: $$A=SJS^{-1},\\ 2I+A+A^2=S(2I+J+J^2)S^{-1}=B\\
2I+J+J^2=S^{-1}BS$$
So incorporating (yeah, stealing) the idea of the Mostafa Ayaz's answer we get $$\left(J+\frac{1}{2}I\right)^2=S^{-1}BS-\frac{7}{4}I$$
Letting, for a second, that $S$ is the same for $$B=S\begin{pmatrix}2&0&0\\0&4&1\\0&0&4\end{pmatrix}S^{-1}$$
we feed this thing to wolframalpha obtaining 
$$J+\frac{1}{2}I=\pm_{\small{1}}\begin{pmatrix}\frac12&0&0\\0&\pm_{\small{2}}\frac32&\pm_{\small{2}}\frac13
\\0&0&\pm_{\small{2}}\frac32\end{pmatrix}$$ and hence $A$. Can test here
