Combinatorics
Counting Rules and Techniques
Combinatorics is a branch of mathematics concerning the study of finite or countable discrete structures.Learning Objectives
Describe the different rules and properties for combinatoricsKey Takeaways
Key Points
- The rule of sum (addition rule), rule of product (multiplication rule), and inclusion-exclusion principle are often used for enumerative purposes.
- Bijective proofs are utilized to demonstrate that two sets have the same number of elements.
- Double counting is a technique used to demonstrate that two expressions are equal. The pigeonhole principle often ascertains the existence of something or is used to determine the minimum or maximum number of something in a discrete context.
- Generating functions and recurrence relations are powerful tools that can be used to manipulate sequences, and can describe if not resolve many combinatorial situations.
- Double counting is a technique used to demonstrate that two expressions are equal.
Key Terms
- polynomial: An expression consisting of a sum of a finite number of terms: each term being the product of a constant coefficient and one or more variables raised to a non-negative integer power.
- combinatorics: A branch of mathematics that studies (usually finite) collections of objects that satisfy specified criteria.
Aspects of combinatorics include: counting the structures of a given kind and size, deciding when certain criteria can be met, and constructing and analyzing objects meeting the criteria. Aspects also include finding "largest," "smallest," or "optimal" objects, studying combinatorial structures arising in an algebraic context, or applying algebraic techniques to combinatorial problems.
Combinatorial Rules and Techniques
Several useful combinatorial rules or combinatorial principles are commonly recognized and used. Each of these principles is used for a specific purpose. The rule of sum (addition rule), rule of product (multiplication rule), and inclusion-exclusion principle are often used for enumerative purposes. Bijective proofs are utilized to demonstrate that two sets have the same number of elements. Double counting is a method of showing that two expressions are equal. The pigeonhole principle often ascertains the existence of something or is used to determine the minimum or maximum number of something in a discrete context. Generating functions and recurrence relations are powerful tools that can be used to manipulate sequences, and can describe if not resolve many combinatorial situations. Each of these techniques is described in greater detail below.Rule of Sum
The rule of sum is an intuitive principle stating that if there are possible ways to do something, and
possible ways to do another thing, and the two things can't both be done, then there are
total possible ways to do one of the things. More formally, the sum of the sizes of two disjoint sets is equal to the size of the union of these sets.
Rule of Product
The rule of product is another intuitive principle stating that if there are ways to do something and
ways to do another thing, then there are
ways to do both things.
Inclusion-Exclusion Principle
The inclusion-exclusion principle is a counting technique that is used to obtain the number of elements in a union of multiple sets. This counting method ensures that elements that are present in more than one set in the union are not counted more than once. It considers the size of each set and the size of the intersections of the sets. The smallest example is when there are two sets: the number of elements in the union of and
is equal to the sum of the number of elements in
and
, minus the number of elements in their intersection. See the diagram below for an example with three sets.
Bijective Proof
A bijective proof is a proof technique that finds a bijective function between two finite sets
and
, which proves that they have the same number of elements,
. A bijective function is one in which there is a one-to-one correspondence between the elements of two sets. In other words, each element in set
is paired with exactly one element in set
. This technique is useful if we wish to know the size of
, but can find no direct way of counting its elements. If
is more easily countable, establishing a bijection from
to
solves the problem.
Double Counting
Double counting is a combinatorial proof technique for showing that two expressions are equal. This is done by demonstrating that the two expressions are two different ways of counting the size of one set. In this technique, a finite set is described from two perspectives, leading to two distinct expressions for the size of the set. Since both expressions equal the size of the same set, they equal each other.
Pigeonhole Principle
The pigeonhole principle states that if items are each put into one of
boxes, where
, then at least one of the boxes contains more than one item. This principle allows one to demonstrate the existence of some element in a set with some specific properties. For example, consider a set of three gloves. In such a set, there must be either two left gloves or two right gloves (or three of left or right). This is an application of the pigeonhole principle that yields information about the properties of the gloves in the set.
Generating Function
Generating functions can be thought of as polynomials with infinitely many terms whose coefficients correspond to the terms of a sequence. The (ordinary) generating function of a sequence is given by:
whose coefficients give the sequence
.
Recurrence Relation
A recurrence relation defines each term of a sequence in terms of the preceding terms. In other words, once one or more initial terms are given, each of the following terms of the sequence is a function of the preceding terms.The Fibonacci sequence is one example of a recurrence relation. Each term of the Fibonacci sequence is given by
, with initial values
and
. Thus, the sequence of Fibonacci numbers begins:
Permutations
A permutation of a set of objects is an arrangement of those objects in a particular order; the number of permutations can be counted.Learning Objectives
Calculate the number of arrangements of ordered objects using permutationsKey Takeaways
Key Points
- Informally, a permutation of a set of objects is an arrangement of those objects into a particular order. For example, there are six permutations of the set , namely,,,,, and.
- The number of permutations of distinct objects is. This is calledfactorial, and written.
- When deciding permutations of a subset from a larger set, it is often useful to divide one factorial by another to determine the number of permutations possible. For example, the first six cards from a deck of cards would have permutations possible, or about 14.7 billion.
Key Terms
- factorial: The result of multiplying a given number of consecutive integers from to the given number. In equations, it is symbolized by an exclamation mark (). For example,.
- permutation: An ordering of a finite set of distinct elements.
Permutations
A permutation of a set of objects is an arrangement of those objects into a particular order. For example, there are six permutations of the set:
,
,
,
,
, and
. One might define an anagram of a word as a permutation of its letters.
The number of permutations of
distinct objects is given by:
This is called
factorial and is written
.
In other words, a factorial is to multiply all the numbers from
up to this number. So
means
. Thus,
is the number of permutations possible for a set of five distinct objects.
Example
In the game of Solitaire, seven cards are dealt out at the beginning: one face-up, and the other six face-down. A complete card deck has cards. Assuming that the only card that is seen is the
of spades, how many possible "hands" (the other six cards) can be underneath? What makes this a permutation problem is that the order matters: if an ace is hiding somewhere in those six cards, it makes a difference whether the ace is on the first position, the second, etc. Permutation problems can always be addressed as an example of the multiplication rule, with one small twist.

