Show that $B$ is invertible if $B=A^2-2A+2I$ and $A^3=2I$ If $A$ is $40\times 40$ matrix such that $A^3=2I$ show that $B$ is invertible where $B=A^2-2A+2I$. 
I tried to evaluate $B(A-I)$ , $B(A+I)$ , $B(A-2I)$ ...  but I couldn't find anything.

$B=A^2-2A+2I$. Now multiplying the sides respectively by $A$ and $A^2$, and using the assumption $A^3=2I$ yields:
                             $$AB=BA=-2A^2+2A+2I$$
                             $$A^2B=BA^2=2A^2+2A-4I$$
Therefore
                             $$AB+A^2B=4A-2I$$
                             $$AB+2B=-2A+6I$$
By straightforward algebraic manipulation, it comes that:
                             $$A^2B+3AB+4B=BA^2+3BA+4B=10I$$
                             $$(A^2+3A+4I)B=B(A^2+3A+4I)=10I$$
Therefore
                             $$B^{-1}=(A^2+3A+4I)/10$$
