## Tuesday, March 23, 2021

### [nfefxuyy] symbolic eigenvalues

2x2 matrix [a, b ; c, d]

characteristic polynomial = -(b*c) + a*d + (-a - d)*x + x^2

discriminant = a^2 + 4*b*c - 2*a*d + d^2

eigenvalues:

(a + d + sqrt(discriminant))/2
(a + d - sqrt(discriminant))/2

### 3x3 matrices

NB: we use the variable j not i to avoid confusion with I as the square root of -1.

Collect[-1*CharacteristicPolynomial[ {{a,b,c},{d,e,f},{g,h,j}},x],x]//InputForm

c*e*g - c*d*h + b*d*j - a*e*j + (-(b*d) + a*e - b*g - c*g + a*h + a*j + e*j)*x + (-a - e - h - j)*x^2 + x^3

same thing but with array.  beware that in Mathematica, array indicies start at 1.  i don't understand why Mathematica puts the constant term between x^3 and x^2.

Collect[-1*CharacteristicPolynomial[ Array[a,{3,3}],x],x] //InputForm

x^3 + a[1, 3]*a[2, 2]*a[3, 1] - a[1, 2]*a[2, 3]*a[3, 1] - a[1, 3]*a[2, 1]*a[3, 2] + a[1, 1]*a[2, 3]*a[3, 2] + x^2*(-a[1, 1] - a[2, 2] - a[3, 3]) + a[1, 2]*a[2, 1]*a[3, 3] - a[1, 1]*a[2, 2]*a[3, 3] + x*(-(a[1, 2]*a[2, 1]) + a[1, 1]*a[2, 2] - a[1, 3]*a[3, 1] - a[2, 3]*a[3, 2] + a[1, 1]*a[3, 3] + a[2, 2]*a[3, 3])

to get eigenvalues, solve the characteristic polynomial above using the cubic equation.  the discriminant allows peeking at the nature of roots before solving.

Discriminant[ CharacteristicPolynomial[ {{a,b,c},{d,e,f},{g,h,j}},x],x] //InputForm

a^2*b^2*d^2 + 4*b^3*d^3 - 2*a^3*b*d*e - 10*a*b^2*d^2*e + a^4*e^2 + 8*a^2*b*d*e^2 + b^2*d^2*e^2 - 2*a^3*e^3 - 2*a*b*d*e^3 + a^2*e^4 + 2*a^2*b*c*d*g + 12*b^2*c*d^2*g + 2*a^3*c*e*g - 2*a*b*c*d*e*g + 2*a^2*c*e^2*g + 20*b*c*d*e^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*a[2, 2]^2*a[3, 3]^3 - 2*a[2, 2]^3*a[3, 3]^3 - 2*a[1, 1]*a[1, 3]*a[3, 1]*a[3, 3]^3 + 2*a[1, 3]*a[2, 2]*a[3, 1]*a[3, 3]^3 - 4*a[1, 2]*a[2, 3]*a[3, 1]*a[3, 3]^3 - 4*a[1, 3]*a[2, 1]*a[3, 2]*a[3, 3]^3 + 2*a[1, 1]*a[2, 3]*a[3, 2]*a[3, 3]^3 - 2*a[2, 2]*a[2, 3]*a[3, 2]*a[3, 3]^3 + a[1, 1]^2*a[3, 3]^4 + 4*a[1, 2]*a[2, 1]*a[3, 3]^4 - 2*a[1, 1]*a[2, 2]*a[3, 3]^4 + a[2, 2]^2*a[3, 3]^4

here is how Mathematica solves a monic cubic equation.  better would be to avoid repeated subexpressions.  this is likely not the Right Way for other reasons as well.  the imaginary unit I that appears is casus irreducibilis.

Discriminant[ x^3+b*x^2+c*x+d,x] //InputForm

b^2*c^2 - 4*c^3 - 4*b^3*d + 18*b*c*d - 27*d^2

Reduce[ x^3+b*x^2+c*x+d==0,x,Cubics->True] //InputForm

