Combinatorics 101: Filling the Vacant Spaces

Explore combinatorics by solving problems on arranging items, focusing on distinct and non-distinct items

Combinatorics 101: Filling the Vacant Spaces

In the previous part, we tackled some combinatorics problems using intuition, focusing on the principles of multiplication and addition. We discovered why \(n!\) gives us the number of ways to arrange \(n\) distinct objects.

We also developed a notion of filling vacant spaces. This idea of filling vacant spaces along with multiplication rule is really powerful and this is exactly where \(^n P_r\) comes from. \(^n P_r\) gives us the number of ways to arrange \(r\) objects from \(n\) objects.

Today, we'll dive deeper into solving various problems using the idea of filling vacant spaces, both with distinct and non-distinct items. Let's explore with practical examples!

Distinct items

Q1. How many 4 digit numbers can be formed using the digits 0, 1, 2, 3, 4 (without repetition)?

Let’s take \(4\) vacant spaces. We can’t put \(0\) in the first place, since it’ll make a \(4\) digit number. So, there are 4 options for the first digit. Once we have used \(1\) digit, we will have \(4\) digits left. So in the second place, we have \(4\) options. Now we’ve \(3\) digits left, so for the third place we have \(3\) options and so on.

$$\boxed{\quad4\quad|\quad4\quad|\quad3\quad|\quad2\quad}$$

So, the number of ways are \(4 \times 4 \times 3 \times 2 = 96\). The same calculation can also be done with \(^n p_r.\) The first cell has \(4\) options and once you filled that you have \(4\) digits and you need \(3\) more digits to make it a \(4\) digit number. The number ways you can form of \(3\) digits using \(4\) digits are \(^4P_{3}\). So, the total ways are = \(4 \times ^4P_{3} = 96\).

There is another elegant approach for this. If there were no \(0\), the answer would be \(^5P_4\). But in our case, \(^5P_4\) is wrong, because there are some wrong cases starting with \(0\). If we can calculate the number of wrong cases then we can subtract that from \(^5P_4\) to get our answer. Try yourself to find the number of wrong cases.

Q2. How many 4 digit numbers can be formed using the digits 1, 2, 3, 4, 5 (repetition allowed)?

Let’s take \(4\) vacant spaces. Notice that repetition is allowed, so we can always choose any of the \(5\) digit. So, \(4\) places will have \(5\) options each. We are not reducing options, since repetition is allowed. For example \(5555\) will be a valid \(4\) digit number and we have to count it, according to the problem.

$$\boxed{\quad5\quad|\quad5\quad|\quad5\quad|\quad5\quad}$$

So, the number of ways are \(5 \times 5 \times 5 \times 5 = 5^4\).

Q3. How many 4 digit numbers can be formed using the digits 0, 1, 2, 3, 4 (repetition allowed)?

First take \(4\) vacant spaces. Notice, if we place \( 0\) at the first cell it is not going to be a \(5 \) digit number. So in the first place, we can put \(4\) digits. For all the other cells, there’ll be \(5\) options.

$$\boxed{\quad4\quad|\quad5\quad|\quad5\quad|\quad5\quad}$$

So, the number of ways are \(4 \times 5 \times 5 \times 5 = 4 \times 5^3\)

Q4. How many 4 digit numbers divisible by 4 can be formed using the digits 0, 1, 2, 3, 4 (without repetition)?

We know that if when the sum of the last two digits of a number is divisible by \(4\), that whole number is divisible by \(4\). So Let’s pick the last \(2\) digits and write it down in the cells.

Let’s pick the last \(2\) digits \(0, 4\) (marked in violet). We already used \(2\) digits and have \(3\) digits left. So in the first and the second cell have \(3\) and \(2\) options respectively. Total ways are \(3 \times 2\).

$$\begin{align} \boxed{\quad3\quad|\quad2\quad|\color{violet}\quad\textbf{0}\quad|\quad\textbf{4}\quad} \end{align}$$

Simillarly pick the last 2 digits 1, 2 (marked as gray). We already used 2 digits and have 3 digits left. Notice for the first place we have 2 options, since we can’t put a 0 there. Once we pick that, we’ll have 2 options for the second place. Total ways are 2 \times 2.

$$\begin{align} \boxed{\quad2\quad|\quad2\quad|\color{violet}\quad\textbf{1}\quad|\quad\textbf{2}\quad} \end{align}$$

Similarly the other 4 ways of putting last 2 digits divisible by 4 are:

