The 12 balls problem ⚖️

benahm
4 min readDec 6, 2018

Problem :

You have 12 identical-looking balls, one of them is counterfeited, it has a slightly different weight than the others (it could be heavier or lighter), using a pan balance, how can you determine the counterfeited ball using only 3 weighings ?

Note : think 🤔 by yourself, the solution is below 👇

Solution

Let’s define some notations using colors

Basic case :

Out of 3 balls if we know that the counterfeited ball is lighter or heavier, we can always find the counterfeited ball with only one weighting

Let’s assume that we have 3 balls one of them is counterfeited (lighter)

Case 1

(1) is lighter than (2)

We can then deduce that (1) is the counterfeited ball

Case 2

(1) is heavier than (2)

We can then deduce that (2) is the counterfeited ball

Case 3

(1) and (2) have the same weight

We can then deduce that (3) is the counterfeited ball

The 12 balls problem :

Let’s assume that we have 12 balls identical-looking, on of them is counterfeited (lighter or heaver)

We’ll split the balls in 3 groups

  • Group [1] : (1,2,3,4)
  • Group [2] : (5,6,7,8)
  • Group [3] : (9,10,11,12)

Let’s weight the group [1] with [2]

Case 1

Case 1

The group [1] and [2] have the same weight

We can then deduce that the balls of the group [1] & [2] are normal

Let’s weight normal balls (1,2,3) with the unchecked balls (9,10,11)

Case 1 -1

Case 1–1

(1,2,3) and (9,10,11) have the same weight

We can deduce that the balls (1),(2),(3),(9),(10),(11) are normal

(12) is the counterfeited ball

We can use the last weighing to check whether the ball is lighter or heavier

Solved ✔️

Case 1–2

Case 1–2

(1,2,3) is lighter than (9,10,11)

Basic case, Solved ✔️

Case 1–3

Case 1–3

(1,2,3) is heavier than (9,10,11)

Basic case, Solved ✔️

Case 2

The group [1] is heavier than [2]

Case 2

We can then deduce that the balls of the group [1] are supposed to be lighter and balls of the group [2] are supposed to be heavier

Let’s weight two supposed lighter balls & a supposed heavier ball (1,2,5) with the supposed lighter balls & a normal ball (3,4,9)

Case 2–1

Case 2–1

(1,2,5) & (3,4,9) have the same weight

We can then deduce that those balls are normal and the counterfeited ball is among the supposed heavier balls (6,7,8)

Basic case, Solved ✔️

Case 2–2

Case 2–2

(1,2,5) is lighter than (3,4,9)

We can then deduce that the counterfeited ball is (1) or (2)

We can use the last weighing to find the counterfeited ball

Solved ✔️

Case 2–3

Case 2–3

(1,2,5) is heavier than (3,4,9)

We can then deduce that the counterfeited ball is either the lighter balls (3),(4) or the heavier ball (5)

We can use the last weighing between the ball (3) & (4) to deduce the counterfeited ball

Solved ✔️

Case 3

The group [1] is lighter than [2]

Case 3

The exact same strategy of the case 2 can be used in this case to solve the problem

Solved ✔️

References

--

--

benahm

Salesforce Technical Architect 👷‍♂️⚒️💻☁️