Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 11

Proving Subset Sum/Difference Properties with PHP

Recommended resources

Hello! In our last two lessons, we explored the Pigeonhole Principle, starting with the basic idea and then moving to the more powerful Generalized Pigeonhole Principle. You've seen how to guarantee that a certain number of "pigeons" must share a "pigeonhole."

Today, we will connect this new combinatorial tool with an area you are already comfortable with: number theory. You'll learn how to deploy the Pigeonhole Principle to solve problems involving divisibility, sums, and differences of integers. The key insight will be to use the possible remainders of a division as our pigeonholes. This elegant technique is a cornerstone of many Olympiad-level number theory problems.

Remainders as Pigeonholes

A vast number of problems in number theory revolve around divisibility by some integer . When you see such a problem, it should immediately trigger the thought: "What are the possible remainders when a number is divided by ?" These remainders are . There are exactly of them, which makes them perfect candidates for our pigeonholes.

Let's formalize this. Given any integer , the division algorithm guarantees that we can write , where is the remainder and . This remainder is unique. In modular arithmetic notation, we write .

The core strategy is simple:

  • Pigeons: The set of integers you are analyzing.
  • Pigeonholes: The possible remainders modulo .

If you have at least integers (pigeons) and you consider their remainders upon division by (the holes), the Pigeonhole Principle guarantees that at least two of the integers must have the same remainder. This simple fact has profound consequences.

Let's watch a video that demonstrates this fundamental application.

Problem Solving | The Pigeonhole Principle

In this video, Michael Penn introduces this exact idea with a clear, foundational example.

Watch the first main example, which proves that among any n+1 integers, two must have a difference that is a multiple of n. Pay close attention to how he defines the pigeons (the remainders of the chosen integers) and the pigeonholes (the set of all possible remainders) in the segment from the problem statement to the conclusion of the proof.

As the video showed, if two numbers and have the same remainder modulo , then and . Subtracting them gives , which is precisely the definition of being a multiple of .


The Subset Sum Problem

We can extend this idea beyond just differences. A classic and slightly more advanced application involves proving the existence of a subset of numbers whose sum has a specific property. This requires a more clever choice of pigeons.

A famous result states: Given any set of integers, there exists a non-empty subset whose sum is divisible by .

To prove this, we can't just use the integers themselves as pigeons, because we only have of them for holes, which isn't enough to force a collision. Instead, we construct a special set of n pigeons: the partial sums.

Let the set be . Consider these sums:

  • ...

Now, we analyze the remainders of these sums when divided by . There are two possibilities:

  1. One of the sums is divisible by : If some sum has a remainder of 0 when divided by , we're done! The subset has a sum that is divisible by .

  2. None of the sums are divisible by : If no is divisible by , then their remainders must come from the set . We have sums (pigeons) but only possible remainders (pigeonholes). By the PHP, two sums, say and (with ), must have the same remainder modulo .
    As we saw before, this means their difference, , is divisible by .
    What is this difference?

    This is the sum of the elements in the subset , and this sum is divisible by .

In either case, we find a subset with the desired property. The following resource provides a concise written proof of this exact result.

[PDF] February-March 2011 Segment 4: Pigeonhole Principle

This document from AwesomeMath presents several Olympiad-style problems. The one we're interested in is a clear demonstration of the subset sum proof.

Please read Problem 5 and its solution. You'll find it on page 8 of the PDF. Focus on the two cases described in the solution: first, one sum is divisible by n, and second, two sums have the same remainder.

This technique of using partial sums is a powerful pattern for solving problems related to subset sums and divisibility.


Practice Problems

Now it's your turn to apply these number-theoretic PHP techniques. For each problem, carefully identify your pigeons and pigeonholes.

  1. Difference of Squares: Prove that among any 7 perfect squares, there exist two whose difference is divisible by 10.

    • Hint: What are the possible last digits of a perfect square (i.e., remainders modulo 10)? How many distinct possibilities are there? These are your pigeonholes.
  2. Summing to 102: Show that in any set of 27 different positive odd numbers, all less than 100, there is at least one pair whose sum is 102.

    • Hint: This is a "sum" problem, but not with partial sums. Instead, construct your pigeonholes by pairing up numbers that add to 102. For example, , , etc. How many such pairs are there? Are there any odd numbers left over that don't fit in a pair?
  3. The Repunit Problem: A "repunit" is a number consisting only of the digit 1 (e.g., 1, 11, 111). Prove that for any positive integer that is not divisible by 2 or 5, there is a multiple of that is a repunit.

    • Hint: This is a classic Olympiad problem. Consider the first repunits: . What are their remainders when divided by ? Apply the same logic as the subset sum problem. If two repunits and (with ) have the same remainder, what can you say about their difference, ? The fact that is not divisible by 2 or 5 is crucial.

You can find excellent worked solutions for problems very similar to #1 and #2 in the February-March 2011 Segment 4 PDF from AwesomeMath. Problem 2 in that document is almost identical to practice problem #1 here, and problem 8 covers the logic for #2. Problem 7 in the "Practice Problems" section of that same PDF is exactly practice problem #3. Try to solve them on your own first!


Conclusion

In this lesson, you've combined the Pigeonhole Principle with your knowledge of number theory to prove some non-obvious results. This is a significant step toward the kind of creative problem-solving required in math Olympiads.

Key Takeaways:

  • When a problem involves divisibility by , the possible remainders serve as natural pigeonholes.
  • To prove that a difference is divisible by , you can show that two numbers from a sufficiently large set must share the same remainder modulo .
  • To prove that a subset sum is divisible by , you can use the partial sums as your pigeons. Either one sum is divisible by , or two sums share the same remainder, leading to a sub-interval sum that is divisible by .
  • Sometimes, pigeonholes can be constructed by pairing elements that have a desired property (e.g., summing to a target value).

In our next lesson, we will tackle one of the most famous results proven with the Pigeonhole Principle: the Erdős-Szekeres theorem, which guarantees the existence of long monotonic subsequences within any sequence of numbers. This will be our final lesson on PHP before moving on to new principles.