排列與組合計算器

$n=$
$r=$

Permutation is an ordered arrangement of a number of elements of a set.

Mathematically, given a set with $n$ numbers of elements, the number of permutations of size $r$ is denoted by $P\left(n,r\right)$ or ${}_{n}P_{r}$ or ${}^{n}P_{r}$.

The formula is given by

$P\left(n,r\right)={}_{n}P_{r}={}^{n}P_{r}=\frac{n!}{\left(n-r\right)!}$

where $n!$ ($n$ factorial) $=n×\left(n-1\right)×\left(n-2\right)×\mathrm{...}×1$ and $0!=1$.

For example, given the set of letters $\left\{\text{a},\text{b},\text{c}\right\}$, the permutations of size 2 (take 2 elements of the set) are $\left\{\text{a},\text{b}\right\}$, $\left\{\text{b},\text{a}\right\}$, $\left\{\text{a},\text{c}\right\}$, $\left\{\text{c},\text{a}\right\}$, $\left\{\text{b},\text{c}\right\}$, and $\left\{\text{c},\text{b}\right\}$. Please note that the order is important; $\left\{\text{a},\text{b}\right\}$ is considered different from $\left\{\text{b},\text{a}\right\}$.

The number of permutations is 6.

$\begin{array}{rl}P\left(3,2\right)={}_{3}P_{2}={}^{3}P_{2}& =\frac{3!}{\left(3-2\right)!}\\ & =\frac{3×2×1}{1!}\\ & =\frac{6}{1}\\ & =6\end{array}$

Another example: How many different ways are there can 5 different books be arranged on the self?

Answer: Here, $n=5$ and $r=5$.
So,

$\begin{array}{rl}{}^{5}P_{5}& =\frac{5!}{\left(5-5\right)!}\\ & =\frac{5×4×3×2×1}{0!}\\ & =\frac{120}{1}\\ & =120\end{array}$

As can be seen from the above example, when $n=r$, then ${}^{n}P_{r}=n!$.

Combination is an unordered arrangement of a number of elements of a set.

Given a set with $n$ numbers of elements, the number of combinations of size $r$ is denoted by $C\left(n,r\right)$ or ${}_{n}C_{r}$ or ${}^{n}C_{r}$.

The formula is given by

$C\left(n,r\right)={}_{n}C_{r}={}^{n}C_{r}=\frac{n!}{r!\left(n-r\right)!}$

For example, given the set of letters $\left\{\text{a},\text{b},\text{c}\right\}$, the combinations of size 2 (take 2 elements of the set) are $\left\{\text{a},\text{b}\right\}$, $\left\{\text{a},\text{c}\right\}$, and $\left\{\text{b},\text{c}\right\}$. Please note that the order is not important; $\left\{\text{b},\text{a}\right\}$ is considered the same as $\left\{\text{a},\text{b}\right\}$.

The number of combinations is 3.

$\begin{array}{rl}C\left(3,2\right)={}_{3}C_{2}={}^{3}C_{2}& =\frac{3!}{2!\left(3-2\right)!}\\ & =\frac{3×2×1}{2×1×1!}\\ & =\frac{6}{2}\\ & =3\end{array}$

Another example: A basket contains an apple, an orange, a pear, and a banana. How many combinations of three fruits are there?

Answer: Here, $n=4$ and $r=3$.
So,

$\begin{array}{rl}{}^{4}C_{3}& =\frac{4!}{3!\left(4-3\right)!}\\ & =\frac{4×3×2×1}{\left(3×2×1\right)1!}\\ & =\frac{24}{6}\\ & =4\end{array}$

For combination, when $n=r$, the number of combinations is always equal to 1.