TensorExpand[texpr]
expands out tensor-related products in the symbolic tensor expression texpr.
TensorExpand
TensorExpand[texpr]
expands out tensor-related products in the symbolic tensor expression texpr.
Details and Options
- TensorExpand expands sums and products by scalars in tensorial arguments.
- Expressions involving Dot and Cross are expanded by converting products of pairs of Cross subexpressions into linear combinations of Dot products.
- Symbolic arguments of Cross are assumed to represent vectors of adequate dimensionality.
- Symbolic arguments of MatrixPower and Inverse are assumed to represent invertible square matrices.
Examples
open all close allBasic Examples (2)
Scope (3)
Act on expressions containing all kinds of products:
(2a + b)c//TensorExpand(2a + b)c//TensorExpand(2a + b).c//TensorExpand(2a + b)c//TensorExpand(2a + b)⨯c//TensorExpandAct on expressions containing both symbolic and explicit objects:
(2a + b){x, y, z}//TensorExpandFor some operations, additional information needs to be supplied. The Dot product is not commutative in general:
a.b - b.a//TensorExpandHowever, if the objects are declared as vectors, then it is commutative:
Assuming[(a | b)∈Vectors[dim], %//TensorExpand]Options (1)
Applications (6)
(2v - w).w//TensorExpand(7v - 3w)⨯(w + v)//TensorExpandVector identities in dimension 3:
(v⨯w).v//TensorExpandw⨯v//TensorExpanda⨯(b⨯c)//TensorExpand(a⨯b)⨯c == -c⨯(a⨯b) == -a(b.c) + b(a.c)//TensorExpand(a⨯b).(c⨯d)//TensorExpand(a⨯b).(c⨯d) == (a⨯c).(b⨯d) - (b⨯c).(a⨯d)//TensorExpanda⨯(b⨯(c⨯d)) == b a.(c⨯d) - (a.b)c⨯d//TensorExpanda (b⨯c).d - b(a⨯c).d + c(a⨯b).d - d(a⨯b).c == 0//TensorExpand((a⨯b).c) ^ 4//TensorExpandVector identities in dimension 4:
a⨯b⨯c == b⨯c⨯a//TensorExpand(a⨯b⨯c).(d⨯e⨯f)//TensorExpand(a⨯b⨯c)⨯(a⨯b⨯d)⨯(a⨯b⨯e) == 0//TensorExpandCombination of transpositions:
Transpose[Transpose[A, {2, 3, 1}], {2, 1, 3}]//TensorExpandConjugateTranspose[Transpose[A, {2, 3, 1}]]//TensorExpandPowers of matrices. Matrices are assumed invertible:
MatrixPower[M, 4].M.M.Inverse[M]//TensorExpandMatrixPower[Transpose[Inverse[Transpose[M]]], 4]//TensorExpandDeclare a, b, c to be three-dimensional vectors:
$Assumptions = (a | b | c)∈Vectors[3]Then these formulas effectively invert the matrix {a,b,c}:
ap = (b⨯c/a.b⨯c);
bp = (c⨯a/a.b⨯c);
cp = (a⨯b/a.b⨯c);Outer[Dot, {a, b, c}, {ap, bp, cp}]//TensorExpandPossible Issues (2)
Neat Examples (1)
TensorRank[Subscript[v, n_]] ^= 1;For each integer n, there is a tree expression involving n Cross operations for n+1 vectors v0,…,vn:
TreeCross[0] := Subscript[v, 0];
TreeCross[n_] := TreeCross[n - 1] /. With[{m = BitClear[n, Floor@Log[2, n]]}, Subscript[v, m] -> Cross[Subscript[v, m], Subscript[v, n]]]TreeCross[7]TreeForm[%, 3]Now systematically convert all possible combinations of cross products into dot products and one cross product:
Do[Print[TreeCross[n] == TensorExpand[TreeCross[n]]], {n, 0, 8}]Tech Notes
Related Guides
History
Text
Wolfram Research (2012), TensorExpand, Wolfram Language function, https://reference.wolfram.com/language/ref/TensorExpand.html.
CMS
Wolfram Language. 2012. "TensorExpand." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/TensorExpand.html.
APA
Wolfram Language. (2012). TensorExpand. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/TensorExpand.html
BibTeX
@misc{reference.wolfram_2026_tensorexpand, author="Wolfram Research", title="{TensorExpand}", year="2012", howpublished="\url{https://reference.wolfram.com/language/ref/TensorExpand.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_tensorexpand, organization={Wolfram Research}, title={TensorExpand}, year={2012}, url={https://reference.wolfram.com/language/ref/TensorExpand.html}, note=[Accessed: 13-June-2026]}