6 minutes read

In a previous topic, you got to know permutations, which are orderings of a list of elements. You learned how to calculate the number of different permutations of nn elements. This is useful, but there are cases when you want to count the permutations of only some nn elements instead of all of them. For example, suppose you want to count the number of possible 66-letter passwords that contain only lowercase letters. Here, you do not want to count the permutations of all 2626 letters. Instead, you want to count the ways you can choose and permute 66 letters. In this topic, you will learn how this counting can be done both when repetition of elements is and is not allowed in the permutation. In case you are curious, there are 165,765,600165,765,600 possible passwords if repetition is not allowed and 308,915,776308,915,776 if repetition is allowed. Keep reading to understand how these calculations are done.

Arrangements without repetition

Let's consider the problem of counting possible passwords. To simplify, let's consider an alphabet of four characters and passwords of length 22. Given the set {w, x, y, z}\text{\{w, x, y, z\}}, in how many ways can you choose two different letters and write them in order if a letter cannot be chosen more than once?

Let's list out the different pairs of letters as follows.

wx, xw, wy, yw, wz, zw, xy, yx, xz, zx, yz, zy\text{wx, xw, wy, yw, wz, zw, xy, yx, xz, zx, yz, zy}

There are 1212 pairs. Each of these orderings of two elements is called a 22-permutation of the set {w, x, y, z}\text{\{w, x, y, z\}}.

A kk-permutation of nn without repetition is a sequence of kk distinct elements of a set of nn elements. The number of kk-permutations denoted P(n,k)P(n, k) or PnkP_{n}^k. It is calculated as follows.

P(n,k)=Pnk=n!(nk)!P(n, k) = P_{n}^k = {n! \over (n-k)!}

In general, finding a kk-permutation of a set with nn distinct elements can be thought of as a kk-step operation:

1. Choose the first element from the set of nn elements.
2. Choose the second element from the remaining n1n-1 elements.


k. Choose the kkth element from the remaining nk+1n-k+1 elements.

The number of kk-permutations of a set is equal to the number of ways the above operation can be performed. You can calculate this by the rule of product. There are nn ways to perform the first step, n1n-1 ways to perform the second step, and so on until the final step where there are nk+1n-k+1 elements left. This gives the formula:

Pnk=n(n1)(n2)...(nk+1)=n!(nk)!P_{n}^k = n \cdot (n-1) \cdot (n-2) \cdot ... \cdot (n-k+1)= {n! \over (n-k)!}

In the problem at the start of this section, the given set contains no repeating elements. Using the formula for the number of 22-permutations of 44, you get the answer 1212, which is precisely what you enumerated above. P42=4!(42)!=242=12P_{4}^2 = {4! \over (4-2)!} = {24 \over 2} = 12

Arrangements with repetition

Let's consider a problem that is similar to the one given in the previous section. Given the set {w, x, y, z}\text{\{w, x, y, z\}}, in how many ways can you choose two letters and write them in order? The chosen letters can be the same.

ww, wx, xw, wy, yw, wz, zw, xx, xy, yx, xz, zx, yy, yz, zy, zz\text{ww, wx, xw, wy, yw, wz, zw, xx, xy, yx, xz, zx, yy, yz, zy, zz}

You count 1616 ways. Note how the answer has changed from the example in the previous section.

A kk-permutation of nn with repetition is a sequence of kk elements of a set of nn elements. The number of such kk-permutations is calculated as nkn^k:

R(n,k)=Rnk=nkR(n, k) = R_{n}^k = n^k

Like with arrangements without repetition, choosing a kk-permutation can be thought of as a kk-step process. However, in this case repetition is allowed, so each step has the nn options. kk elements are selected from a set of nn elements, and the same elements can be selected multiple times. By the rule of product, Rnk=nkR_{n}^k = n^k.

Revisiting the problem from the start of this section, we calculate R42=42=16R_{4}^2 = 4^2 = 16, which is exactly what we counted.

A complex example

Let's consider a slightly trickier example.

Suppose that there are 99 seats in a row. There are 66 adults and 33 children. How many seating arrangements are possible where every child has an adult to his/her immediate left and right seats?

We can start off by arranging just the adults in a row: there are 6!6! ways to do this. There are 55 spots between the adults where the 33 seats for the children can be placed. Placing a child into one of these spots ensures that they have an adult to their immediate right and left. 33 of the 55 available spots need to be chosen to seat the children: the number of seating arrangements of the children is P(5,3)P(5,3) (no repetition is allowed, because a child cannot sit in two seats at the same time). The total number of seating arrangements of everyone is calculated by the product rule: 6!P(5,3)=6!5!(53)!=43,2006! \cdot P(5,3) = 6! \cdot {5! \over (5-3)!} = 43,200

Conclusion

A kk-permutation of nn without repetition is calculated as:

Pnk=n!(nk)!P_{n}^k = {n! \over (n-k)!}A kk-permutation of nn with repetition is calculated as:

Rnk=nkR_{n}^k = n^kIt is important to note that solving problems about permutations may not always be possible with the above formulas. One strategy for solving such problems is to think of choosing a permutation as a process with a certain number of steps. You can calculate the number of desired permutations by the rule of product.

10 learners liked this piece of theory. 1 didn't like it. What about you?
Report a typo