Lesson Explainer: Counting With Repetition Where Order Does Not Matter | Nagwa Lesson Explainer: Counting With Repetition Where Order Does Not Matter | Nagwa

Lesson Explainer: Counting With Repetition Where Order Does Not Matter Mathematics

In this explainer, we will learn how to use combinations to count with repetition where order does not matter.

There is a number of key considerations when we are seeking to count the number of possible outcomes. The first is the concept of counting with, or without, repetition. If we are forming a 4-digit number from the digits 1–9, the question of repetition is whether or not we can use the same digit multiple times. Hence, if we allow repetition, we can choose a number like 1β€Žβ€‰β€Ž111. However, if we do not allow repetition, each digit will be distinct.

The second important consideration is whether order matters or not. For example, when picking 4-digit numbers, we consider 1234 to be different form 4321. However, order is not always important. For instance, we might want to know the number of ways we can choose four sandwiches from a sandwich shop. Here, order does not matter, since choosing the cheese then choosing the chicken is the same as choosing the chicken then choosing the cheese. In both cases, we have two sandwiches, one cheese and one chicken. Assuming there is no shortage of different sandwiches, this is an example of counting with repetition where order does not matter. In this explainer, we will learn how to count the number of possible outcomes in problems like this.

Without RepetitionWith Repetition
Order MattersοŠοŽπ‘ƒ=π‘›π‘›βˆ’π‘Ÿπ‘›οŽ
Order Does Not Matter𝐢=π‘›π‘›βˆ’π‘Ÿπ‘Ÿ

Initially, problems of this type seem difficult to understand how to approach. However, restating the problem in a slightly different way leads to an understanding of how to address problems like this. We will begin by demonstrating how to think about problems of this type so that we can derive a general formula for solving them.

Example 1: Counting with Repetition Where Order Does Not Matter

Sally is buying an ice cream cone and is able to pick two scoops from four flavors: chocolate, banana, strawberry, and vanilla. How many different ways can she pick two scoops from the four flavors?

Answer

Firstly, we notice what type of counting problem we have. Since she can have two scoops of the same flavor, we are counting with replacement. Furthermore, order does not matter. To understand how to solve this problem, we will present a new way to restate the problem to help see how to solve it.

Imagine that the shop attendant starts by pointing at the first flavor and asks whether Sally would like that flavor. She can reply either β€œyes” or β€œnext flavor.” She will then go through this process until she gets to the end of the four flavors and has said β€œyes” twice and β€œnext flavor” three times.

Hence, if the flavors were ordered chocolate, banana, strawberry, vanilla, the choice of chocolate and banana would be represented: π‘Œπ‘π‘Œπ‘π‘, where π‘Œ represents her saying β€œyes” and 𝑁 represents her saying β€œnext flavor.” If Sally wanted two scoops of strawberry, this would be represented by π‘π‘π‘Œπ‘Œπ‘.

In this way, we can represent all possible choices of two scoops of ice cream from four flavors. Hence, our problem reduces how many ways we can arrange three 𝑁s and two π‘Œs. This is the same problem as choosing two objects to mark with a π‘Œ from a set of five where the order does not matter, since choosing the second element and then the fourth is the same as choosing the fourth and then the second. In this way, we have reduced the problem to one of choosing without repetition where order does not matterβ€”a problem we know how to solve. Hence, the number of possible ways that Sally can choose ice cream flavors is 𝐢=10.

The technique we used in the last example demonstrates that by restating the problem in a new way, we are able to reduce it to a problem we know how to solve. This is often a very useful skill in combinatorics problems. Often, changing the way we are thinking about a problem can help us restate it as a problem we already know how to solve. We will demonstrate how useful this can be in a number of the examples.

Returning to this specific example, the particular technique we usedβ€”to restate the problem in the form of a choice without repetition where order does not matterβ€”generalizes to all problems that involve repetition where order does not matter. A careful examination of the previous question will help us find the general formula for this.

We were looking to choose 2 things from 4. Therefore, we set 𝑛=4 and π‘Ÿ=2. We found that to reformulate the problem, we formed a sequence of three 𝑁s and two π‘Œs. Obviously, the two π‘Œs simply generalize to the number of choices π‘Ÿ, whereas, regarding the 𝑁s, we only had three 𝑁s. This is because we only had to say β€œnext” three times to have the possibility of choosing from any of the four flavors. Therefore, in a general problem, we would need π‘›βˆ’1𝑁s. In this way, we can transform a problem of choosing π‘Ÿ things with repetition from 𝑛 options where order does not matter to a problem of choosing π‘Ÿ things without repetition from a set of 𝑛+π‘Ÿβˆ’1 options where order does not matter. Hence, the number of possibilities is 𝐢.

