# How does Matlabs Symbolic Math Toolbox always finds an analytical eigendecomposition for arbitrary polynomial matrices?

1 view (last 30 days)
Bastian Loß on 27 Jun 2024
Commented: Bastian Loß on 27 Jun 2024
Hi,
I am a bit confused about the inner working of the symbolic math toolbox.
I always thought the symbolic math toolbox does a calculation in the background and therefore provides an exact analytical result, or notifies the user that the solution is not analytical.
But how does the "eig(...)" function then comes up with an result for an arbitrary polynomial matrix?
THe following codes shows two options to calculate the eigenvalues of an arbitrary matrix A.
Option 1 uses eig(A), to directly calculate the analytical expression for the eigenvalues.
Option 2 first constructs the characteristic polynomial and then roots it.
The following example always produces an analytical solution for option 1. But does return a "root(...)" object for option 2. If I understand correctly, the "root(...)" is used by Matlab, in case the to-be-rooted polynomial can not be rooted analytically (Abel-Ruffini Theorem?).
For me this begs the question, is the eigenvalue polynomial from eig(...) truly analytic?
% Build a random matrix:
Nlayer = 3;
syms z lambda
for idex = 1:Nlayer
A(:,:)= rand(3,3)*z^idex;
end
% Option 1: Use eig() directly
opt1_ev= eig(A)
opt1_ev =
% Option 2: root charpoly "by hand"
% Build characteristic Poly
charPoly = charpoly(A, 'lambda')
charPoly =
% Root characteristic poly
opt2_ev = solve(charPoly == 0, lambda)
opt2_ev =

Torsten on 27 Jun 2024
Moved: Torsten on 27 Jun 2024
For me this begs the question, is the eigenvalue polynomial from eig(...) truly analytic?
What do you mean for a polynomial to be "truly analytic" ?
If the size of your matrix is <= 4x4, you can get analytical expressions for its eigenvalues if you use the symbolic approach.
If the size of the matrix is > 4x4, MATLAB uses numerical methods of root-finding for polynomials to numerically approximate the eigenvalues - both for the symbolic and the numerical approach.
Bastian Loß on 27 Jun 2024
Ah, you are correct. My example was badly choosen, as a 3x3 polynomial matrix is indeed analytically solvable.
If I am using a 5x5 or larger matrix, both approaches result in the exact same "root(...)" expression.
Nlayer = 3;
syms z lambda
for idex = 1:Nlayer
A(:,:)= rand(5,5)*z^idex;
end
In my mind, my question was aimed at a more general property of the symbolic math toolbox. As a followup, I will clarify in a seperate question, as this one has been answered.
Thank you.

### Categories

Find more on Linear Algebra in Help Center and File Exchange

R2024a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!