I have two matrix expressions:




I want Mathematica to recognize that these expressions are equal. Is it possible to do that?

  • 1
    $\begingroup$ Answer probably depends on how you plan to use this known relation. Can you clarify the use case? $\endgroup$ – kirma Aug 27 '13 at 9:52
  • $\begingroup$ I am confused. Why are these equal? x = RandomReal[1, {4, 4}]; t = RandomReal[1, {4, 4}]; z0 = x.Transpose[t].Transpose[x]; z1 = x.t.Transpose[x]; z1 - z0 gives !Mathematica graphics should this not be all zeros if they are equal? $\endgroup$ – Nasser Aug 27 '13 at 11:01
  • $\begingroup$ Isn't this the same question as this? $\endgroup$ – István Zachar Aug 27 '13 at 11:33
  • $\begingroup$ @Nasser I don't think that the OP means they are equal in general, but more in a $Assumptions kind of way. $\endgroup$ – sebhofer Aug 27 '13 at 11:46
  • $\begingroup$ @Nasser Huh, but that's how $Assumptions are usually used for, no? The only question is if it will be helpful for the OP, as kirma pointed out... $\endgroup$ – sebhofer Aug 27 '13 at 11:52

We can easily verify the assumption that your matrices are equal is wrong, e.g. let's take two 2 x 2 matrices:

A = {{10, 5}, {2, 2}};
B = {{1, 0}, {1, 6}};

now we have

A.B.Transpose[A] == A.Transpose[B].Transpose[A]

However a simple fact in linear algebra says that the former matrix is equal to the latter one transposed.

TraditionalForm[ X.T.Transpose[X] == Transpose[X.Transpose[T].Transpose[X]] ]

enter image description here

Now we can exploit new tensor capabilities in Mathematica 9, first assume that X and T are n x m matrices:

$Assumptions = (X | T) ∈  Matrices[{n, m}];

then we can use e.g. TensorReduce:

TensorReduce[ X.T.Transpose[X] == Transpose[ X.Transpose[T].Transpose[X]] ]
  • $\begingroup$ @sebhofer Most of this site users know well this simple identity in linear algebra. I demonstrated that his "theorem" is not true by providing a simple example. Then I showed what kind of identity he could assumed and next solved that problem. My answer is clear enough even for first-year student. $\endgroup$ – Artes Aug 27 '13 at 12:29
  • $\begingroup$ With considerable effort, I could interpret OP asking how to provide assumption that T is symmetric. If this is the case, formulation of the question is not very direct. $\endgroup$ – kirma Aug 27 '13 at 13:00
  • $\begingroup$ I was wrong, sorry... I thought one could construct an example where T-Transpose@T is in the null-space of X, but this is not possible. I should have thought further first. Sorry for the fuzz! $\endgroup$ – sebhofer Aug 27 '13 at 13:04
  • 2
    $\begingroup$ @kirma If you want such an assumption use $Assumptions = G ∈ Matrices[{n, n}, Complexes, Symmetric[{1, 2}]]. Then TensorReduce[G - Transpose[G]] yields 0. If your interpretation would be the case one should have assumed Det[X] != 0 as well. $\endgroup$ – Artes Aug 27 '13 at 14:11

Clearly your expressions are the same only when the matrix T is symmetric. With this assumption, Mathematica can prove your expressions are equal using:

    X.Transpose[T].Transpose[X] == X.T.Transpose[X],
    Assumptions -> X ∈ Matrices[{n, n}] && T ∈ Matrices[{n,n}, Symmetric[{1,2}]]



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.