Maxima Function
charpoly (M, x)
Returns the characteristic polynomial for the matrix M
with respect to variable x. That is,
determinant (M - diagmatrix (length (M), x))
.
(%i1) a: matrix ([3, 1], [2, 4]); [ 3 1 ] (%o1) [ ] [ 2 4 ] (%i2) expand (charpoly (a, lambda)); 2 (%o2) lambda - 7 lambda + 10 (%i3) (programmode: true, solve (%)); (%o3) [lambda = 5, lambda = 2] (%i4) matrix ([x1], [x2]); [ x1 ] (%o4) [ ] [ x2 ] (%i5) ev (a . % - lambda*%, %th(2)[1]); [ x2 - 2 x1 ] (%o5) [ ] [ 2 x1 - x2 ] (%i6) %[1, 1] = 0; (%o6) x2 - 2 x1 = 0 (%i7) x2^2 + x1^2 = 1; 2 2 (%o7) x2 + x1 = 1 (%i8) solve ([%th(2), %], [x1, x2]); 1 2 (%o8) [[x1 = - -------, x2 = - -------], sqrt(5) sqrt(5) 1 2 [x1 = -------, x2 = -------]] sqrt(5) sqrt(5)