What's wrong with my "proof" of the Cayley-Hamilton Theorem? The Cayley-Hamilton Theorem states that if we take the characteristic polynomial $p$ of an $n \times n$ matrix $A$
$$p(\lambda) = \det(A - \lambda I_n),$$
then
$$p(A) = 0.$$
What's wrong with my proof? I'm sure it's something simple, but I don't see it:
If we have $p$ as defined above, then simple replace $\lambda$ with $A$. This gives us
$$p(A) = \det(A - A I_n) = \det(A - A) = \det(0) = 0,$$
thereby proving the theorem.
 A: In which ring do you work, in $K$ or in $K[A] \subset M_n(K)$ the commutative subring generated by the matrix $A$. If you work in $K$ you certainly cannot consider $A$ as an element of the ring. If you work in $K[A]$, what is the meaning of $A$ in $det(A-\lambda I_n)$, is it a scalar ?
There is however, a trick which can make the proof correct. We know (Cramer Formula)that for every matrix $M$, on has $M.\tilde M= det(M). Id$, where $\tilde M$ is the transpose of the cofactor matrix of $M$. Applying this formula to $M=A-\lambda Id$ in the ring $K[\lambda]$ we get :
 $(A-\lambda. I_n)(A_0+\lambda A_1+\lambda ^2 A_2++\lambda^{n_1}A_{n-1})= p(\lambda) Id$. This identity is written in $M_n(K[\lambda])$. 
If $p(\lambda)=a_0+a_1\lambda+a_2\lambda ^2+..$, then:
$AA_0= a_0 Id$, $AA_1-A_0=a_1 Id$, $AA_2-A_1...=a_2 Id$ etc.
Therefore $p(A)=a_0Id+a_1 A+a_2A^2+...=AA_0-AA_0+A^2A_1-A^2A_1+..=0$ Note that we use the fact that the matrices $A.A_{i+1}-A_i$ are proportional to $Id$ and commute with $A$.
