Collect[expr,x]
collects together terms involving the same powers of objects matching x.
Collect[expr,{x1,x2,…}]
successively collects together terms that involve the same powers of objects matching x1, then x2, ….
Collect[expr,var,h]
applies h to the expression that forms the coefficient of each term obtained.


Collect
Collect[expr,x]
collects together terms involving the same powers of objects matching x.
Collect[expr,{x1,x2,…}]
successively collects together terms that involve the same powers of objects matching x1, then x2, ….
Collect[expr,var,h]
applies h to the expression that forms the coefficient of each term obtained.
Examples
open all close allBasic Examples (4)
Scope (6)
Applications (1)
When a polynomial has many variables, it can be put into many different forms. Here is a polynomial in three variables:
Collect reorganizes the polynomial so that is the dominant variable:
If is specified as the parameter, the terms are organized with
as the leading variable:
When two variables are specified, the function will collect with respect to first, then collect with respect to
:
Or collect with respect to first, then collect with respect to
:
Properties & Relations (3)
Expand is effectively the inverse of Collect:
The order of variables matters:
Use NonCommutativeCollect to collect terms in a noncommutative polynomial:
Related Guides
Related Links
History
Introduced in 1988 (1.0) | Updated in 1996 (3.0) ▪ 2007 (6.0)
Text
Wolfram Research (1988), Collect, Wolfram Language function, https://reference.wolfram.com/language/ref/Collect.html (updated 2007).
CMS
Wolfram Language. 1988. "Collect." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2007. https://reference.wolfram.com/language/ref/Collect.html.
APA
Wolfram Language. (1988). Collect. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Collect.html
BibTeX
@misc{reference.wolfram_2025_collect, author="Wolfram Research", title="{Collect}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/Collect.html}", note=[Accessed: 13-August-2025]}
BibLaTeX
@online{reference.wolfram_2025_collect, organization={Wolfram Research}, title={Collect}, year={2007}, url={https://reference.wolfram.com/language/ref/Collect.html}, note=[Accessed: 13-August-2025]}