Permutations[list]
generates a list of all possible permutations of the elements in list.
Permutations[list,n]
gives all permutations containing at most n elements.
Permutations[list,{n}]
gives all permutations containing exactly n elements.


Permutations
Permutations[list]
generates a list of all possible permutations of the elements in list.
Permutations[list,n]
gives all permutations containing at most n elements.
Permutations[list,{n}]
gives all permutations containing exactly n elements.
Details

- There are n! permutations of a list of n distinct elements.
- Repeated elements are treated as identical. »
- The object list need not have head List.
- Permutations[list] is effectively equivalent to Permutations[list,{Length[list]}].
- Permutations[list,{nmin,nmax}] gives permutations of list between nmin and nmax elements. Permutations[list,{nmin,nmax,dn}] uses step dn.
- Permutations[list,All] is equivalent to Permutations[list,{0,Length[list]}].
Examples
open all close allScope (4)
Properties & Relations (4)
The number of length-n permutations of a length-n list of distinct elements is n!:
The number of length-r permutations of a length-n list of distinct elements is FactorialPower[n,r]:
A permutation that leaves no element invariant is called a derangement:
The number of derangements of n distinct elements is Subfactorial[n]:
If the input list is in the order given by Sort, so are its length-r permutations:
See Also
Sort Signature RandomSample Tuples Reverse RotateLeft Factorial FactorialPower Subfactorial Subsets
Function Repository: Derangements PermutationIndex TableauxToPermutation PermutationToTableaux
Tech Notes
Related Guides
History
Introduced in 1988 (1.0) | Updated in 2007 (6.0)
Text
Wolfram Research (1988), Permutations, Wolfram Language function, https://reference.wolfram.com/language/ref/Permutations.html (updated 2007).
CMS
Wolfram Language. 1988. "Permutations." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2007. https://reference.wolfram.com/language/ref/Permutations.html.
APA
Wolfram Language. (1988). Permutations. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Permutations.html
BibTeX
@misc{reference.wolfram_2025_permutations, author="Wolfram Research", title="{Permutations}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/Permutations.html}", note=[Accessed: 15-August-2025]}
BibLaTeX
@online{reference.wolfram_2025_permutations, organization={Wolfram Research}, title={Permutations}, year={2007}, url={https://reference.wolfram.com/language/ref/Permutations.html}, note=[Accessed: 15-August-2025]}