Counting with Repetition Where Order Does Not Matter

The number of possible ways to choose π‘Ÿ things with repetition from a set of 𝑛 choices where order does not matter is given by 𝐢=𝑛+π‘Ÿβˆ’1π‘Ÿπ‘›βˆ’1.

Now that we know the general formula, we will be able to apply it to other problems of this type. However, whenever we approach a counting problem, we need to be careful to categorize it properly to ensure we use use the correct formula.

Example 2: Choosing Dishes from a Menu with Repetition

Three friends are in a tapas restaurant. They would like to order 6 dishes to share. There are 15 different options on the menu. Given that they can choose multiple dishes of the same type, how many different possible ways can they order 6 dishes to share?

Answer

Firstly, we notice what type of counting problem we have. Since they can choose multiple dishes of the same type, we are counting with replacement. Furthermore, the order of their choices does not matter. Therefore, we have a problem of choosing 6 items with replacement from a set of 15 options where order does not matter. Therefore, the number of possibilities will be given by 𝐢=𝐢=38760.

Example 3: Counting the Number of Integer Solutions

How many nonnegative integer solutions are there to the equation π‘₯+π‘₯+π‘₯+π‘₯+π‘₯=40οŠͺ?

Answer

At first glance, a problem like this seems difficult to solve. However, we would like to see if there is a way we can reformulate this problem into something we know how to solve.

We begin by thinking of the number 40 being represented by forty vertical bars, as shown below.

Then, the problem of finding five positive integers that sum to forty is the same as finding a partition of this set of bars into five different sets. We can think of this as adding four partition marks + to separate this set into five distinct groups, where the number of bars in each group represents the number. For example,

is interpreted as

which represents the sum 6+4+11+10+9. Similarly,

is interpreted as

which represents the sum 0+21+10+0+9. Using this formulation, all possible nonnegative integer solutions to this problem can be thought of as being equivalent to a representation of this type. Hence, the problem of counting the number of nonnegative integer solutions to the given equation is equivalent to the problem of arranging 40 bars | and four pluses +. We have, therefore, successfully reformulated the problem into a problem we know how to solve. The number of ways we can arrange 40 bars and four pluses is given by οŠͺοŠͺοŠͺοŠͺοŠͺοŠͺ𝐢=𝐢=135751.

At first glance, the previous example may not appear to be related to the idea of counting with repetition where order does not matter. However, by reformulating the problem, we found that these two problems are equivalent. An alternative way to reformulate this problem is choosing forty units from five boxes with replacement. Then, the number chosen from each box represents the integer π‘₯.

The next example will look at a similar problem with the added complexity of different constraints for the integers.

Example 4: Number of Solutions with Constraints

How many integer solutions are there for the equation π‘₯+π‘₯+π‘₯=30, given that π‘₯>βˆ’5, π‘₯β‰₯4, and π‘₯>3?

Answer

We would like to find a way to reformulate this problem into one we know how to solve. The easiest way to accomplish this is to find a way to normalize our variables so they can all take values between 0 and some constant π‘˜. This can be achieved by making substitutions. If we let π‘¦οŠ§ be defined by the equation π‘₯=π‘¦βˆ’4, the condition π‘₯>βˆ’5 is equivalent to 𝑦β‰₯0. Similarly, we can let π‘¦οŠ¨ and π‘¦οŠ© be defined by the equations π‘₯=𝑦+4 and π‘₯=𝑦+4. Then, the conditions, π‘₯β‰₯4 and π‘₯>3 are equivalent to 𝑦,𝑦β‰₯0. Substituting these definitions into the equation π‘₯+π‘₯+π‘₯=30 gives π‘¦βˆ’4+𝑦+4+𝑦+4=30.

This simplifies to finding the integer solutions to 𝑦+𝑦+𝑦=26, where 𝑦,𝑦,𝑦β‰₯0. In this way, we have successfully reformulated the problem into one we know how to solve. This is the problem of choosing 26 units from 3 boxes with replacement where order does not matter. Hence, the total number of integer solutions to π‘₯+π‘₯+π‘₯=30 given that π‘₯>βˆ’5, π‘₯β‰₯4, and π‘₯>3 is 𝐢=378.

