Casework

In combinatorics, casework is a counting method that involves splitting a problem into several parts, counting these parts individually, then adding together the totals of each part. Casework is a very general problem-solving approach, and as such has wide applicability.

Examples

Here are some examples that demonstrate casework in action. Unlike the selections in this article, most problems cannot be completely solved through casework. However, it is crucial as an intermediate step across all of mathematics, not just in competitions.

While there are problems where casework produces the most elegant solution, in those where a shorter answer exists, casework may be considered brute force. This is especially true if that alternative solution uses complementary counting.

Example 1

How many words are less than four letters long and contain only the letters A, B, C, D, and E? Here, 'word' refers to any string of letters.

Solution: We divide the problem into cases, based on how long the word is.

Case 1: The word is one letter long. Clearly, there are $5$ of these words.

Case 2: The word is two letters long. Constructing the set of these words, there are $5$ options for the first letter and $5$ options for the second letter, so there are $5^2 = 25$ of these words.

Case 3: The word is three letters long. By similar logic as above, we have $5$ options for the first letter, $5$ options for the second, and $5$ options for the third. Then there are $5^3 = 125$ of these letters.

Adding all our cases up, there are $5 + 25 + 125 = 155$ words that are less than four letters long and contain only the letters A, B, C, D, and E. $\square$

Example 2

How many positive integers satisfy the equation $x^4 + y < 70$?

Solution: We use casework, based on the value of x.

Case 1: $x=1$. Then this problem becomes $y<69$, so there are $68$ possible values for $y$, and thus $68$ solutions when $x$ is one.

Case 2: $x=2$. Then this problem becomes $y<54$, so there are $53$ possible values for $y$, and thus $53$ solutions when $x$ is two.

If $x=3$, the problem becomes $y<-11$. But the question mandates that $y$ is positive, so there are no solutions when $x \geq 3$. Thus, there are $68+53=121$ positive integer solutions to the equation. $\square$

Example 3

2004 AIME II Problem 4: How many positive integers less than 10,000 have at most two different digits?

Solution: Let $A$ and $B$ be the two digits of the number. Use casework, based on how many digits the number has.

Case 1: The number is one digit. All numbers in this category satisfy the given condition, so there are $9$ of these.

Case 2: The number is two-digit. Again, all numbers in this category have two different digits, so there are $90$ of these.

Case 3: The number is three-digit. The possible cases in this category are $AAA, AAB, ABA,$ and $BAA.$ Using a constructive approach, there are $9$ digits for what the first number can be, zero excluded to keep the number three-digit. The second digit can be $9$ digits, with zero included and the first digit's number removed. Then there are $9 + 3 \cdot 81 = 252$ of these numbers.

Case 4: The number is four-digit. The possible cases in this category are $AAAA, AAAB, AABA, ABAA, BAAA, AABB, ABAB,$ and $ABBA.$ Using the same logic as before, the first digit has $9$ options, as does the second. Then there are $9 + 7 \cdot 81 = 576$ of these numbers.

Thus, there are $9 + 90 + 252 + 495 = 927$ integers less than $10,000$ that have at most two different digits. $\square$

More examples

Resources

See also