Puzzle on pigeonhole principle

Matrix puzzle [Presentation] [Transcript]

Matrix puzzle description

matrix
A matrix with 5 columns and 3 rows

You’re given a matrix with 5 columns and 3 rows. Your task is to fill this matrix with integers from 0 to 9 (with repeatition), but under two conditions:

  1. Every row must add up to 20.
  2. Every column must add up to 10.

Sounds doable, right? Take a moment to think about it before reading further.

Solution

At first glance, you might try filling the grid experimentally or even write code to brute force possibilities. I claim that it is impossible to solve this possible. Let’s analyze the math to understand the reason.

This leads to a contradiction: A matrix cannot have its total sum equal to 60 and 50 at the same time.

Conclusion

For anyone who enjoys coding, this is more than just a puzzle. It’s a cautionary tale. Too often, we throw computation at a problem without pausing to think. But a few minutes of analysis can save hours of wasted effort.

Whether you’re solving puzzles or working on real-world projects, remember: mathematics often reveals the limits before the machine does.

Author

Anurag Gupta is an M.S. graduate in Electrical and Computer Engineering from Cornell University. He also holds an M.Tech degree in Systems and Control Engineering and a B.Tech degree in Electrical Engineering from the Indian Institute of Technology, Bombay.


Comment

* Required information
1000
Drag & drop images (max 3)
Captcha Image
Powered by Commentics

Past Comments

No comments yet. Be the first!

Similar content