Skip to content
Combinatorics · Chapter 3

Casework

Split a hard count into cases that don't overlap and miss nothing, then add them up: the casework habit, plus conditional probability.

You'll need
open on YouTube
3.10%

Casework

In this section you will be able to split a counting problem into cases that don't overlap and cover everything, then add.

Five different items go into 3 identical blue boxes and 6 identical green boxes, one item per box. Too messy to count in one go? Count it one case at a time.

Casework means picking one attribute to split on, like “how many blue boxes get an item”. Count each case, then add.

The sum is right only if the cases don’t overlap and miss nothing. Keep the number of cases small: the fewer you have, the fewer chances to slip.

Exploreplay first, formulas later

Items in blue boxes: counting fits (≤ 3 blue); no cases yet

Make a case:

Items in blue boxes: count the ways where fits (≤ 3 blue)Answer: ?

    ? + ? + …

    Pick a rule chip to make your first case.

    Counting fits (≤ 3 blue). Cases: no cases yet. Pick a rule chip to make your first case.

    Name it

    Concept 3.1.1 · Keep the Cases Few

    Many counting and probability problems can be solved by splitting them into several cases, counting each case, and adding.

    When doing casework, always try to minimize the number of cases you have to deal with.

    Remark 3.1.2

    For casework problems, pick one attribute to change and find the number of ways in each case. In Example 3.1 this was the number of blue boxes. Sometimes a case needs to be split again into subcases.

    Seatings of 4 ambassadors and 4 advisors: 3 leaf cases, 720 + 1152 + 648 = 2520 seatings

    ?
    • Case 1: all 4 ambassadors in a row
    • Case 2: 3 in a row, 1 apart
    • Case 3: two pairs of 2
    0 of 3 cases counted

    Seatings of 4 ambassadors and 4 advisors: 0 of 3 cases counted

    Example 3.7 splits on where the four ambassadors sit. Open the cases, then reveal them one at a time.

    Watch itpredict, then reveal

    Example 3.1

    Omega Learn

    There are 3 identical blue boxes, 6 identical green boxes, and 5 distinct items. Each of the items must be placed into either a green or blue box, and each box can contain a maximum of 1 item. Assuming all of the boxes are different, how many ways are there to do this?

    Case sorter (its total is revealed at the end of the example)

    Make a case:

    Items in blue boxes: count the ways where fits (≤ 3 blue)Answer: ?

      ? + ? + …

      Pick a rule chip to make your first case.

      Counting fits (≤ 3 blue). Cases: no cases yet. Pick a rule chip to make your first case.

      1. 1

        How can we divide this problem into cases? How many cases are there?

        Predict first:

      Example 3.2

      AMC 8

      A △\triangle or ◯\bigcirc is placed in each of the nine squares in a 3-by-3 grid. Shown below is a sample configuration with three △\triangles in a line. How many configurations will have three △\triangles in a line and three ◯\bigcircs in a line?

      1. 1

        Can the line of △\triangles and the line of ◯\bigcircs share a square?

        Predict first:
        Click a choice or type its letter (A–E).
      open on YouTube

      Example 3.3

      AIME

      A bug starts at a vertex of an equilateral triangle. On each move, it randomly selects one of the two vertices where it is not currently located, and crawls along a side of the triangle to that vertex. Given that the probability that the bug moves to its starting vertex on its tenth move is m/nm/n, where mm and nn are relatively prime positive integers, find m+nm + n.

      Case tree (its total is revealed at the end of the example)

      ?
      • cw − ccw = 0: 5 cw, 5 ccw
      • ?
      • ?
      • cw and ccw differ by 9
      0 of 6 cases counted

      Move orders that end at the start: 0 of 6 cases counted

      1. 1

        Say there are AA clockwise and BB counterclockwise moves. What must happen for the bug to be back at the start after 10 moves?

        Predict first:
        Click a choice or type its letter (A–E).

      Example 3.4

      AMC 12

      A fancy bed and breakfast inn has 5 rooms, each with a distinctive color-coded decor. One day 5 friends arrive to spend the night. There are no other guests that night. The friends can room in any combination they wish, but with no more than 2 friends per room. In how many ways can the innkeeper assign the guests to the rooms?

      1. 1

        Which attribute should we split on?

        Predict first:
        Click a choice or type its letter (A–E).
      open on YouTube

      Example 3.5

      AMC 10

      A farmer's rectangular field is partitioned into 2 by 2 grid of 4 rectangular sections. In each section the farmer will plant one crop: corn, wheat, soybeans, or potatoes. The farmer does not want to grow corn and wheat in any two sections that share a border, and the farmer does not want to grow soybeans and potatoes in any two sections that share a border. Given these restrictions, in how many ways can the farmer choose crops to plant in each of the four sections of the field?

      1. 1

        Which sections share a border?

        Predict first:
        Click a choice or type its letter (A–E).
      open on YouTube

      Example 3.6

      AMC 12

      Azar and Carl play a game of tic-tac-toe. Azar places an X in one of the boxes in a 3-by-3 array of boxes, then Carl places an O in one of the remaining boxes. After that, Azar places an X in one of the remaining boxes, and so on until all boxes are filled or one of the players has three of their symbols in a row—horizontal, vertical, or diagonal—whichever comes first, in which case that player wins the game. Suppose the players make their moves at random, rather than trying to follow a rational strategy, and that Carl wins the game when he places his third O. How many ways can the board look after the game is over?

      1. 1

        Carl's third O ends the game. How many X's are on the board then?

        Predict first:
      open on YouTube

      Example 3.7

      AIME

      Four ambassadors and one advisor for each of them are to be seated at a round table with 12 chairs numbered in order 1 to 12. Each ambassador must sit in an even-numbered chair. Each advisor must sit in a chair adjacent to his or her ambassador. There are NN ways for the 8 people to be seated at the table under these conditions. Find the remainder when NN is divided by 1000.

      Case 1: the 5 ways to seat the advisors when the ambassadors sit in four neighboring even chairs.
      1. 1

        Break into cases on where the ambassadors sit. Case 1: four neighboring even chairs. How many positions are there, turning the table?

        Predict first:

      Contest cornerreal contest problems

      Problem 3.3.2

      AMC 10

      Two tour guides are leading six tourists. The guides decide to split up. Each tourist must choose one of the guides, but with the stipulation that each guide must take at least one tourist. How many different groupings of guides and tourists are possible?

      Problem 3.3.4

      AMC 10

      How many rearrangements of abcdabcd are there in which no two adjacent letters are also adjacent letters in the alphabet? For example, no such rearrangements could include either abab or baba.

      Problem 3.3.5

      AMC 10

      Call a positive integer an uphill integer if every digit is strictly greater than the previous digit. For example, 13571357, 8989, and 55 are all uphill integers, but 3232, 12401240, and 466466 are not. How many uphill integers are divisible by 1515?

      Problem 3.3.7

      AMC 10

      Alice refuses to sit next to either Bob or Carla. Derek refuses to sit next to Eric. How many ways are there for the five of them to sit in a row of chairs under these conditions?

      Problem 3.3.10

      AMC 10

      Suzanne went to the bank and withdrew $800. The teller gave her this amount using $20 bills, $50 bills, and $100 bills, with at least one of each denomination. How many different collections of bills could Suzanne have received?

      Problem 3.3.11

      AMC 12

      How many three-digit numbers are composed of three distinct digits such that one digit is the average of the other two?

      Checkpoint for section 3.1

      Get 2 of 3 right to master this section. One try each, no hints.
      1

      There are 2 identical red boxes, 5 identical yellow boxes and 4 distinct items. Each item goes into its own box. How many ways are there to do this?

      2

      How many positive integers less than 100100 have digits that add up to 55?

      3

      You sort outcomes into cases and add the case counts. What must be true for the sum to be the right answer?

      Click a choice or type its letter (A–E).
      3.20%

      Conditional Probability

      In this section you will be able to find a probability when you already know that some event has happened.

      You roll two dice and a friend peeks: “At least one of them is a 6.” Now what is the chance that the sum is 7?

      Knowing something happened shrinks the sample space. Only the outcomes where it happened are still possible, so they become the new denominator.

      When the outcomes are not equally likely (re-rolls, tie-breaks), divide probabilities instead of counts.

      Exploreplay first, formulas later

      6 × 6 = 36 rolls; Sum is 7: 6/36 = 1/6

      Die 1 (6) × Die 2 (6) = 36 equally likely rolls

      123456123456234567345678456789567891067891011789101112Die 1 down the side, Die 2 across the top.
      636=16\frac{6}{36} = \frac{1}{6}

      Sum is 7: 6 of 36 rolls, probability 1/6

      Name it

      Concept 3.2.1 · Conditional Probability

      If a problem asks for the probability that an event AA happens given that another event BB has happened, only the outcomes in BB are still possible:

      P(A∣B)=number of ways A and B happennumber of ways B happens.P(A \mid B) = \frac{\text{number of ways } A \text{ and } B \text{ happen}}{\text{number of ways } B \text{ happens}}.

      When the outcomes are not equally likely, work with probabilities instead:

      P(A∣B)=P(A and B)P(B).P(A \mid B) = \frac{P(A \text{ and } B)}{P(B)}.

      Remark 3.2.2

      Casework problems are very easy to mess up, so be as careful as you can. A good habit: write down every case first, before you count any of them. That way you won't forget a case.

      Watch itpredict, then reveal

      Example 3.8

      What is the probability that the sum of two dice is 7 given that at least one of the dice rolled a 6?

      Sample-space grid (its total is revealed at the end of the example)

      Die 1 (6) × Die 2 (6) = 36 equally likely rolls

      123456123456234567345678456789567891067891011789101112Die 1 down the side, Die 2 across the top.
      Count the lit cells, then divide.

      Sum is 7: count the lit cells.

      1. 1

        How many ways are there for the sum to be 7 and at least one die to be a 6?

        Predict first:

      Example 3.9

      HMMT Modified

      Victor has a drawer with two red socks, two green socks, two blue socks, and 4 orange socks. He repeatedly draws two socks at a time from the drawer at random, and stops if the socks are of the same color. However, Victor is red-green colorblind, so he also stops if he sees a red and green sock. What is the probability that Victor stops with two socks of the same color? Assume Victor returns both socks to the drawer at each step.

      Case sorter (its total is revealed at the end of the example)

      Make a case:

      Two socks: count the pairs where matching pairAnswer: ?

        ? + ? + …

        Pick a rule chip to make your first case.

        Counting matching pair. Cases: no cases yet. Pick a rule chip to make your first case.

        1. 1

          Victor returns the socks after every draw. What do the draws where he keeps going change?

          Predict first:
          Click a choice or type its letter (A–E).

        Example 3.10

        AMC 10

        In a particular game, each of 4 players rolls a standard 6-sided die. The winner is the player who rolls the highest number. If there is a tie for the highest roll, those involved in the tie will roll again and this process will continue until one player wins. Hugo is one of the players in this game. What is the probability that Hugo's first roll was a 5, given that he won the game?

        Case tree (its total is revealed at the end of the example)

        ?
        • Nobody else rolls 5 or more
        • Ties with 1 player, wins the re-roll
        • Ties with 2 players, wins the re-roll
        • Ties with all 3, wins the re-roll
        0 of 4 cases counted

        Hugo rolls a 5 and wins: 0 of 4 cases counted

        1. 1

          Why not just count outcomes, like in Example 3.8?

        Contest cornerreal contest problems

        Problem 3.3.1

        AMC 10

        Coin A is flipped three times and coin B is flipped four times. What is the probability that the number of heads obtained from flipping the two fair coins is the same?

        Problem 3.3.3

        AMC 10

        Three fair six-sided dice are rolled. What is the probability that the values shown on two of the dice sum to the value shown on the remaining die?

        Problem 3.3.6

        AMC 10

        For a particular peculiar pair of dice, the probabilities of rolling 11, 22, 33, 44, 55, and 66, on each die are in the ratio 1:2:3:4:5:61 : 2 : 3 : 4 : 5 : 6. What is the probability of rolling a total of 77 on the two dice?

        Problem 3.3.13

        AIME

        The nine delegates to the Economic Cooperation Conference include 22 officials from Mexico, 33 officials from Canada, and 44 officials from the United States. During the opening session, three of the delegates fall asleep. Assuming that the three sleepers were determined randomly, the probability that exactly two of the sleepers are from the same country is mn\frac{m}{n}, where mm and nn are relatively prime positive integers. Find m+nm + n.

        Checkpoint for section 3.2

        Get 2 of 3 right to master this section. One try each, no hints.
        1

        Two fair coins are flipped. Given that at least one shows heads, what is the probability that both show heads?

        2

        A fair die is rolled. Given that the roll is even, what is the probability that it is greater than 33?

        3

        Two fair dice are rolled. Given that the sum is 88, what is the probability that at least one die shows a 66?

        3.3

        Practice Problems

        In this section you will be able to use casework, subcases and symmetry on contest problems.

        Time to mix it all up. Before you count anything, write down every case. Each problem has three hints if you get stuck.

        Want every problem from this chapter on one page? Open the problem set.

        Contest cornerreal contest problems

        Problem 3.3.8

        AMC 10

        Three young brother-sister pairs from different families need to take a trip in a van. These six children will occupy the second and third rows in the van, each of which has three seats. To avoid disruptions, siblings may not sit right next to each other in the same row, and no child may sit directly in front of his or her sibling. How many seating arrangements are possible for this trip?

        Problem 3.3.9

        AMC 10/12

        A digital display shows the current date as an 8-digit integer consisting of a 4-digit year, followed by a 2-digit month, followed by a 2-digit date within the month. For example, Arbor Day this year is displayed as 2023042820230428. For how many dates in 2023 does each digit appear an even number of times in the 8-digit display for that date?

        Problem 3.3.12

        AMC 10

        There are 1010 people standing equally spaced around a circle. Each person knows exactly 33 of the other 99 people: the 22 people standing next to her or him, as well as the person directly across the circle. How many ways are there for the 1010 people to split up into 55 pairs so that the members of each pair know each other?

        Problem 3.3.14

        AMC 10/12

        Arjun and Beth play a game in which they take turns removing one brick or two adjacent bricks from one "wall" among a set of several walls of bricks, with gaps possibly creating new walls. The walls are one brick tall. For example, a set of walls of sizes 44 and 22 can be changed into any of the following by one move: (3,2)(3, 2), (2,1,2)(2, 1, 2), (4)(4), (4,1)(4, 1), (2,2)(2, 2), or (1,1,2)(1, 1, 2).

        Arjun plays first, and the player who removes the last brick wins. For which starting configuration is there a strategy that guarantees a win for Beth?

        Click a choice or type its letter (A–E).

        Problem 3.3.15

        AMC 10

        Consider systems of three linear equations with unknowns xx, yy, and zz,

        a1x+b1y+c1z=0a2x+b2y+c2z=0a3x+b3y+c3z=0\begin{aligned} a_1 x + b_1 y + c_1 z &= 0 \\ a_2 x + b_2 y + c_2 z &= 0 \\ a_3 x + b_3 y + c_3 z &= 0 \end{aligned}

        where each of the coefficients is either 00 or 11 and the system has a solution other than x=y=z=0x = y = z = 0. For example, one such system is {1x+1y+0z=0, 0x+1y+1z=0, 0x+0y+0z=0}\{1x + 1y + 0z = 0,\ 0x + 1y + 1z = 0,\ 0x + 0y + 0z = 0\} with a nonzero solution of {x,y,z}={1,−1,1}\{x, y, z\} = \{1, -1, 1\}. How many such systems are there? (The equations in a system need not be distinct, and two systems containing the same equations in a different order are considered different.)

        Problem 3.3.16

        AMC 12

        How many ordered triples (x,y,z)(x, y, z) of different positive integers less than or equal to 88 satisfy xy>zxy > z, xz>yxz > y, and yz>xyz > x?

        Problem 3.3.17

        AMC 10/12

        Each of the 99 squares in a 3×33 \times 3 grid is to be colored red, blue, or yellow in such a way that each red square shares an edge with at least one blue square, each blue square shares an edge with at least one yellow square, and each yellow square shares an edge with at least one red square. Colorings that can be obtained from one another by rotations and/or reflections are considered the same. How many different colorings are possible?

        Problem 3.3.18

        AMC 10Challenge

        Let D(n)D(n) denote the number of ways of writing the positive integer nn as a product

        n=f1⋅f2⋯fk,n = f_1 \cdot f_2 \cdots f_k,

        where k≥1k \ge 1, the fif_i are integers strictly greater than 11, and the order in which the factors are listed matters (that is, two representations that differ only in the order of the factors are counted as distinct). For example, the number 66 can be written as 66, 2⋅32 \cdot 3, and 3⋅23 \cdot 2, so D(6)=3D(6) = 3. What is D(96)D(96)?

        Problem 3.3.19

        AMC 10/12Challenge

        Each square in a 5×55 \times 5 grid is either filled or empty, and has up to eight adjacent neighboring squares, where neighboring squares share either a side or a corner. The grid is transformed by the following rules: Any filled square with two or three filled neighbors remains filled. Any empty square with exactly three filled neighbors becomes a filled square. All other squares remain empty or become empty. A sample transformation is shown in the figure below.

        Suppose the 5×55 \times 5 grid has a border of empty squares surrounding a 3×33 \times 3 subgrid. How many initial configurations will lead to a transformed grid consisting of a single filled square in the center after a single transformation? (Rotations and reflections of the same configuration are considered different.)

        Click a choice or type its letter (A–E).

        Problem 3.3.20

        AMC 12

        Let KK be the number of sequences A1A_1, A2A_2, …\ldots, AnA_n such that nn is a positive integer less than or equal to 1010, each AiA_i is a subset of {1,2,3,…,10}\{1, 2, 3, \ldots, 10\}, and Ai−1A_{i-1} is a subset of AiA_i for each ii between 22 and nn, inclusive. For example, {}\{\}, {5,7}\{5, 7\}, {2,5,7}\{2, 5, 7\}, {2,5,7}\{2, 5, 7\}, {2,5,6,7,9}\{2, 5, 6, 7, 9\} is one such sequence, with n=5n = 5. What is the remainder when KK is divided by 1010?

        Problem 3.3.21

        AMC 10/12

        Call a positive integer fair if no digit is used more than once, it has no 00s, and no digit is adjacent to two greater digits. For example, 196196, 2323 and 1246312463 are fair, but 15461546, 320320, and 3432134321 are not. How many fair positive integers are there?

        Problem 3.3.22

        AIME

        The vertices of a regular octagon are colored either red or blue with equal probability. The probability that the octagon can be rotated in such a way that all blue vertices end up at points that were originally red is mn\frac{m}{n}, where mm and nn are relatively prime positive integers. What is m+nm + n?

        Problem 3.3.23(additional)

        AIME

        Zou and Chou are practicing their 100100-meter sprints by running 66 races against each other. Zou wins the first race, and after that, the probability that one of them wins a race is 23\frac23 if they won the previous race but only 13\frac13 if they lost the previous race. The probability that Zou will win exactly 55 of the 66 races is mn\frac{m}{n}, where mm and nn are relatively prime positive integers. Find m+nm + n.

        Problem 3.3.24(additional)

        AIME

        How many different 4×44 \times 4 arrays whose entries are all 11's and −1-1's have the property that the sum of the entries in each row is 00 and the sum of the entries in each column is 00?

        Problem 3.3.25(additional)

        AMC 10

        This problem also appears in the book as 3.10.

        In a particular game, each of 44 players rolls a standard 66-sided die. The winner is the player who rolls the highest number. If there is a tie for the highest roll, those involved in the tie will roll again and this process will continue until one player wins. Hugo is one of the players in this game. What is the probability that Hugo's first roll was a 55, given that he won the game?

        Problem 3.3.26(additional)

        AMC 12

        Two different cubes of the same size are to be painted, with the color of each face being chosen independently and at random to be either black or white. What is the probability that after they are painted, the cubes can be rotated to be identical in appearance?

        Problem 3.3.27(additional)

        AMC 10

        Each of the 1212 edges of a cube is labeled 00 or 11. Two labelings are considered different even if one can be obtained from the other by a sequence of one or more rotations and/or reflections. For how many such labelings is the sum of the labels on the edges of each of the 66 faces of the cube equal to 22?

        Problem 3.3.28(additional)

        AMC 10/12Challenge

        A cube is constructed from 44 white unit cubes and 44 blue unit cubes. How many different ways are there to construct the 2×2×22 \times 2 \times 2 cube using these smaller cubes? (Two constructions are considered the same if one can be rotated to match the other.)

        Problem 3.3.29(additional)

        AMC 10Challenge

        Jason rolls three fair standard six-sided dice. Then he looks at the rolls and chooses a subset of the dice (possibly empty, possibly all three dice) to reroll. After rerolling, he wins if and only if the sum of the numbers face up on the three dice is exactly 77. Jason always plays to optimize his chances of winning. What is the probability that he chooses to reroll exactly two of the dice?

        Problem 3.3.30(additional)

        AIMEChallenge

        The wheel shown below consists of two circles and five spokes, with a label at each point where a spoke meets a circle. A bug walks along the wheel, starting at point AA. At every step of the process, the bug walks from one labeled point to an adjacent labeled point. Along the inner circle the bug only walks in a counterclockwise direction, and along the outer circle the bug only walks in a clockwise direction. For example, the bug could travel along the path AJABCHCHIJAAJABCHCHIJA, which has 1010 steps. Let nn be the number of paths with 1515 steps that begin and end at point AA. Find the remainder when nn is divided by 10001000.