# Assume a variable is a Matrix

Is it possible to tell Mathematica to assume a variable is a matrix, analogous to assuming a variable is real with the Assuming command?

• you can use $Assumptions = m \[Element] Matrices[{d, d}, Reals]] or Assuming[m \[Element] Matrices[{d, d}, Reals], ...] – kglr Oct 17 '18 at 1:06 • I think that such questions can't be answered productively without some context. Assuming does not affect every function. The right question is not "how to assume that a symbol is a matrix", but "how to do a certain operation with a symbolic matrix". So, what do you want to do exactly? – Szabolcs Oct 17 '18 at 8:41 • See all the questions on this site along the lines of "I set x to be real, but Mathematica doesn't treat it as such!". That's because only certain functions take assumptions into account. If the assumption is about tensors, the set of functions that supports them is even more restricted. – Szabolcs Oct 17 '18 at 8:43 ## 1 Answer Matrices can be used as a domain just like Reals, Integers: $Assumptions = Element[m1 | m2, Matrices[{d, d}, Reals, Symmetric[{1, 2}]]];
TensorDimensions[m1]


{d, d}

TensorDimensions[TensorProduct[m1, m2]]


{d, d, d, d}

Assuming[Element[v, Matrices[{d, d2}, Reals]], TensorDimensions[m v]]


{d, d2}