# Easy way to solve a matrix equation for a matrix?

I have two sets of $10\times 10$ matrices $M1,M2,M3,M4,M5$ and $N1,N2,N3,N4,N5$ and I want to solve a set of equations for these matrices

Solve[{
trafomatrix.M1.Inverse[trafomatrix] == N1,
trafomatrix.M2.Inverse[trafomatrix] == N2,
trafomatrix.M3.Inverse[trafomatrix] == N3,
trafomatrix.M4.Inverse[trafomatrix] == N4,
trafomatrix.M5.Inverse[trafomatrix] == N5},
{?????}
]


The thing I'm looking for is a $10\times 10$ matrix which I called above trafomatrix. Is there any way to tell Mathematica that is solve for this $10 \times 10$ matrix with arbitrary entries?

Of course a very ugly workaround would be to define, by hand, a $10\times 10$ matrix with 100 variable names in it and then specify these 100 variables at the end of Solve.

• By my count, you only have 50 equations for 100 variables, thus making this underdetermined. A short description of where these equations came from would be nice. – J. M. will be back soon Aug 5 '15 at 11:39
• @J. M. Of course you're right. Therefore let's assume I have 10 equations like those I wrote above.. – jak Aug 5 '15 at 11:40
• @J. M. Yes that is correct. The matrices Mk are the Cartan generators for the $\mathfrak{so}(10)$ Lie algebra and I want to compute the basis transformation that changes them into a specific other form Nk – jak Aug 5 '15 at 11:44
• Multiply both sides of each equation on the right by trafomatrix. This gets rid of matrix inverses and also makes the equations explicitly linear in the elements of trafomatrix. – Daniel Lichtblau Aug 5 '15 at 15:24
• @JakobH You mentioned the so(10) Lie algebra in an earlier comment. For illustrative purposes, could you provide the explicit matrices for, for instance, so(3) and the corresponding matrices for N. The key issue is whether the determinant of the matrix in my answer is singular or not. – bbgodfrey Aug 6 '15 at 5:15

Except in special cases, the problem seems overdetermined. Consider for simplicity

m = {{m11, m12, m13}, {m21, m22, m23}, {m31, m32, m33}};
n = {{n11, n12, n13}, {n21, n22, n23}, {n31, n32, n33}};
t = {{t11, t12, t13}, {t21, t22, t23}, {t31, t32, t33}};


Then, the first equation becomes

t.m - n.t == 0


unless t is singular. The solution is

Solve[t.m - n.t == 0, Flatten[t]]
(* {{t11 -> 0, t12 -> 0, t13 -> 0, t21 -> 0, t22 -> 0, t23 -> 0,
t31 -> 0, t32 -> 0, t33 -> 0}} *)


which is to be expected in general, because t.m - n.t == 0 is a linear homogeneous system of nine equations in nine unknowns. There are, of course, exceptions. The coefficients of these nine equations are

CoefficientArrays[Flatten[t.m - n.t], Flatten[t]][] // Normal
(* {{m11 - n11, m21, m31, -n12, 0, 0, -n13, 0, 0},
{m12, m22 - n11, m32, 0, -n12, 0, 0, -n13, 0},
{m13, m23, m33 - n11, 0, 0, -n12, 0, 0, -n13},
{-n21, 0, 0, m11 - n22, m21, m31, -n23, 0, 0},
{0, -n21, 0, m12, m22 - n22, m32, 0, -n23, 0},
{0, 0, -n21, m13, m23, m33 - n22, 0, 0, -n23},
{-n31, 0, 0, -n32, 0, 0, m11 - n33, m21, m31},
{0, -n31, 0, 0, -n32, 0, m12, m22 - n33, m32},
{0, 0, -n31, 0, 0, -n32, m13, m23, m33 - n33}} *)


If the determinant of this matrix is zero, then t need not be identically zero.

More equations involving t increase the degree to which the problem is overspecified.

• If m and n are similar (which is what the OP says), certainly there ought to be some t that will do the job. – J. M. will be back soon Aug 5 '15 at 14:47
• @J. M. If the matrices are related by similarity transformations, then those relationships need to be provided in the question. Or, perhaps I misunderstand your comment. In any case, a specific set of equations, perhaps involving SO(3), might be helpful. – bbgodfrey Aug 5 '15 at 15:10