Newish Mathematica user here! I just learned about the built-in vector type. To experiment with it I tried to specify that $a,b\in\mathbb{R}^3$ and I hoped that Mathematica would simplify $(2a+3b)\cdot (2a-3b)$ to yield $4a\cdot a- 9 b \cdot b$.

$Assumptions = 
  a \[Element] Vectors[3, Reals] && b \[Element] Vectors[3, Reals];
(2 a + 3 b ) . (2 a - 3 b) // Expand

Unfortunately I only see "(2 a + 3 b).(2 a - 3 b)" in the answer. I am aware of the related question How do I simplify a vector expression? but I don't want to create my own "vec" object. I would rather use the built-in Vector[3,Reals] object if this is possible. The actual application will have many vectors and lengthy symbolic (scalar) expressions instead of integer coefficients.

  • 6
    $\begingroup$ You just need TensorExpand. $\endgroup$
    – xzczd
    Commented May 16, 2021 at 15:40


Browse other questions tagged or ask your own question.