NonCommutativeExpand[expr,alg]
expands out the non-commutative algebra alg operations in expr.
NonCommutativeExpand
NonCommutativeExpand[expr,alg]
expands out the non-commutative algebra alg operations in expr.
Details
- NonCommutativeExpand is typically used to expand out non-commutative algebra operations.
- NonCommutativeExpand expands out the algebra multiplication with respect to the algebra addition. The multiplication and addition operations are specified in alg.
- alg can be a NonCommutativeAlgebra object or any valid NonCommutativeAlgebra specification. If the algebra argument is omitted, NonCommutativeAlgebra with the default property values is used.
- Positive integer powers of the algebra multiplication operation mult are expressed using GeneralizedPower, where GeneralizedPower[mult,e,2]==mult[e,e] and GeneralizedPower[mult,e,k+1]==mult[GeneralizedPower[mult,e,k],e].
- For algebras with relations, NonCommutativeExpand gives the standard representation of algebra elements.
- NonCommutativeExpand threads over lists in the first argument.
Examples
open all close allBasic Examples (3)
Expand NonCommutativeMultiply with respect to Plus:
NonCommutativeExpand[(a + 2b)**(3a + 4b)]Expand out multiplication mult with respect to addition add:
alg = NonCommutativeAlgebra[<|"Multiplication" -> mult, "Addition" -> add|>];NonCommutativeExpand[mult[add[a, 2b], add[3a, 4b]], alg]Compute the standard representation, reduced modulo algebra relations:
alg = NonCommutativeAlgebra[<|"Generators" -> {{x, y}}, "Relations" -> {x**x - 2y}|>];NonCommutativeExpand[x**x**x**x**x, alg]Scope (9)
Specify that the variable c commutes with all algebra elements:
alg = NonCommutativeAlgebra[<|"CommutativeVariables" -> {c}|>];NonCommutativeExpand[(a + b + c)**(a + b + c), alg]Specify that variables s and t represent scalars:
alg = NonCommutativeAlgebra[<|"ScalarVariables" -> {s, t}|>];NonCommutativeExpand[(s a + t b)**((s + t)a + 2s t b), alg]Expand GeneralizedPower of a sum:
NonCommutativeExpand[GeneralizedPower[NonCommutativeMultiply, a + b, 3]]Square matrices with Dot product form an algebra:
NonCommutativeExpand[a.(b + c).(2a + 3d), {Dot, n}]Linear endomorphisms with Composition form an algebra:
NonCommutativeExpand[Composition[f + g, g + h, h + f], Composition]Expand polynomials over an abstract algebra with symbolic property names:
alg = NonCommutativeAlgebra[<|"Multiplication" -> mult, "Addition" -> add, "Unity" -> one, "Zero" -> zero|>];NonCommutativeExpand[mult[add[x, y], add[2x, 3y], add[4x, 5y]], alg]NonCommutativeExpand[add[mult[add[x, y], add[2x, 3y], add[4x, 5y]], -%], alg]NonCommutativeExpand[OperationPower[mult, add[x, one], 3], alg]Scalar arguments to algebra operations are interpreted as scalar multiples of the multiplicative unity:
NonCommutativeExpand[(x + 1)**(y + 2)]alg = NonCommutativeAlgebra[<|"Multiplication" -> mult, "Addition" -> add, "Unity" -> one, "Zero" -> zero|>];NonCommutativeExpand[mult[add[x, 1], add[y, 2]], alg]Compute the standard representation of an element of an algebra with relations:
alg = WeylAlgebra[{{x, y}, {dx, dy}}];NonCommutativeExpand[dx**dy**x**y, alg]NonCommutativeExpand threads over lists in the first argument:
NonCommutativeExpand[{a**(b + c), (a + b)**c}]Applications (2)
Check whether two non-commutative polynomials are equal:
p = a**(b**c + c**b) + (b**c + c**b)**a + b**(a**c - c**a)q = (a**c - c**a)**b + c**(a**b + b**a) + (a**b + b**a)**cExpand the difference of the polynomials:
NonCommutativeExpand[p - q]Compute the standard representation of an algebra element:
alg = CliffordAlgebra[{{e1, e2}, {e3, e4}}];NonCommutativeExpand[e1**e2**e3**e4**e3**e2**e1, alg]Properties & Relations (1)
NonCommutativeExpand expands out the algebra multiplication with respect to the algebra addition:
NonCommutativeExpand[(a + b)**(2a + 3b)]Expand expands out Times with respect to Plus:
Expand[(a + b) * (2a + 3b)]ArrayExpand expands out array operations:
ArrayExpand[(a + b).(2a + 3b)]ArrayExpand[(a + b)(2a + 3b)]ArrayExpand[(a + b)⨯(2a + 3b)]Possible Issues (1)
NonCommutativeExpand works over a free algebra, without recognizing any relations between variables:
NonCommutativeExpand[(a + Inverse[b]).(b + Inverse[a]), {Dot, n}]ArrayExpand recognizes the relations between a matrix and its inverse:
ArrayExpand[(a + Inverse[b]).(b + Inverse[a]), Element[a | b, Matrices[{n, n}]]]Tech Notes
Related Guides
Text
Wolfram Research (2025), NonCommutativeExpand, Wolfram Language function, https://reference.wolfram.com/language/ref/NonCommutativeExpand.html (updated 2026).
CMS
Wolfram Language. 2025. "NonCommutativeExpand." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2026. https://reference.wolfram.com/language/ref/NonCommutativeExpand.html.
APA
Wolfram Language. (2025). NonCommutativeExpand. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/NonCommutativeExpand.html
BibTeX
@misc{reference.wolfram_2026_noncommutativeexpand, author="Wolfram Research", title="{NonCommutativeExpand}", year="2026", howpublished="\url{https://reference.wolfram.com/language/ref/NonCommutativeExpand.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_noncommutativeexpand, organization={Wolfram Research}, title={NonCommutativeExpand}, year={2026}, url={https://reference.wolfram.com/language/ref/NonCommutativeExpand.html}, note=[Accessed: 13-June-2026]}