Puzzle of the Pens: A Practical Guide to Solving Diophantine Equations

Puzzle of the Pens: A Practical Guide to Solving Diophantine Equations

Imagine a teacher who has a certain number of pens he wants to distribute among his class. The problem given says that when he divides the pens among 9 pupils, 7 pens remain. When he divides by 8 pupils, 4 pens remain, and when he divides by 3 pupils, 1 pen remains. The teachers want to find out how many pens he bought. Let's dive into the solution.

Setting Up the Equations

Let's denote the number of pens by n. The conditions can be expressed as follows:

n mod 9 7 n mod 8 4 n mod 3 1

The third condition does not add new information since it's implied by the first. Therefore, we are left with two conditions:

n mod 9 7

n mod 8 4

We can reframe the first equation to say that (i n 9a 7) for some integer a. Similarly, we know that (i n 8b 4) for some integer b. Our task is to find a and b that satisfy these two Diophantine equations.

Solving the Diophantine Equations

To solve the system of equations, we can rewrite the equations as:

9a - 7 8b - 4

9a - 8b -3

Reorganizing, we need to find a multiple of 8 that is 3 more than some multiple of 9. This can be expressed as:

8b - 9a -3

Or, more conveniently, in the form (120m - 108m 12m 3k). Simplifying, we get:

8b - 9a 3

This means we need to find a combination of a and b such that the difference between a multiple of 8 and a multiple of 9 is 3.

Using the Method of Differences

A systematic approach is to use the fact that 8 and 9 are relatively prime. This means there are integers (x) and (y) such that (8x - 9y 1). Multiplying through by 3, we get:

24x - 27y 3

This suggests that 8(3x) - 9(3y) 3. We can now use these values to solve for a and b. Starting with 8(10) - 9(13) 80 - 117 -37, we adjust by adding 9 and 8 to get the smallest positive solution:

8(15) - 9(13) 120 - 117 3

This means (b 15) and (a 13). Substituting these values back into the simplified equations, we get:

n 9a 7 9(13) 7 117 7 124

This matches with 8b - 4 8(15) - 4 120 - 4 124.

Therefore, the smallest possible number of pens the teacher bought was 124. Following this pattern, the next smallest number of pens is 124 72 (the least common multiple of 8 and 9), which is 196.

Conclusion

The problem involves finding a common solution to a set of congruences, which is a classic problem in number theory known as a Diophantine equation. By using the properties of relatively prime numbers and the method of differences, we can systematically find the solution. This approach not only solves the puzzle but also highlights the beauty and practicality of number theory in everyday situations.