Skip to main content
Mathematics LibreTexts

5.1: Introduction to Combinatorics

  • Page ID
    105833
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \( \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{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)

    Section 1: Introduction to Combinatorics

    Combinatorics is the science of counting but not the counting that you do in first grade but the type of counting that it takes to compute the size of a sample space or the number of outcomes that satisfy a certain condition.

    Consider the experiment of rolling a die with the well-known sample space

    \(\{1, 2, 3, 4, 5, 6\}\)

    and let \(A\) be an event in which the outcome is 6. To find the probability of \(A\) we divide the number of outcomes in the event by the size of the sample size, which is equal to 1 over 6.

    \(P(A)=\frac{|\{6\}|}{|\{1, 2, 3, 4, 5, 6\}|}=\frac{1}{6}\)

    Next, let’s consider the experiment of rolling two dice with the well-known sample space

    \(\{1:1, 1:2, 1:3, \cdots\}\)

    and let \(A\) be an event in which the outcome is a double 6s. To find the probability of \(A\) we divide the number of outcomes in the event by the size of the sample space, which is equal to 1 over 36.

    \(P(A)=\frac{|\{6:6\}|}{|\{1:1, 1:2, 1:3, \cdots\}|}=\frac{1}{36}\)

    Finally, consider the experiment of rolling three dice with the sample space the size of which we don’t know

    \(\{1:1:1, 1:1:2, \cdots\}\)

    and let \(A\) be an event in which the outcome is three 6s. To find the probability of \(A\) we divide the number of outcomes in the event by the size of the sample space, which is equal to 1 over a number that we don’t know this time.

    \(P(A)=\frac{|\{6:6:6\}|}{|\{1:1:1, 1:1:2, \cdots\}|}=\frac{1}{?}\)

    But can we figure it out? When there is only one die there are 6 outcomes in the sample space. When there are two dice there are 36 outcomes in the sample space. So how many outcomes are in the sample space when there are three dice. The pattern appears to be straight forward - the sample space size for rolling 1 die is 6 raised to the power 1, the sample space size for rolling 2 dice is 6 raised to the power 2, so the formula for the sample space size for rolling three dice is 6 raised to the power 3.

    Roll a die

    once

    twice

    thrice

    Sample Space

    6

    36

    216

    n

    1

    2

    3

    Pattern?

    \(6^1\)

    \(6^2\)

    \(6^3\)

    Therefore, the probability from the previous example is 1 over 216.

    Now we can roll a die four times and without knowing exactly the size of the sample space we can let \(A\) be the event in which there are 4 sixes, and the probability of \(A\) is the number of outcomes in \(A\) divided by the size of the sample space which we can speculate to be equal to 6 raised to the power 4, so the probability is very little.

    \(P(A)=\frac{|\{6:6:6:6\}|}{|\text{Sample Space}|}=\frac{1}{6^4}=0.00077=0.077%\)

    This is a small example of counting which we used to figure out the size of the sample space and compute the probability of an event. Next, we will take a more formal approach and introduce the topic of combinatorics.

    Section 2: The Basic Counting Principle

    Why exactly there are 8 simple outcomes when flipping a coin three times? And 216 when rolling a die three times? Next, we will learn the basic counting principle that allows us to compute these and many other quantities.

    Consider that you have the following menu with the following choices

    Soup

    Meat

    Side

    Dessert

    Lentils

    French Onion

    Clam Chowder

    Tomato

    Beef

    Pork

    Lamb

     

    Potatoes

    Veggies

    Rice

    Beans

    Pasta

    Carrot Cake

    Cheesecake

     

    4

    3

    5

    2

    And the numbers of choices are summarized in the bottom of the table.

    If a meal consisted of a meat and a side, how many possible meal combinations are there?

    \(3\cdot5=15\)

    If a dessert is added to the meal, how many possible meal combinations are there?

    \(15\cdot2=30\)

    If a soup is added to the meal, how many possible meal combinations are there?

    \(4\cdot30=120\)

    This result can be summarized as the basic counting principle that states that if \(r\) actions are to be performed in a definite order and that there are \(m_i\) possibilities for \(i\)-th action then there are \(m_1\cdot\dots\cdot m_r\) possibilities altogether for the \(r\) actions. This principle can be summarized in the following way. When there is a process that consists of \(r\) actions with the known number of choices for each action, then the total number of choices is the product of the number of choices at each step.

    Process

    Action 1

    Action 2

    \(\cdots\)

    Action r

    Number of choices

    \(m_1\)

    \(m_2\)

    \(\cdots\)

    \(m_r\)

    Total number of choices is

    \(m_1\cdot m_2\dots\cdot m_r\)

    Interactive Exercise \(\PageIndex{1}\)
    Example \(\PageIndex{2.1}\)

    If there are 2 different ways to get from point A to point B and then 3 different ways to get from point B to point C, and 7 different ways to get from point C to point D. How many different paths are there from point A to point D?

    Solution

    Travelling

    from A to B

    from B to C

    from C to D

    Number of choices

    2

    3

    7

    The number of paths from point A to point D is

    \(2 \cdot 3 \cdot 7 = 42\)

    Interactive Exercise \(\PageIndex{2}\)
    Interactive Exercise \(\PageIndex{3}\)
    Example \(\PageIndex{2.2}\)

    How many 3-letter words (meaningful or meaningless) one can create using the letters a-z?

    Solution

    It all depends on if the repetition is allowed or not.

    • if repetition is allowed then the process of creating a 3-letter word consists of picking 3 letters and since the repetition is allowed the number of choices for each letter is 26 and the total number of words is 17,576 by the basic counting principle.
    • if repetition is not allowed then the process of creating a 3-letter word still consists of picking 3 letters but since the repetition is NOT allowed the number of choices for each letter is decreasing by 1 with every step and the total number of words is 15,600 by the basic counting principle.
    Interactive Exercise \(\PageIndex{4}\)
    Interactive Exercise \(\PageIndex{5}\)
    Example \(\PageIndex{2.3}\)

    How many 3-digit numbers one can create using the 10 digits 0-9?

    Solution

    AGAIN, it all depends on if the repetition is allowed or not.

    • if repetition is allowed then the process of creating a 3-digit number consists of picking 3 digits and since the repetition is allowed the number of choices for each digits except the first one is 10 and the total number of numbers is 900 by the basic counting principle. Why the number of choices for the first digit is 9? Because in a 3-digit number the first digit cannot be 0!
    • if repetition is not allowed then the process of creating a 3-digit number still consists of picking 3 digits but since the repetition is NOT allowed the number of choices for all but the first digit is decreasing by 1 with every step and the total number of numbers is 648 by the basic counting principle.

    Are there enough license plates in California to cover all the registered vehicles?

    clipboard_e60aa7a358faff37a4ec4582ef7d589ad.png

    To find out, let’s do the following example.

    Example \(\PageIndex{2.4}\)

    How many possible license plate arrangements are in California(#LLL###)? (Note: Repetition is allowed.)

    Solution

    The process of creating a license plate consists of picking 7 symbols in order and the number of choices for each symbol is determined by whether it is a letter or a digit.

    License Plate

    Symbol 1

    Symbol 2

    Symbol 3

    Symbol 4

    Symbol 5

    Symbol 6

    Symbol 7

    # of choices

    10

    26

    26

    26

    10

    10

    10

    By the basic counting principle, the total number of license plates is

    \(10 \cdot 26 \cdot 26 \cdot 26 \cdot 10 \cdot 10 \cdot 10 = 175,760,000\)

    What will change if we require the symbols to be nonrepeating? In this case, the repetition is NOT allowed.

    Example \(\PageIndex{2.5}\)

    How many possible license plate arrangements are in California(#LLL###) with nonrepeating symbols? (Note: Repetition is not allowed.)

    Solution

    The process of creating a license plate still consists of picking 7 symbols in order and the number of choices for each symbol is determined by whether it is a letter or a digit. Since there are 26 letters and 10 digits and repetition is NOT allowed the number of choices at consecutive steps is one less than in the previous, and we get the following table:

    License Plate

    Symbol 1

    Symbol 2

    Symbol 3

    Symbol 4

    Symbol 5

    Symbol 6

    Symbol 7

    # of choices

    10

    26

    25

    24

    9

    8

    7

    By the basic counting principle, the total number of license plates is

    \(10 \cdot 26 \cdot 25 \cdot 24 \cdot 9 \cdot 8 \cdot 7 = 78,624,000\)

    What will change if we limit the number of available symbols?

    Example \(\PageIndex{2.6}\)

    How many possible license plate arrangements are in California(#LLL###) with only consonants and odd digits? (Note: Repetition is allowed.)

    Solution

    The process of creating a license plate still consists of picking 7 symbols in order and the number of choices for each symbol is determined by whether it is a consonant or an odd digit. Since there are 21 consonants and 5 odd digits and repetition is allowed, we get the following table:

    License Plate

    Symbol 1

    Symbol 2

    Symbol 3

    Symbol 4

    Symbol 5

    Symbol 6

    Symbol 7

    # of choices

    5

    21

    21

    21

    5

    5

    5

    By the basic counting principle, the total number of license plates is

    \(5 \cdot 21 \cdot 21 \cdot 21 \cdot 5 \cdot 5 \cdot 5 = 5,788,125\)

    And again, what will change if we require the symbols to be nonrepeating?

    Example \(\PageIndex{2.7}\)

    How many possible license plate arrangements are in California(#LLL###) with nonrepeating consonants and odd digits? (Note: Repetition is not allowed.)

    Solution

    The process of creating a license plate still consists of picking 7 symbols in order and the number of choices for each symbol is determined by whether it is a consonant or an odd digit. Since there are 21 consonants and 5 odd digits and repetition is NOT allowed the number of choices at consecutive steps is one less than in the previous, and we get the following table:

    License Plate

    Symbol 1

    Symbol 2

    Symbol 3

    Symbol 4

    Symbol 5

    Symbol 6

    Symbol 7

    # of choices

    5

    21

    20

    19

    4

    3

    2

    By the basic counting principle, the total number of license plates is

    \(5 \cdot 21 \cdot 20 \cdot 19 \cdot 4 \cdot 3 \cdot 2 = 957,600\)

    Interactive Exercise \(\PageIndex{6}\)

    The basic counting principle can tell us how many events are possible from a sample space of size \(n\). One may think of the process of creating an event as a sequence of \(n\) choices with 2 options each - whether to include or exclude each simple outcome. Therefore, the number of choices at each step is exactly two – to include or not include, and by the basic counting principle, there are \(2^n\) total choices to create an event. Thus, the number of events from a sample space of size \(n\) is \(2^n\)!

    Example \(\PageIndex{2.8}\)

    Now using the formula we can find how many events can be created from a sample space of size 6, size 10 or any other size?

    Solution
    • The number of events from a sample space of size 6 is \(2^6=64\).
    • The number of events from a sample space of size 10 is \(2^10=1,024\).
    Interactive Exercise \(\PageIndex{7}\)

    We used the basic counting principle to find the number of events that can be created from a sample space of size \(n\), next we will discuss how to use the basic counting principle to figure out the size of the sample space for certain experiments such as tossing a coin or a die multiple time. So let’s find out how to use the basic counting principle to find the number of simple outcomes are there when tossing a coin twice and thrice.

    • To create an outcome for tossing a coin twice we consider the outcomes for coin 1 and 2. And the number of choices for each coin toss is exactly 2. So the number of possible outcomes is 4 by the basic counting principle.
    • To create an outcome for tossing a coin thrice we consider the outcomes for coin 1, 2, and 3. And the number of choices for each coin toss is exactly 2. So the number of possible outcomes is 8 by the basic counting principle.

    Similarly, we can use the basic counting principle to find the number of simple outcomes are there when rolling a die twice and thrice.

    • To create an outcome for rolling a die twice we consider the outcomes for die 1 and 2. And the number of choices for each die roll is exactly 6. So the number of possible outcomes is 36 by the basic counting principle.
    • To create an outcome for rolling a die thrice we consider the outcomes for die 1, 2, and 3. And the number of choices for each die roll is exactly 6. So the number of possible outcomes is 6 cube by the basic counting principle.

    Earlier we were able to guess the same formula by observing the pattern, however this time we used the basic counting principle which is a more formal approach.


    5.1: Introduction to Combinatorics is shared under a not declared license and was authored, remixed, and/or curated by LibreTexts.

    • Was this article helpful?