Computation of characteristic polynomial fails for me

201 Views Asked by At

For a matrix $A\in\mathbb{K}^{n\times n}$ where $\mathbb{K}\in\{\mathbb{R},\mathbb{C}\}$ the characteristic polynomial is defined as

$$\chi_A(\lambda) := \text{det}(A-\lambda I_n) = \sum_{k=0}^n c_k \lambda^k$$

with the recursive definition of the coefficients

$$c_n = (-1)^n,\;\;\;\;c_{n-1}=(-1)^{n-1}\text{tr}A,\;\;\;\;c_0 = \text{det}A$$

and the trace of the matrix $A$

$$\text{tr}A := \sum_{k=1}^n a_{kk}$$

But when i try to compute the polynomial my "hand-computed" solution is not the same as the one Mathematica provides.

$$A:=\begin{bmatrix}a&0&0\\0&b&0\\0&0&c\end{bmatrix}$$

leads for me to the polynomial

$$\chi_A^{Hand}(\lambda) = -\lambda^3+\lambda^2 (a+b+c)-\lambda (a+b+c) +abc$$

but calling

CharacteristicPolynomial[{{a, 0, 0}, {0, b, 0}, {0, 0, c}}, \[Lambda]]

in Mathematica leads to the result

$$\chi_A^{Mathematica}(\lambda)=a b c-a b \lambda -a c \lambda -b c \lambda +a \lambda ^2+b \lambda ^2+c \lambda ^2-\lambda ^3$$

Can anyone explain me, what i am doing wrong?

2

There are 2 best solutions below

3
On BEST ANSWER

Mathematica agrees with your answer. The degree is $n=3$. Your formulas say $c_3=(-1)^3=-1$, and $c_2 = (-1)^2 tr(A) = a+b+c$ and $c_0 = det(A) = a b c$, but the $c_1$ is not determined by your statement, so there is no contradiction. You wrongly concluded that $c_1 = -c_2$.

5
On

Your "recursive" definition isn't really recursive. It only describes three of the coefficients. You get the same value for those as Mathematica does. The coefficient of $\lambda^1 = \lambda^{n-2}$ isn't described by your formulas, and I don't understand how you computed it.