x == -b/3 - (2^(1/3)*(-b^2 + 3*c))/ (3*(-2*b^3 + 9*b*c - 27*d + 3*Sqrt[3]*Sqrt[-(b^2*c^2) + 4*c^3 + 4*b^3*d - 18*b*c*d + 27*d^2])^(1/3)) + (-2*b^3 + 9*b*c - 27*d + 3*Sqrt[3]*Sqrt[-(b^2*c^2) + 4*c^3 + 4*b^3*d - 18*b*c*d + 27*d^2])^(1/3)/(3*2^(1/3)) || x == -b/3 + ((1 + I*Sqrt[3])*(-b^2 + 3*c))/ (3*2^(2/3)*(-2*b^3 + 9*b*c - 27*d + 3*Sqrt[3]*Sqrt[-(b^2*c^2) + 4*c^3 + 4*b^3*d - 18*b*c*d + 27*d^2])^(1/3)) - ((1 - I*Sqrt[3])*(-2*b^3 + 9*b*c - 27*d + 3*Sqrt[3]* Sqrt[-(b^2*c^2) + 4*c^3 + 4*b^3*d - 18*b*c*d + 27*d^2])^(1/3))/(6*2^(1/3)) || x == -b/3 + ((1 - I*Sqrt[3])*(-b^2 + 3*c))/ (3*2^(2/3)*(-2*b^3 + 9*b*c - 27*d + 3*Sqrt[3]*Sqrt[-(b^2*c^2) + 4*c^3 + 4*b^3*d - 18*b*c*d + 27*d^2])^(1/3)) - ((1 + I*Sqrt[3])*(-2*b^3 + 9*b*c - 27*d + 3*Sqrt[3]* Sqrt[-(b^2*c^2) + 4*c^3 + 4*b^3*d - 18*b*c*d + 27*d^2])^(1/3))/(6*2^(1/3))

The Roots function also works.

Can Mathematica be coaxed to emit the solution in terms of the discriminant?

### 4x4 matrices

Collect[CharacteristicPolynomial[ Array[a,{4,4}],x],x,Simplify] //InputForm

x^4 + a[1, 2]*a[2, 4]*a[3, 3]*a[4, 1] - a[1, 2]*a[2, 3]*a[3, 4]*a[4, 1] - a[1, 1]*a[2, 4]*a[3, 3]*a[4, 2] + a[1, 1]*a[2, 3]*a[3, 4]*a[4, 2] - a[1, 2]*a[2, 4]*a[3, 1]*a[4, 3] + a[1, 1]*a[2, 4]*a[3, 2]*a[4, 3] + a[1, 2]*a[2, 1]*a[3, 4]*a[4, 3] - a[1, 1]*a[2, 2]*a[3, 4]*a[4, 3] + a[1, 4]*(a[2, 3]*(a[3, 2]*a[4, 1] - a[3, 1]*a[4, 2]) + a[2, 2]*(-(a[3, 3]*a[4, 1]) + a[3, 1]*a[4, 3]) + a[2, 1]*(a[3, 3]*a[4, 2] - a[3, 2]*a[4, 3])) + x^3*(-a[1, 1] - a[2, 2] - a[3, 3] - a[4, 4]) + a[1, 2]*a[2, 3]*a[3, 1]*a[4, 4] - a[1, 1]*a[2, 3]*a[3, 2]*a[4, 4] - a[1, 2]*a[2, 1]*a[3, 3]*a[4, 4] + a[1, 1]*a[2, 2]*a[3, 3]*a[4, 4] + x^2*(-(a[1, 2]*a[2, 1]) - a[1, 3]*a[3, 1] - a[2, 3]*a[3, 2] + a[2, 2]*a[3, 3] - a[1, 4]*a[4, 1] - a[2, 4]*a[4, 2] - a[3, 4]*a[4, 3] + a[2, 2]*a[4, 4] + a[3, 3]*a[4, 4] + a[1, 1]*(a[2, 2] + a[3, 3] + a[4, 4])) + a[1, 3]*(a[2, 4]*(-(a[3, 2]*a[4, 1]) + a[3, 1]*a[4, 2]) + a[2, 2]*(a[3, 4]*a[4, 1] - a[3, 1]*a[4, 4]) + a[2, 1]*(-(a[3, 4]*a[4, 2]) + a[3, 2]*a[4, 4])) + x*(a[1, 1]*a[2, 3]*a[3, 2] - a[1, 1]*a[2, 2]*a[3, 3] + a[1, 4]*a[2, 2]*a[4, 1] + a[1, 4]*a[3, 3]*a[4, 1] - a[1, 4]*a[2, 1]*a[4, 2] + a[1, 1]*a[2, 4]*a[4, 2] + a[2, 4]*a[3, 3]*a[4, 2] - a[2, 3]*a[3, 4]*a[4, 2] - a[1, 4]*a[3, 1]*a[4, 3] - a[2, 4]*a[3, 2]*a[4, 3] + a[1, 1]*a[3, 4]*a[4, 3] + a[2, 2]*a[3, 4]*a[4, 3] - a[1, 1]*a[2, 2]*a[4, 4] + a[2, 3]*a[3, 2]*a[4, 4] - a[1, 1]*a[3, 3]*a[4, 4] - a[2, 2]*a[3, 3]*a[4, 4] + a[1, 3]*(a[2, 2]*a[3, 1] - a[2, 1]*a[3, 2] - a[3, 4]*a[4, 1] + a[3, 1]*a[4, 4]) + a[1, 2]*(-(a[2, 3]*a[3, 1]) - a[2, 4]*a[4, 1] + a[2, 1]*(a[3, 3] + a[4, 4])))

