TransWikia.com

Finding the similarity transformation between two matrices

Mathematica Asked on December 28, 2020

I have difficulty in finding the transformation matrix of two similar matrices.

It is known that matrix $A=left(begin{array}{ccc}
-2 & -2 & 1
2 & x & -2
0 & 0 & -2
end{array}right)$
is similar to matrix $B=left(begin{array}{lll}
2 & 1 & 0
0 & -1 & 0
0 & 0 & y
end{array}right)$
.

I found the specific values of $x$ and $y$ by using the following method:

Aλ = λ*
    IdentityMatrix[3] - {{-2, -2, 1}, {2, x, -2}, {0, 0, -2}};
Bλ = λ*
    IdentityMatrix[3] - {{2, 1, 0}, {0, -1, 0}, {0, 0, y}};
Control`PCS`SmithForm[Aλ, λ]
Control`PCS`SmithForm[Bλ, λ]
SolveAlways[-(λ + 2) (-λ^2 - 
     2 λ + λ x + 2 x - 4) == (λ - 
     2) (λ + 1) (-(y - λ)), λ]

When I want to find an invertible matrix P such that $P^{-1}AP=B$, I have a problem:

eqs = Thread[
   Flatten[Inverse[{{x11, x12, x13}, {x21, x22, x23}, {x31, x32, 
         x33}}].({{-2, -2, 1}, {2, x, -2}, {0, 0, -2}} /. 
        x -> 3).{{x11, x12, x13}, {x21, x22, x23}, {x31, x32, 
        x33}}] == 
    Flatten[{{2, 1, 0}, {0, -1, 0}, {0, 0, y}} /. y -> -2]];
FindInstance[eqs, {x11, x12, x13, x21, x22, x23, x31, x32, 
  x33}, Reals]

The above code has been running, unable to return the results, what is a good way to find this matrix $P$?

2 Answers

Your specific example can be solve with a general $P$, see code below.

(*Data*)
A = {{-2, -2, 1}, {2, x, -2}, {0, 0, -2}};
B = {{2, 1, 0}, {0, -1, 0}, {0, 0, y}};

(*Search for x and y based on characteristic polynomial*)
n = Length@A;
Id = IdentityMatrix@n;
solxy = SolveAlways[Det[A - l*Id] == Det[B - l*Id], l]

(*Update data*)
A = A /. solxy[[1]];
B = B /. solxy[[1]];

(*Solve for general P*)
P = Array[p, {n, n}];
solP = Solve[P.B == A.P, Flatten@P];
P = P /. solP[[1]]

(*Check*)
B == [email protected] // Simplify

enter image description here

You can then enter some values for the free components of $P$.

Correct answer by Mauricio Fernández on December 28, 2020

The purely linear algebraic way to do this is to reduce both matrices to Jordan form:

{sa, ja} = JordanDecomposition[{{-2, -2, 1}, {2, x, -2}, {0, 0, -2}}];
{sb, jb} = JordanDecomposition[{{2, 1, 0}, {0, -1, 0}, {0, 0, y}}];

Inspecting both ja and jb shows that they are both diagonal, so we can proceed:

Diagonal[ja]
   {-2, 1/2 (-2 + x - Sqrt[-12 + 4 x + x^2]), 1/2 (-2 + x + Sqrt[-12 + 4 x + x^2])}

Diagonal[jb]
   {-1, 2, y}

A moment's consideration leads us to letting y == -2. To try finding x, we try equating one of ja's unknown eigenvalues to one of jb's:

Solve[1/2 (-2 + x - Sqrt[-12 + 4 x + x^2]) == -1, x]
   {{x -> 3}}

(Exercise: look at what happens if you take all corresponding pairs of eigenvalues between ja and jb, and equate them.)

Thus, we can assemble the similarity transformation as:

pa = (sa /. x -> 3).Inverse[sb[[All, {3, 1, 2}]]]
   {{-1/2, -13/6, -1/4}, {1, 4/3, 1/2}, {0, 0, 1}}

(Exercise: derive the expression I used for the similarity transformation)

Check:

Inverse[pa].({{-2, -2, 1}, {2, x, -2}, {0, 0, -2}} /. x -> 3).pa -
({{2, 1, 0}, {0, -1, 0}, {0, 0, y}} /. y -> -2)
   {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}}

Answered by J. M.'s ennui on December 28, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP