Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have some problems.

First of all, I declare matrices like below

$Assumptions = {
  Element[X, Matrices[{m, n}]], 
  Element[T, Matrices[{n, k}]], 
  Element[Y, Matrices[{m, k}]]};

and I want to apply

transpose(X T - Y).(X T - Y) = 
  transpose[T].transpose[X].X.T - transpose[T].transpose[X].Y - 
  transpose[Y].X.T + transpose[Y].Y

so I tried

  1. Inner[Times, {X \[Transpose]}, {T \[Transpose]}, Plus] - \[Transpose][Y]

  2. Inner[NonCommutativeMultiply, {X}, {T}] - {Y} = {-Y + X ** T} ...

But I can not multiply the two above expressions.

  Inner[Times, {X\[Transpose]}, {T\[Transpose]}, Plus] - Transpose[Y], 
  Inner[NonCommutativeMultiply, {X}, {T}] - {Y}]

because I get errors. Could you help me?

share|improve this question

Works perfectly well for me. The only thing I see that is wrong is that you forgot the braces for Transpose[Y], so the code should look like this:

Inner[Times, {X\[Transpose]}, {T\[Transpose]}, Plus] - {Transpose[Y]}, 
Inner[NonCommutativeMultiply, {X}, {T}] - {Y}]
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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