CoefficientList[ CharacteristicPolynomial[ Array[a,{4,4}],x],x] //InputForm

{a[1, 4]*a[2, 3]*a[3, 2]*a[4, 1] - a[1, 3]*a[2, 4]*a[3, 2]*a[4, 1] - a[1, 4]*a[2, 2]*a[3, 3]*a[4, 1] + a[1, 2]*a[2, 4]*a[3, 3]*a[4, 1] + a[1, 3]*a[2, 2]*a[3, 4]*a[4, 1] - a[1, 2]*a[2, 3]*a[3, 4]*a[4, 1] - a[1, 4]*a[2, 3]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a[2, 2]*a[4, 4] + a[1, 3]*a[3, 1]*a[4, 4] + a[2, 3]*a[3, 2]*a[4, 4] - a[1, 1]*a[3, 3]*a[4, 4] - a[2, 2]*a[3, 3]*a[4, 4], -(a[1, 2]*a[2, 1]) + a[1, 1]*a[2, 2] - a[1, 3]*a[3, 1] - a[2, 3]*a[3, 2] + a[1, 1]*a[3, 3] + a[2, 2]*a[3, 3] - a[1, 4]*a[4, 1] - a[2, 4]*a[4, 2] - a[3, 4]*a[4, 3] + a[1, 1]*a[4, 4] + a[2, 2]*a[4, 4] + a[3, 3]*a[4, 4], -a[1, 1] - a[2, 2] - a[3, 3] - a[4, 4], 1}

one can extract items out of a list with the Part function.  however, the fact that Mathematica indices start from 1 not 0 is especially confusing for CoefficientList.

discriminant is too huge to include.  if you need it, construct it from the coefficients above and the discriminant of a general monic quartic given below.

ByteCount[ Discriminant[ CharacteristicPolynomial[ Array[a,{4,4}],x],x]]

74857232

(ByteCount of discriminant of characteristic polynomial of 3x3 matrix, given above, was 82072.)

solution to the monic quartic equation:

Discriminant[ x^4+b*x^3+c*x^2+d*x+e,x] //InputForm

b^2*c^2*d^2 - 4*c^3*d^2 - 4*b^3*d^3 + 18*b*c*d^3 - 27*d^4 - 4*b^2*c^3*e + 16*c^4*e + 18*b^3*c*d*e - 80*b*c^2*d*e - 6*b^2*d^2*e + 144*c*d^2*e - 27*b^4*e^2 + 144*b^2*c*e^2 - 128*c^2*e^2 - 192*b*d*e^2 + 256*e^3

Reduce[ x^4+b*x^3+c*x^2+d*x+e==0,x,Quartics->True] //InputForm

