```Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: finding a matrix used in matrix transformation
Date: Tue, 9 Nov 2010 19:40:04 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 19
Message-ID: <ibc82k\$ui\$1@fred.mathworks.com>
References: <ibc1cs\$61o\$1@fred.mathworks.com>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1289331604 978 172.30.248.35 (9 Nov 2010 19:40:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 9 Nov 2010 19:40:04 +0000 (UTC)
Xref: news.mathworks.com comp.soft-sys.matlab:685263

"pushkarini " <pushkarini.a@gmail.com> wrote in message <ibc1cs\$61o\$1@fred.mathworks.com>...
> Hi
> I have known matrices A and B (both square of size n say) such that
> B = inv(M)*A*M
> so that M*B = A*M
> I need to find M
> I can solve a system of n^2 equations in n^2 unknowns to find M, but is there an easier matlab command or another trick to do this?
>
> thanks
- - - - - - - - - -
The requirement that an invertible matrix M exists such that B = inv(M)*A*M is an equivalence relation and A and B are called 'similar' matrices if it holds between them.  It has been shown that matrices are similar if and only if their Jordan normal forms are the same up to possible rearrangement of the Jordan blocks.  There is a good paper on this subject by Kahan at:

http://www.eecs.berkeley.edu/~wkahan/MathH110/jordan.pdf

Presumably the way to find the M you seek would be to convert by similarity transform both A and B to their respective Jordan normal forms.  If these are alike up to rearrangement of their Jordan blocks, then combining all of these transformations and permutations would give you the necessary M matrix.  If not, then no such M can exist.

Unfortunately I don't know enough about the subject to tell you how to find the Jordan normal form using matlab, but reading the above paper might give you some ideas.  From a numerical analysis point of view finding the Jordan normal form is known to be numerically unstable in that small errors can make large differences in the result.  However I suspect this probably reflects the inherent difficulty of solving the problem you pose.

Roger Stafford
```