# How to simplify symbolic matrix multiplication results?

I've defined three symbolic abstract matrices X, M and S as shown below.

In:= $Assumptions = { Element[X, Matrices[{k, 1}]], Element[M, Matrices[{k, 1}]], Element[S, Matrices[{k, k}, Reals, Symmetric[{1, 2}]]] }; In:= prodA = TensorTranspose[X].S.M; prodB = TensorTranspose[M].S.X; In:= TensorReduce[prodA + prodB] Out= TensorTranspose[M, {2, 1}].S.X + TensorTranspose[X, {2, 1}].S.M  Since the S is a square and symmetric matrix, the production results prodA and prodB should be equal. How can I let the output reflect that? I need the output show something like 2TensorTranspose[X].S.M. ## 1 Answer You can replace Matrices[{k, 1}] to Vectors[k] $Assumptions = {Element[X, Vectors[k]], Element[M, Vectors[k]],
Element[S, Matrices[{k, k}, Reals, Symmetric[{1, 2}]]]};

prodA = X.S.M; (* vector not needed to be transposed *)
prodB = M.S.X;

TensorReduce[prodA + prodB]

2 M.S.X


TensorReduce can't simplify Matrices[{k, 1}] because your relation is not true for general dimensions:

u = RandomReal[1.0, {10, 2}];
v = RandomReal[1.0, {10, 2}];
m = (# + Transpose[#]) &@RandomReal[1.0, {10, 10}];

Transpose[u].m.v // MatrixForm
Transpose[v].m.u // MatrixForm  • Exactly, using Vector declaration solves the problem. You're absolutely right! Thank you! Oct 14 '13 at 12:11