x == -b/4 - Sqrt[b^2/4 - (2*c)/3 + (2^(1/3)*(c^2 - 3*b*d + 12*e))/ (3*(2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e + Sqrt[-4*(c^2 - 3*b*d + 12*e)^3 + (2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e)^2])^(1/3)) + (2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e + Sqrt[-4*(c^2 - 3*b*d + 12*e)^3 + (2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e)^2])^(1/3)/(3*2^(1/3))]/2 - Sqrt[b^2/2 - (4*c)/3 - (2^(1/3)*(c^2 - 3*b*d + 12*e))/ (3*(2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e + Sqrt[-4*(c^2 - 3*b*d + 12*e)^3 + (2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e)^2])^(1/3)) - (2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e + Sqrt[-4*(c^2 - 3*b*d + 12*e)^3 + (2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e)^2])^(1/3)/(3*2^(1/3)) - (-b^3 + 4*b*c - 8*d)/ (4*Sqrt[b^2/4 - (2*c)/3 + (2^(1/3)*(c^2 - 3*b*d + 12*e))/ (3*(2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e + Sqrt[-4*(c^2 - 3*b*d + 12*e)^3 + (2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e)^2])^(1/3)) + (2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e + Sqrt[-4*(c^2 - 3*b*d + 12*e)^3 + (2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e)^2])^(1/3)/(3*2^(1/3))])]/2 || x == -b/4 - Sqrt[b^2/4 - (2*c)/3 + (2^(1/3)*(c^2 - 3*b*d + 12*e))/ (3*(2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e + Sqrt[-4*(c^2 - 3*b*d + 12*e)^3 + (2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e)^2])^(1/3)) + (2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e + Sqrt[-4*(c^2 - 3*b*d + 12*e)^3 + (2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e)^2])^(1/3)/(3*2^(1/3))]/2 + Sqrt[b^2/2 - (4*c)/3 - (2^(1/3)*(c^2 - 3*b*d + 12*e))/ (3*(2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e + Sqrt[-4*(c^2 - 3*b*d + 12*e)^3 + (2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e)^2])^(1/3)) - (2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e + Sqrt[-4*(c^2 - 3*b*d + 12*e)^3 + (2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e)^2])^(1/3)/(3*2^(1/3)) - (-b^3 + 4*b*c - 8*d)/ (4*Sqrt[b^2/4 - (2*c)/3 + (2^(1/3)*(c^2 - 3*b*d + 12*e))/ (3*(2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e + Sqrt[-4*(c^2 - 3*b*d + 12*e)^3 + (2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e)^2])^(1/3)) + (2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e + Sqrt[-4*(c^2 - 3*b*d + 12*e)^3 + (2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e)^2])^(1/3)/(3*2^(1/3))])]/2 || x == -b/4 + Sqrt[b^2/4 - (2*c)/3 + (2^(1/3)*(c^2 - 3*b*d + 12*e))/ (3*(2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e + Sqrt[-4*(c^2 - 3*b*d + 12*e)^3 + (2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e)^2])^(1/3)) + (2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e + Sqrt[-4*(c^2 - 3*b*d + 12*e)^3 + (2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e)^2])^(1/3)/(3*2^(1/3))]/2 - Sqrt[b^2/2 - (4*c)/3 - (2^(1/3)*(c^2 - 3*b*d + 12*e))/ (3*(2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e + Sqrt[-4*(c^2 - 3*b*d + 12*e)^3 + (2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e)^2])^(1/3)) - (2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e + Sqrt[-4*(c^2 - 3*b*d + 12*e)^3 + (2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e)^2])^(1/3)/(3*2^(1/3)) + (-b^3 + 4*b*c - 8*d)/ (4*Sqrt[b^2/4 - (2*c)/3 + (2^(1/3)*(c^2 - 3*b*d + 12*e))/ (3*(2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e + Sqrt[-4*(c^2 - 3*b*d + 12*e)^3 + (2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e)^2])^(1/3)) + (2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e + Sqrt[-4*(c^2 - 3*b*d + 12*e)^3 + (2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e)^2])^(1/3)/(3*2^(1/3))])]/2 || x == -b/4 + Sqrt[b^2/4 - (2*c)/3 + (2^(1/3)*(c^2 - 3*b*d + 12*e))/ (3*(2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e + Sqrt[-4*(c^2 - 3*b*d + 12*e)^3 + (2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e)^2])^(1/3)) + (2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e + Sqrt[-4*(c^2 - 3*b*d + 12*e)^3 + (2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e)^2])^(1/3)/(3*2^(1/3))]/2 + Sqrt[b^2/2 - (4*c)/3 - (2^(1/3)*(c^2 - 3*b*d + 12*e))/ (3*(2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e + Sqrt[-4*(c^2 - 3*b*d + 12*e)^3 + (2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e)^2])^(1/3)) - (2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e + Sqrt[-4*(c^2 - 3*b*d + 12*e)^3 + (2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e)^2])^(1/3)/(3*2^(1/3)) + (-b^3 + 4*b*c - 8*d)/ (4*Sqrt[b^2/4 - (2*c)/3 + (2^(1/3)*(c^2 - 3*b*d + 12*e))/ (3*(2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e + Sqrt[-4*(c^2 - 3*b*d + 12*e)^3 + (2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e)^2])^(1/3)) + (2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e + Sqrt[-4*(c^2 - 3*b*d + 12*e)^3 + (2*c^3 - 9*b*c*d + 27*d^2 + 27*b^2*e - 72*c*e)^2])^(1/3)/(3*2^(1/3))])]/2