Expand

Expand[expr]

expands out products and positive integer powers in expr.

Expand[expr,patt]

leaves unexpanded any parts of expr that are free of the pattern patt. »

Details and Options

  • Expand works only on positive integer powers.
  • Expand applies only to the top level in expr.
  • Expand[expr,Modulus->p] expands expr reducing the result modulo p. »
  • Expand automatically threads over lists in expr, as well as equations, inequalities and logic functions.

Examples

open allclose all

Basic Examples  (3)

Expand a polynomial as a simple sum of terms:

Expand a product of polynomials:

Expand a polynomial of several variables:

Scope  (16)

Basic Uses  (9)

Expand a polynomial:

Expand a rational function:

Expand expressions involving arbitrary functions:

Expand does not go into subexpressions; ExpandAll does:

Expand applies to the numerator only:

ExpandAll applies to both the numerator and denominator:

Verify the equality of an expanded polynomial and its factored form:

Expand accepts polynomials with real or complex coefficients as inputs:

Expand threads over lists:

Expand threads over equations and inequalities:

Advanced Uses  (7)

Apply Expand to a polynomial over the integers modulo :

Apply Expand to a polynomial over a finite field:

Apply Expand to a trigonometric expression:

Apply Expand to polynomials with high-order powers efficiently:

Leave parts free of x unexpanded:

Leave parts free of 1+x unexpanded:

Leave anything not matching x[_] unexpanded:

Options  (3)

Modulus  (2)

Work in the field GF(2):

The modulus does not have to be a prime:

Trig  (1)

Expand a trigonometric expression:

Applications  (3)

Calculate the characteristic polynomial of a diagonal matrix:

The characteristic polynomial is the determinant of the following matrix:

Expand the product of diagonal elements to get the characteristic polynomial:

This can be directly computed using the CharacteristicPolynomial function:

Cyclotomic polynomials are monic, with integer coefficients, and are irreducible over the rational numbers.

The 16th cyclotomic polynomial is given below:

Use Expand to show that it has integer coefficients:

These polynomials can be directly computed using the Cyclotomic function:

Expand can be used to verify that two expressions are equal:

Properties & Relations  (3)

Many functions give results in unexpanded form:

Factor is essentially the inverse of Expand:

When no powers are involved, Distribute gives the same results as Expand:

Direct application of the distributive law often generates far more terms than are needed:

Neat Examples  (3)

Create a nested pattern corresponding to an additive cellular automaton (rule 60):

Wolfram Research (1988), Expand, Wolfram Language function, https://reference.wolfram.com/language/ref/Expand.html (updated 2023).

Text

Wolfram Research (1988), Expand, Wolfram Language function, https://reference.wolfram.com/language/ref/Expand.html (updated 2023).

CMS

Wolfram Language. 1988. "Expand." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2023. https://reference.wolfram.com/language/ref/Expand.html.

APA

Wolfram Language. (1988). Expand. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Expand.html

BibTeX

@misc{reference.wolfram_2023_expand, author="Wolfram Research", title="{Expand}", year="2023", howpublished="\url{https://reference.wolfram.com/language/ref/Expand.html}", note=[Accessed: 18-March-2024 ]}

BibLaTeX

@online{reference.wolfram_2023_expand, organization={Wolfram Research}, title={Expand}, year={2023}, url={https://reference.wolfram.com/language/ref/Expand.html}, note=[Accessed: 18-March-2024 ]}