I'm attempting to calculate the exponential of a matrix via Cayley-Hamilton theorem. (Following the "concrete example" from http://en.wikipedia.org/wiki/Cayley%E2%80%93Hamilton_theorem)
I am having trouble manipulating the characteristic polynomial:
A[1] = {{1, 2}, {3, 4}};
cp = CharacteristicPolynomial[A[1], x]
A[2] = x^2 - cp
A[2] = A[2] /. {x -> A[1]}
This is the form of the example. Now, I can't figure out a way to multiply only the +2 by the identity matrix, while substituting in x->A[1]
.
The correct result should be
5 A[1] + 2 *IdentityMatrix[2]
which obviously does not match
A[2] = A[2] /. {x -> A[1]}
As the "+2" is applied to all elements of A[1]
, not just the diagonals.
MatrixPower
, last example under Applications. $\endgroup$