It is clear why the argument is faulty.
But interestingly, there is a way to rescue it using clever formal substitution arguments. For the moment,
we assume that the matrix A is over the complex field.

Since the notation p⁢(λ) and p⁢(A) can be confusing at first sight, as one expression takes scalar values and the other matrix values, we will change it. From now on, we will use the notation p~⁢(t) when applying the polymial p to a matrix t. In this sense p⁢(⋅) is a function of ℂ and p~⁢(⋅) is function of matrices. Also, by definition,

The above expression may look strange, but if we think that the matrix t commutes with all D0,…,Dn-1 and A, then expression (2) is easily seen to be equal to

(D0+D1⁢t+…+Dn-1⁢tn-1)⁢(A-I⁢t)-c0⁢I-c1⁢t-…-cn⁢tn

This means that

Q⁢(t)=B~⁢(t)⁢(A-I⁢t)-p~⁢(t)whenever⁢t⁢commutes with⁢D0,…,Dn-1,A

(3)

The reason for not defining Q⁢(t) by the expression in (3) is that we want Q⁢(t) to be some kind of ”polynomial” in t (with matrix coefficients on the left of each tk).

We now state some properties that can be easily checked by straightforward calculation:

•

p~⁢(λ⁢I)=p⁢(λ)⁢I

•

B~⁢(λ⁢I)=B⁢(λ)

Notice that matrices of the form λ⁢I with λ∈ℂ commute with every other matrix, so that

Q⁢(λ⁢I)=B~⁢(λ⁢I)⁢(A-λ⁢I)-p~⁢(λ⁢I)=B⁢(λ)⁢(A-λ⁢I)-p⁢(λ)⁢I=0

Now Q⁢(λ⁢I) is also a matrix whose entries qi⁢j⁢(λ) are polynomials in λ. Since Q⁢(λ⁢I)=0 we must have qi⁢j⁢(λ)=0 for all λ∈ℂ. This means that qi⁢j⁢(t) is the zero
polynomial and, since this occurs for all i,j, it follows that
the matrix coefficients of tk occurring in (2) are all zero, i.e. Q⁢(t) is the zero matrix for all matrices t.

Actually, ℂ could have been substituted with ℝ or ℚ in the proof above.
The only property of ℂ that was used is that it is an infiniteintegral domain.

Proof (Proof for an arbitrary commutative ring with identity):

Let A=(ai⁢j), where the entries ai⁢j are in commutative ring with identity R. First notice that, since c0+c1⁢λ+…+cn⁢λn=p⁢(λ)=det⁡(A-λ⁢I), where λ∈R, we have that the coefficients c0,…,cn are polynomials in {ai⁢j}.

Hence p~⁢(A):=c0⁢I+c1⁢A+…+cn⁢An is a matrix whose entries are also polynomials in {ai⁢j}.
These polynomials vanish for every assignment of {ai⁢j} to numbers in ℂ,
because the complex case of the theorem has already been proven (this would be the same as substituting the matrix A by a matrix with complex entries).
Therefore these polynomials are zero polynomials and we conclude that p~⁢(A)=0 as we inteded to prove.□

Comments on other proofs

Yet another proof of the Cayley-Hamilton Theorem (http://planetmath.org/ProofOfCayleyHamiltonTheorem)
is to establish it for diagonalizable matrices,
and then by a density argument (i.e. every matrix can be approximated by
diagonalizable ones in an algebraically closed field),
we conclude that p⁢(A)=0 is an identity for all matrices over a field.
This kind of proof is also presented as an exercise in [1].

The “standard approach” can be found in [3].
It proves the result for matrices over any field,
but requires no “abstract algebra” (no algebraic closure, Zariski topology or formal substitutions).

The two other proofs just mentioned can be extended to matrices
over an arbitrary commutative ring simply by repeating the last argument
in our proof.

In [2] there is a proof similar to the one presented here (although it has some errors).