As we have seen, one important skill in dealing with combinatorics questions is being able to reformulate problems into ones we have already solved. One specific aspect of this is being able to easily identify whether we are dealing with combinations or permutations and whether we are counting with or without replacement. In the last two examples, we will look at two combinatorics problems where the main skill is finding the best way to think about the problem.

Example 5: Using Different Techniques to Count

How many possible diagonals can be drawn in a regular 𝑛-gon?

Answer

We will look at two possible ways to think about and solve this problem. The first we will consider from first principles, then we will use a more combinatorial argument. We let the number of diagonals of an 𝑛-gon be denoted 𝐷.

If we consider a single vertex in the 𝑛-gon, there are π‘›βˆ’1 possible vertices that we can connect it to. However, we would like to discard two of these, since they are the edges of the 𝑛-gon and, therefore, not diagonals. Hence, the number of diagonals from a single vertex is π‘›βˆ’3. If we multiply by the number of vertices, we will have counted every diagonal twice, once for each end of the diagonal. Therefore, we should divide this number by two. Hence, the general formula for the total number of diagonals 𝐷 is 𝐷=𝑛(π‘›βˆ’3)2.

The alternative way to approach this problem is by considering the number of ways we can choose two vertices from a set of 𝑛. This corresponds to the number of line segments that connect 𝑛 points. Notice that this is an example of counting without replacement where order does not matter. Hence, we can find this using combinations, and the total number will be given by 𝐢. This, however, is not our final answer, because we have counted the edges of the polygon. Since we would only like the diagonals, we would like to subtract the edges of the polygon, which gives us a final answer of 𝐷=πΆβˆ’π‘›.

This is a different formula from the one we derived from the first principles. However, the two formulas are equivalent, as we will show. Using the definition of the combination 𝐢, we can rewrite 𝐷=πΆβˆ’π‘›οŠοŠοŠ¨ as 𝐷=π‘›π‘›βˆ’22βˆ’π‘›.

This simplifies to 𝐷=𝑛(π‘›βˆ’1)2βˆ’π‘›.

We can now express this as a single fraction as follows: 𝐷=𝑛(π‘›βˆ’1)βˆ’2𝑛2=𝑛(π‘›βˆ’3)2.

Example 6: Shuttle Bus Problem

Twenty passengers get on an airport shuttle. The shuttle route includes six hotels, and each passenger gets off the shuttle at his/her hotel. The driver records how many passengers leave the shuttle at each hotel. How many different possibilities exist?

Answer

We let the number of passengers who get off at each hotel be denoted by π‘₯. Since every passenger will get of the bus at one of the hotels, the sum of π‘₯ will be equal to the total number of people. Hence, π‘₯+π‘₯+π‘₯+π‘₯+π‘₯+π‘₯=20.οŠͺ

Hence, we have successfully restated the problem in terms of a problem we know how to solve: finding the number of positive integer solutions to this equation. The number of possibilities is given by 𝐢=53130.

As we have seen in the last couple of examples, a lot of the skill in combinatorics is finding the best way to think about a problem. Sometimes this is to help us formulate it into a problem we know now to solve or to find an appropriate way to count what we are interested in.

Key Points

  • When seeking to solve combinatorics problems, we often need to identify whether we are dealing with counting with or without replacement and whether or not order matters. Once we have done this, we can apply the appropriate formula summarized in the table below.
    Without RepetitionWith Repetition
    Order MattersοŠοŽπ‘ƒ=π‘›π‘›βˆ’π‘Ÿπ‘›οŽ
    Order Does Not Matter𝐢=π‘›π‘›βˆ’π‘Ÿπ‘ŸοŠοŠ°οŽοŠ±οŠ§οŽπΆ=𝑛+π‘Ÿβˆ’1π‘Ÿπ‘›βˆ’1
  • Much of the skill in combinatorics is mapping new problems to ones we have already solved or know how to solve. This is how we derive the general formula for counting with repetition where order does not matter. However, this is a useful skill to apply in general to mathematical problems and the problems that arise in other scientific disciplines.

Join Nagwa Classes

Attend live sessions on Nagwa Classes to boost your learning with guidance and advice from an expert teacher!

  • Interactive Sessions
  • Chat & Messaging
  • Realistic Exam Questions

Nagwa uses cookies to ensure you get the best experience on our website. Learn more about our Privacy Policy