I am trying to perform some symbolic calculus with tensors and matrices. I have recently noticed that one can set assumptions on variables by using the command $Assumptions$ as described here. However, when I make

$Assumptions$ = U ∈ Matrices[{d, m}, Reals];
$Assumptions$ = P ∈ Matrices[{d, t}, Reals];

Y = Transpose[U].P;

I get

(* {2} *)

Using TensorDimensions doesn't return a useful result either, as


(* TensorDimensions[Transpose[U].Phi] *)

If I am assuming $U$ to be a $d\times m$ matrix and $P$ to be a $d\times t$ matrix, then the product between $U^{\intercal}P$ should be an $m\times t$ matrix. I am sure I am probably misunderstanding either the usage of $Assumptions$ or the usage of the command Dimensions[] regarding this particular case. But if that is so, why is it not working this way?

  • $\begingroup$ You have syntax errors: it's $Assumptions, not $Assumptions$. Second, when you run $Assumptions twice, you override the first cases with U. You can make either a List of assumptions or connect them with &&. Then you'll get {m,t} as TensorDimensions[Y]. $\endgroup$
    – corey979
    Nov 22, 2016 at 16:12
  • 2
    $\begingroup$ $Assumptions, per documentation, is only meaningful when used in functions that take the Assumptions option. Dimensions is not such a function but TensorDimensions is. $\endgroup$ Nov 22, 2016 at 21:48

1 Answer 1


You just have a small typo in $Assumptions and this works only with TensorDimensions

$Assumptions = {U ∈ Matrices[{d, m}, Reals], 
   P ∈ Matrices[{d, t}, Reals]};
Y = Transpose[U].P;
Y // Dimensions
Y // TensorDimensions


{m, t}


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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