How many cards might be in the first position, directly under the showing
? The answer is 51. That card can be anything except the
of spades.
If any given card is in the first position, how many cards might be in second position? The answer is
. The seven of spades and the next card have both been dealt. So there are possible cards left for the second position.
So how many possibilities are there for the first two positions combined? The answer is
.
How many possibilities are there for all six positions? The answer is
, or approximately
; about
billion possibilities!
This result can be expressed more concisely by using factorials.
Note that
can also be written as
. Most of the terms cancel, leaving only
.
Consider another example,
. If all of the terms are written out, the first
terms cancel, leaving
in the numerator. Instead of typing into a calculator six numbers to multiply, or sixty numbers or six hundred depending on the problem, the answer to a permutation problem can be found by dividing two factorials. In many calculators, the factorial option is located under the "probability" menu for this reason.
General Considerations
In mathematics, the notion of permutation is used with several slightly different meanings, all related to the act of permuting (rearranging) objects or values. Informally, a permutation of a set of objects is anarrangement of those objects into a particular order. The study of permutations generally belongs to the field of combinatorics.
Permutations occur, in more or less prominent ways, in almost every domain of mathematics. They often arise when different orderings on certain finite sets are considered, possibly only because one wants to ignore such orderings and needs to know how many configurations are thus identified. For similar reasons, permutations arise in the study of sorting algorithms in computer science.
Permutations of Distinguishable Objects
The number of permutations of distinct elements can be calculated when not all elements from a given set are used.Learning Objectives
Calculate the number of permutations of objects taken
at a time
Key Takeaways
Key Points
- If all objects in consideration are distinct, they can be arranged in permutations, whererepresents the number of objects.
- If not all the objects in a set of unique elements are chosen, the above formula can be modified to:, whererepresents the number of selected elements.
- When solving for quotients of factorials, the terms of the denominator can cancel with the terms of the numerator, thus eliminating perhaps the majority of terms to be multiplied.
Key Terms
- factorial: The result of multiplying a given number of consecutive integers from to the given number. In equations, it is symbolized by an exclamation mark (). For example,.
- permutation: An ordering of a finite set of distinct elements.
possible permutations, where
represents the number of objects. The quantity
is given by:
It is easy enough to use this formula to count the number of possible permutations of a set of distinct objects; for example, the number of permutations of three differently-colored balls. However, consider a situation where not all of the elements in a set of distinct objects are used in each permutation. For example, what if
cards are chosen from among a full deck of
? In this case, not all of the cards from the deck are chosen for each possible permutation. There exists a formula for solving permutation problems such as this one, which would otherwise be nearly impossible to determine.
Permutations of a Partial Set
If not all of the objects in a set of unique elements are chosen, the following formula is used. This formula determines the number of possible permutations of elements selected from the set of
elements:
To understand the application of this concept, consider a race in which
different prizes are awarded to the top
fastest competitors. If
competitors participate in the race, in how many distinct orders could the
prizes be awarded?
To solve this problem, we want to evaluate the number of possible permutations of
elements from the set of
elements; in other words,
and
. Plugging these values into the formula, we have:
Remember that both
and
contain the terms
. Thus, these values cancel from the numerator and denominator, and the equation can be simplified:
There are
possible permutations in which the
top prizes may be awarded to the
race competitors.
General Considerations
It is worth noting that this formula does not exclude what we might call 'duplicate' permutations. In other words, the order of the elements selected does matter. Consider cards drawn from a pack: an ace of spades, a
of diamonds, and a
of clubs. The hand is exactly the same as the following: a
of diamonds, an ace of spaces and a
of clubs. If you are playing a game in which the order of your cards does not matter, you will only want to count each permutation of cards once. The formula introduced here does not apply to such situations.
Permutations of Nondistinguishable Objects
The expression revealing the number of permutations of distinct items can be modified if not all items in the set are distinct.Learning Objectives
Calculate the number of permutations of a given set of objects, some being non distinguishableKey Takeaways
Key Points
- Some sets include repetitions of certain elements. In these cases, the number of possible permutations of the items cannot be expressed by , whererepresents the number of elements, because this calculation would include a multiplicity of possible states.
- To correct for the multiplicity of certain permutations, divide the factorial of the total number of elements by the product of the factorials of the number of each repeated element.
- The expression for number of permutations with repeated elements is: whereis the total number of terms in a sequence and,, andare the number of repetitions of different elements.
Key Terms
- multiplicity: The number of values for which a given condition holds.
- permutation: An ordering of a finite set of distinct elements.
distinct elements is given by
:
This can be easily tested. The number
can be arranged in just one
way. The numbers
and
can be arranged in two
ways:
and
. The numbers
,
, and
can be arranged in
ways:
,
,
,
,
, and
. This rule holds true for sets of any size, so long as the elements are all distinct. But what if some elements are repeated?
Repetition of some elements complicates the calculation of permutations, because it allows for there to be multiple ways in which a specific order of elements can be arranged. For example, given the numbers
,
, and
in a set, there are 2 ways to obtain the order
.
To correct for the "multiplicity" of certain permutations, we must divide the factorial of the total number of elements by the product of the factorials of the number of each repeated element. This can generally be represented as:
Where
is the total number of terms in a sequence, and
,
, and
represent the number of repetitions of different elements.
To understand why we would divide by the number of repetitions, consider that
elements can be arranged in a total of
distinct ways,
elements can be arranged in a total of
distinct ways, and so on. When we encounter multiplicity in a permutation, we must account for it by dividing these possible arrangements out of the total number of permutations that would be possible if all of the elements were distinct.
Example: Consider the set of numbers:
There are five terms, so
. However, two of the terms are the same; their value is
. Thus, the number of possible distinct permutations in the set is:
The same logic can apply to more complicated systems.
Example: Consider the set:
In total, there are
elements. These include many repetitions:
is seen 3 times,
and
each are observed twice, and there are
instances of the number
. Thus, the number of possible distinct permutations can be calculated by:
This logic can be applied to problems involving anagrams of given words.
Example: Consider how many distinct ways you can order the letters of the word "waterfall."
The word waterfall consists of letters in total, so
. The letter "a" appears twice, giving a value of
for
. Similarly, the letter "l" appears twice, yielding
. Thus, the number of distinct permutations for the letters in "waterfall" can be calculated as:
Combinations
A combination is a way of selecting several things out of a larger group, where (unlike permutations) order does not matter.Learning Objectives
Calculate the number of ways of selecting several things out of a larger group (where order doesn't matter) using combinationsKey Takeaways
Key Points
- A combination is a mathematical concept where one counts the number of ways one can select several elements out of a larger group.
- Unlike a permutation, when determining the number of combinations, order does not matter.
- Formally, a -combination of a setis a subset ofdistinct elements of. If the set haselements the number of-combinations is equal to the binomial coefficient:, which can be written using factorials aswheneverand which is zero when.
Key Terms
- combination: A way of selecting elements from a set, where order does not matter.
- binomial coefficient: A coefficient of any of the terms in the expansion of the binomial power .
pieces of fruit: an apple, an orange and a pear. There are
combinations of
that can be drawn from this set: an apple and a pear, an apple and an orange, or a pear and an orange.
Combinations can refer to the combination of
things taken
at a time with or without repetition. In the above example, repetition was not allowed. If, however, it was possible to have
of any
kind of fruit there would be
more combinations:
apples,
oranges, and
pears.
To understand the difference between a permutation and combination, consider a deck of
cards, from which a poker hand (
cards) is dealt. How many possible poker hands are there?
At first glance, this may seem like a permutation question, where one might consider how many distinct ways there are to make a stack of cards. However, there is one important difference: order does not matter in this problem. When dealt a poker hand during a game, order does not matter so you will have the same hand regardless of the order in which the cards are dealt. Combination problems involve such scenarios.
To approach such a question, begin with the permutations: how many possible poker hands are there, if order does matter?
Recall the permutation formula:
, where
is the number of distinct objects in the set, and
is the number of objects selected. In this case, we can calculate the number of permutations as:
This yields approximately
million possible poker hands. However, one has to count every possible hand many different times in this calculation. How many different times is one counting each distinct hand?
The key insight is that this second question—"How many different times is one counting each distinct hand?" is itself a permutation question. It is the same as the question "How many different ways can these five cards be rearranged in a hand?" There are
possibilities for the first card,
for the second, and so on. The answer is
, which is
. So, since every possible hand has been counted
times, divide our earlier result by
to find that there are
, or about
million possible poker hands.
Combinations turn out to have a surprisingly large number of applications. Consider the following questions:
- A school offers classes. Each student must chooseof them to fill out a schedule. How many possible schedules can be made?
- A basketball team has players, but onlywill start. How many possible starting teams can they field?
- Your computer contains videos, but you can only fitof them on your phone. How many possible ways can you load your phone?
Each of these is a combinations question, and can be answered exactly like the card scenario. Since this type of question comes up in so many different contexts, it is given a special name and symbol. The last question would be referred to as "
choose
" and written
. It is calculated as
, for reasons explained above.
Each possible combination of
distinct elements of a set
is known as a
-combination. If the set has
elements, the number of
-combinations is equal to
Which can be written using factorials as
Whenever
, and which is zero when
. The set of all
-combinations of a set
is often denoted by
, which is read as "
choose
," such as in the phone example above. The set of
-combinations may also be denoted in certain texts by
, or by a variation such as
,
, or
.
General Considerations
The number of-combinations, or
, is also known as the binomial coefficient, because it occurs as a coefficient in the binomial formula. The binomial coefficient is the coefficient of the
term in the polynomial expansion of
.
Licenses and Attributions
More Study Resources for You
Show More