9 Balls Weight Puzzle (Solved) 9 Balls Weight Puzzle (Solved)

This is my favorite weight puzzle which have been asked from me in many interviews over the past few years.

Puzzle

You have 9 balls identical in size and appearance. One of them is defective and weighs heavy than the others. You have a weighing scale with no measurements so you can just compare weight of balls against each other. How would you find the defective ball given only 2 chances to use the scale?

Solution

First of all we will give a number to each ball i.e. 1, 2, 3, 4, 5, 6, 7, 8, and 9

The trick to solve these kind of weight problem is to divide them in groups. We will divide these 8 balls in 3 groups:

Group Ball Numbers
group 1 1, 2, 3
group 2 4, 5, 6
group 3 7, 8, 9

Now we keep the group 3 aside and put group 1 balls on one side of scale and group 2 balls on another side of scale [1st chance] with three possible outcomes:-

1. Scale is balanced

That means each ball in group 1 and group 2 are identical in weight and defective one is from group 3 i.e. either 7 or 8 or 9.

Let’s keep number 9 aside and put balls 7 and 8 on each side of scale [2nd chance] with three possible outcomes:-

  1. If 7 and 8 balances, then 9 is defective one
  2. If 7 is heavy then it is defective one
  3. If 8 is heavy then it is defective one

2. group 1 is heavier then group 2

That means defective balls is from group 1 i.e. either 1 or 2 or 3.

Let’s keep number 3 aside and put balls 1 and 2 on each side of scale [2nd chance] with three possible outcomes:-

  1. If 1 and 2 balances, then 3 is defective one
  2. If 1 is heavy then it is defective one
  3. If 2 is heavy then it is defective one

3. group 2 is heavier then group 1

That means defective balls is from group 2 i.e. either 4 or 5 or 6.

Let’s keep number 6 aside and put balls 4 and 5 on each side of scale [2nd chance] with three possible outcomes:-

  1. If 4 and 5 balances, then 6 is defective one
  2. If 4 is heavy then it is defective one
  3. If 5 is heavy then it is defective one

Conclusion

That’s it mates. We have found the defective balls out of 9 balls in only 2 weighing.

If by now you understood the trick of dividing balls in group and keeping some balls aside then you can solve weight puzzle with any number of balls. Here is the cheat sheet:-

Cheat Sheet
N Balls Weight Puzzle Groups Min Weighing (Best Case) Min Weighing (Worst Case)
N = 2 [1] [2] 1 1
N = 3 [1] [2] [3] 1 1
N = 4 [1] [2] [3,4] 1 2
N = 5 [1,2] [3,4] [5] 1 2
N = 6 [1,2] [3,4] [5,6] 2 2
N = 6 [1,2,3] [4,5,6] [7] 1 2
N = 8 [1,2,3] [4,5,6] [7,8] 2 2
N = 9 [1,2,3] [4,5,6] [7,8,9] 2 2
N = 10 [1,2,3,4] [5,6,7,8] [9,10] 2 3
N = 11 [1,2,3,4] [5,6,7,8] [9,10,11] 2 3
N = 12 [1,2,3,4] [5,6,7,8] [9,10,11,12] 3 3

If you are interested in how to solve 8 or 12 balls weight puzzle then check out these posts:-

  1. How to solve 8 balls weight puzzle
  2. How to solve 12 balls weight puzzle