$$\begin{align} \boxed{\quad3\quad|\quad2\quad|\color{violet}\quad\textbf{2}\quad|\quad\textbf{0}\quad} \\ \\ \boxed{\quad2\quad|\quad2\quad|\color{violet}\quad\textbf{2}\quad|\quad\textbf{4}\quad} \\ \\ \boxed{\quad2\quad|\quad2\quad|\color{violet}\quad\textbf{3}\quad|\quad\textbf{2}\quad} \\ \\ \boxed{\quad3\quad|\quad2\quad|\color{violet}\quad\textbf{4}\quad|\quad\textbf{0}\quad} \end{align}$$

The total number of ways \(= 6 + 4 + 6 + 4 + 4 + 6 = 30\)

Q5. How many 4 digit numbers can be formed using the digits 0, 1, 2, 3, 4 (without repetition) such that even places are occupied by even numbers and odd places are occupied by odd numbers.

Let’s take \(4\) vacant spaces. The first cell is odd and we have \(2\) odd digits. So we have \(2\) options. Similarly, for the second cell we have \(3\) options and so one. You get the idea. The number of ways are = \(2 \times 3 \times 1 \times 2 = 12\).

$$\boxed{\quad2\quad|\quad3\quad|\quad1\quad|\quad2\quad}$$

Q6. In a train 3 seats are vacant. In how many ways can 5 passengers sit?

Let's try to use the \(^n p_r\) formula, wherever we can. We know \(^n p_r\) tells us the number of ways we can arrange \(r\) objects out of \(n\) distinct objects. So, the answer is simply
\(^5 p_3 = \frac{5!}{(5 – 3)!} = 60\)

Q7. How many 4 letter words be created using the letters of the word MONKEY (words can be meaningless)?

$$^5 p_4 = \frac{5!}{(5 – 4)!} = 120$$

Q8. How many different words can be formed using all the letters of the word STICK?

$$^5 p_5 = \frac{5!}{(5 – 5)!} = 5! = 120$$

Q9. How many numbers of 5 digits can be formed from the numbers 2, 0, 5, 3, 7 (without repetition)?

There are \(5!\) ways of arranging all 5 digits. But the numbers where the digit starts with \( 0\) is not a \(5\) digit number. How many numbers are there which are not \(5\) digits? Suppose 0 is fixed at the first position. We have \(4\) other digits. How many ways we can arrange those \(4\) digits? \(4!\) right? Those 4! ways are the wrong arrangements of digits which start with 0. So the number of ways are

$$5! – 4! = (120 – 24) = 96$$

Non-distinct items

All the problems that we've tried to solve so far deals with distinct items. But what if the items in the set we can choose from are not distinct? Suppose we have digits \(1, 3\) and \(3\). How many \(3\) digit numbers can we form? We can form \(3\) numbers \(133\), \(331\), \(313\). But when we have \(3\) distinct digits, there are \(3! = 6\) ways.

Let’s take the number \(133\). Now when we swap same digits, it doesn’t change the number. For example, if we swap the \(3\) in the second position with the \(3\) in the last position, it remains the same. There are \(2!\) ways of arranging \(33\). To eliminate the cases that we have over-counted from our result, we do the opposite of multiplication. That is to divide \(3!\) by \(2!\). So, the numbers of ways are \(\frac{3!}{2!}\).

Q10. How many words can be created by rearranging the letters of the word DHAKA?

$$\frac {5!}{2!} = \frac{120}{2} = 60$$

Q11. How many words can be created by rearranging the letters of the word CHITTAGONG?

$$\frac {10!}{2! \times 2!} = \frac{3628800}{4} = 907200$$

Q12. You are in point A and you want to go to point B in shortest possible path, then how many shortest paths are possible?

$$\begin{array}{|c|c|c|c|c|c|} \hline \quad & \quad & \quad & \quad & \quad & B \\ \hline \quad & \quad & \quad & \quad & \quad & \quad \\ \hline \quad & \quad & \quad & \quad & \quad & \quad \\ \hline A & \quad & \quad & \quad & \quad & \quad \\ \hline \end{array}$$

To reach the point \(B\) we have to move \(5\) units to the right, and \(3\) units to the top. Any permutation of \(5\) units to the right and \(3\) units upward will give us the shortest path. Since we are not going down or left, this is the shortest path. So, we can represent it as a string, \(RRRRRUUU\). The number of ways to arrange the letters is the number of ways to reach \(B\) from \(A\). So, the answer is \(\frac{8!}{5! \times 3!}\).

That's it for today. Stay tuned for the next part, where we'll dive deeper into permutations, combinations, and more intricate scenarios. Don't forget to subscribe to my newsletter to stay updated with the latest articles and insights.

Did you find this article valuable?

Support Naimul Haque's Blog by becoming a sponsor. Any amount is appreciated!