5.1: Counting
- Page ID
- 4897
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\( \newcommand{\dsum}{\displaystyle\sum\limits} \)
\( \newcommand{\dint}{\displaystyle\int\limits} \)
\( \newcommand{\dlim}{\displaystyle\lim\limits} \)
\( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)
( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\id}{\mathrm{id}}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\kernel}{\mathrm{null}\,}\)
\( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\)
\( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\)
\( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)
\( \newcommand{\vectorA}[1]{\vec{#1}} % arrow\)
\( \newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow\)
\( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vectorC}[1]{\textbf{#1}} \)
\( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)
\( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)
\( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\(\newcommand{\longvect}{\overrightarrow}\)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\(\newcommand{\ket}[1]{\left| #1 \right>}\)
\(\newcommand{\bra}[1]{\left< #1 \right|}\)
\(\newcommand{\braket}[2]{\left< #1 \vphantom{#2} \right| \left. #2 \vphantom{#1} \right>}\)
\(\newcommand{\braopket}[3]{\left< #1 \vphantom{#2}\vphantom{#3} \right| #2 \vphantom{#1}\vphantom{#3} \left| #3 \vphantom{#1}\vphantom{#2} \right>}\)
\(\newcommand{\qmvec}[1]{\mathbf{\vec{#1}}}\)
\(\newcommand{\op}[1]{\hat{\mathbf{#1}}}\)
\(\newcommand{\expect}[1]{\langle #1 \rangle}\)
\(\newcommand{\dfn}[1]{\emph{\textbf{#1}}}\)
Most of us think that counting is as easy as 1, 2, 3... When counting objects, one needs to be careful to not count an object more than once or miss an object. In this section, we will explore some ideas behind counting.
The Multiplication Principle
Suppose a task consists of two steps. If there are \(m\) ways to complete the first step and, for every choice made in the first step, exactly \(n\) ways to complete the second step, then the total number of outcomes is
\(
\boxed{m\times n.}
\)
For a task with \(k\) steps having \(n_1,n_2,\ldots,n_k\) choices at successive steps (with each count valid for every earlier sequence of choices), the total is
\(
\boxed{n_1n_2\cdots n_k.}
\)
Example \(\PageIndex{1}\):
Suppose pizza can be ordered in 3 sizes, 2 crust choices, 4 topping choices, and 2 cheese choices. How many different ways can a pizza be ordered? (Exactly one option from each of four categories, and every combination is allowed.)
Solution
To determine the number of possibilities, we will use the multiplication principle. Let \(S = \) pizza size, \(C =\) crust choice, \(T =\) topping choice, and \(Ch =\) cheese choice.
Assume one option must be chosen from each category, with no restrictions across categories. There are three sizes, two crusts, four topping options, and two cheese options. Hence
\[\begin{align} \text{Ways} &= (S)(C)(T)(Ch) \nonumber \\[5pt] &= (3)(2)(4)(2) \nonumber \\[5pt] &= 48 \nonumber\end{align} \nonumber\]
What if there was only one choice for cheese? How would this affect the calculation? If only one cheese option were available, the count would be \(3\times2\times4\times1=24\).
Example \(\PageIndex{2}\):
Count the number of possible outcomes when:
- A coin is tossed four times.
- A standard die is rolled five times.
- Answer
-
Four tosses of a coin create \(2^4=16\) ordered sequences of heads and tails. Five rolls of a six-sided die create \(6^5=7776\) ordered sequences. The order of outcomes is recorded, even when the same face appears more than once.
Permutations and factorials
Definition: Permutation
an arrangement in which order matters. For a nonnegative integer \(n\), define
\(
n!=\begin{cases}1,&n=0,\\ n(n-1)\cdots2\cdot1,&n\ge1.\end{cases}
\)
The number of ways to arrange all \(n\) distinct objects is \(n!\). The number of ordered selections of \(r\) distinct objects from \(n\) objects, without repetition, is
\(
\boxed{P(n,r)=\frac{n!}{(n-r)!}}, \qquad 0\le r\le n.
\)
Example \(\PageIndex{3}\)
Miss James wants to seat 30 of her students in a row for a class picture. How many different seating arrangements are there? 17 of Miss James' students are girls, and 13 are boys. In how many different ways can she seat 17 girls together on the left and 13 boys together on the right?
Solution
Thirty distinct students can sit in a single row in \(30!\) orders. To place all 17 girls first and all 13 boys afterward, permute each group independently:
Let's start with the girls. There are 17 of them, and so, when seating the first girl in the row, there are 17 choices. The next spot has 16 choices, then 15, and so on. Thus, there are \(17!\) ways to seat the girls.
By the same reasoning, there are \(13!\) ways to seat the boys on the right.
Now let's apply the multiplication principle: we need to seat the girls and the boys simultaneously. For each permutation of the girls, we consider each case for the boys as a distinct possibility. So, our result is \((17!)(13!)\). This means there are \(2.215 \cdot 10^{24}\) different ways to seat these students with girls on the left and boys on the right!
Example \(\PageIndex{4}\):
Using the digits \(1, 3, 5, 7,\) and \(9,\) with no repetitions of digits, how many three–digit numbers can be made?
Solution
Using the digits \(1,3,5,7,9\) with no repetition, there are five choices for the hundreds digit, then four for the tens digit, and three for the ones digit:
\(
P({5},{3})=5\cdot4\cdot3=\boxed{60}.
\)
Combinations: selections without order
The following is defined already in 3.3 Finite Difference Calculus.
Combinations
A combination is a selection of distinct objects where order does not matter. The number of ways to choose \(r\) objects from \(n\) distinct objects is
\[
\boxed{\binom nr=_nC_r=\frac{n!}{r!(n-r)!}}, \qquad 0\le r\le n.
\]
Each unordered group of \(r\) objects corresponds to exactly \(r!\) ordered selections. Consequently,
\[
\binom nr=\frac{P(n,r)}{r!}.
\]
When reading this out loud, we say "n choose r." When we choose objects, like candies from a bag or clothes from a closet, the order doesn't matter.
Example \(\PageIndex{5}\):
Evaluate \(_6C_2\), and \(_4C_4\).
Solution
Let's try \(_6C_2\), or \(\displaystyle 6 \choose 2\):
\(_nC_r = \displaystyle \frac{6!}{(6-2)!2!}\)
\(_nC_r = \displaystyle \frac{6!}{(4)!2!}\)
\(_nC_r = \displaystyle \frac{(6)(5)(4)(3)(2)}{(4)(3)(2)(2)}\)
\(_nC_r = \displaystyle \frac{(6)(5)}{(2)}\)
\(_nC_r = \displaystyle \frac{30}{2}\)
\(_nC_r = 15\)
Now let's tackle \(\displaystyle 4 \choose 4\):
\(_nC_r = \displaystyle \frac{4!}{(4-4)!4!}\)
\(_nC_r = \displaystyle \frac{4!}{0!4!}\)
The result of \(0!\) is \(1\).
\(_nC_r = \displaystyle \frac{4!}{4!}\)
\(_nC_r = 1\)
This makes sense: there is only one way to choose four things from a group of four things. You choose all of them, and that is the only option.
Example \(\PageIndex{6}\):
How many \(5\)-member committees are possible if we are choosing members from a group of \(30\) people?
Let's see: we have 30 people to choose from, so \(n = 30\). We want to choose 5 members, so \(r = 5\). Lastly, we don't care about the order in which we choose, so we use \(_nC_r\):
\(\displaystyle 30 \choose 5\)\( = \displaystyle \frac{30!}{(30-5)!5!}\)
\(\displaystyle 30 \choose 5\)\( = \displaystyle \frac{30!}{25!5!}\)
\(\displaystyle 30 \choose 5\)\( = \displaystyle \frac{(30)(29)(28)(27)(26)}{5!}\)
\(\displaystyle 30 \choose 5\)\( = \displaystyle \frac{(30)(29)(28)(27)(26)}{120}\)
\(\displaystyle 30 \choose 5\)\( = 142 506\)
Example \(\PageIndex{7}\):
- In how many ways can 3 men and 3 women sit in a row so that no two men and no two women are next to each other?
- In how many ways can 3 men and 3 women sit in a circle, if no two men and no two women are next to each other?
- Answer
-
Assume all six people are distinct. To seat three men and three women in a straight row so that adjacent people have different genders, there are two patterns, \(MWMWMW\) and \(WMWMWM\). Therefore,
\(
\boxed{N_{\mathrm{row}}=2(3!)(3!)=72.}
\)
In a circle, suppose rotations count as the same seating, but mirror images count as different. First seat the three men around the circle in \((3-1)!=2\) arrangements. There are then three gaps, one for each woman, which can be filled in \(3!=6\) ways. Thus,
\(
\boxed{N_{\mathrm{circle}}=(3-1)!\,3!=12.}
\)
If reflections are also considered identical, the circular count becomes \(6\).
Pascal's Triangle
Blaise Pascal studied and publicized the arithmetic triangle in the seventeenth century; related arrangements were known earlier in other mathematical traditions. Pascal's triangle begins with row \(0\). Every row starts and ends with \(1\). An interior entry is the sum of the two entries immediately above it:
\[
\binom nr=\binom{n-1}{r-1}+\binom{n-1}{r},
\quad 1\le r\le n-1;
\qquad \binom n0=\binom nn=1.
\]
The triangle is useful when calculating \(_nC_r\) as well: count down \(n\) rows, and then count in \(r\) terms. For example: \(_7C_2\) means that we look at row 7, term 2: 6.
-
Gives the coefficients of \( (a + b)^n.\)
-
The entries of the nth row are \(C(n,0), C(n,1)...C(n,n)\).
-
The sums of each row are consecutive powers of 2.
-
The third element from each row yields triangular numbers.

The entry in row \(7\) at position \(2\) is \(\boxed{\binom72=21}\). Entries in row \(n\) are \(\binom n0,\binom n1,\ldots,\binom nn\). Their sum is \(2^n\).
Binomial Expansion
For every nonnegative integer \(n\),
\[
\boxed{(x+y)^n=\sum_{k=0}^{n}\binom nk x^{n-k}y^k.}
\]
The general term in the sum is \(\binom nk x^{n-k}y^k\). For example, row \(3\) of Pascal's triangle is \(1,3,3,1\), so
\[
(x+y)^3=x^3+3x^2y+3xy^2+y^3.
\]
In the expansion of \((x+y)^n\), each term comes from choosing either \(x\) or \(y\) from each of the \(n\) factors. A term \(x^{n-k}y^k\) arises precisely when \(k\) of those factors contribute \(y\). There are \(\binom nk\) ways to make that selection.


