You have a set of 15 billiard balls and a balance scale, and you know that one of the balls has a different weight from others. But you don't know which ball it is and whether it is heavier or lighter. What is the least number of weighing that will determine for certain which ball has a different weight and whether it is heavier or lighter?
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
According to me, the solution should be 2 or 3.
I) If we take the odd ball (say A) and a perfect ball (say B) and weigh, then the balance is imperfect. Now if we take another perfecct ball (say C) and weigh A and B with it one by one, we find that it would remain in balance with B but not with A. Since ball A is not in balance with 2 balls and ball B is balanced with C, we can conclude that ball A is the odd one in the set. So, number of attempts (minimum) is 3.
Ii) If we take A and B and weigh, they are imbalanced. Now, if we weigh B and C in the second weighing, they weigh the same and we can conclude that since more than one balls weigh same, therefore, they are perfect and the other which doesn't match with any one of them is imperfect. So, number of attempts (minimum) in this case is 2.
Log in to reply
But we don't know which ball is of different weight. If we weigh a pair at a time. It will take us 1 4 times to guarantee that we find the ball of different weight and whether if it is heavier and lighter.
Log in to reply
No, we know that exactly 1 of them is different. And for minimum number of weighings, we should get the imperfect ball in the first turn only. And if it weighs different from at least 2 balls, it is declared to be odd.
Log in to reply
@Prabhat Singh – Yes we know exact one is different but it can be ball 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, or 15. We know exactly one but we don't know which is the one.
You are given 15 balls which two balls would you choose to weigh to find out which is different. The different ball is not marked with "This is a different ball". How are you going to choose?
Don't waste my time. There are 121 members including me who have solved this problem. Are you saying we are all wrong and only you is correct?
Log in to reply
@Chew-Seong Cheong – See, I'm just saying that for minimum number of weighings, we get the odd one first (assumption; it is one of the possible scenarios) and we even know that only 1 is different. If it differs from 2, then it differs from the remaining too.
And now, since you think that I am wasting your time and questioning the brilliance of 121 people, I must let you know that it is a discussion platform where posing a question for clarifying doubts is normal. And I didn't say that I am 100% correct, but may be you assumed it. I commented below your post just hoping for clarification of my doubt otherwise I could have even posted a solution. If you have a problem in answering anyone, then I suggest that you must stick to some other platform where people cannot question you!
Log in to reply
@Prabhat Singh – Sorry, I was not patient. Anyway you are wrong. It is impossible that we can find the different ball by one weighing. It is just that you don't know why. I can't help you if you can't figure it out. I was just saying if you are right then we are all wrong. So that you don't have to argue further on your point.
Thanks for your suggestion to move elsewhere, but I won't. I have contributed "Solutions - 8019 total, ~62K upvotes".
Log in to reply
@Chew-Seong Cheong – Thanks for this humble reply this time. Maybe I understood what you are trying to convey... Moreover, my suggestion had a predefined condition too and was not directly stated. By the way, 8019 solutions and 62K upvotes is a great thing!
Log in to reply
@Prabhat Singh – In fact to learn it is important that you know where you did wrong and don't repeat again. And in math we have unique solutions, so it means that if others are right and your answer is different it means you are wrong. You will only learn when you know where you have gone wrong. You learn nothing defending your solution. I lost patience because I told you where you went wrong you argue the same thing again. I contribute more by using my time providing more solutions. I am probably the member who provides the most solutions. You can check my profile.
Community Contributions - ~1M people reached Impact 1 featured problem 1212 featured solutions 265 helpful reports 565 comment upvotes
The answer I came up with is 4 and the 4th weigh is only necessary in a couple of scenarios. I believe it might be able to be done in 3 but I have not figured out how. I am looking to the community to either show me how it can be done in fewer moves or confirm, mathematically, why it requires 4 weighs. My solution is shown below.
Thanks all for giving me both more elegant solutions and mathematical proofs. I'm now wondering if there are 2 balls, 1 lighter and 1 heavier by the same amount, how would it affect the number of weighs required (double, triple, square, cube, ...)? How would that result change if you didn't know if the 2 balls were off in the same or opposite direction?
According to me, the solution should be 2 or 3.
I) If we take the odd ball (say A) and a perfect ball (say B) and weigh, then the balance is imperfect. Now if we take another perfecct ball (say C) and weigh A and B with it one by one, we find that it would remain in balance with B but not with A. Since ball A is not in balance with 2 balls and ball B is balanced with C, we can conclude that ball A is the odd one in the set. So, number of attempts (minimum) is 3.
Ii) If we take A and B and weigh, they are imbalanced. Now, if we weigh B and C in the second weighing, they weigh the same and we can conclude that since more than one balls weigh same, therefore, they are perfect and the other which doesn't match with any one of them is imperfect. So, number of attempts (minimum) in this case is 2.
Gary's solution shows that 4 weighings is possible. It's not hard to see that 3 is insufficient.
To see this, consider that there are 3 0 possible outcomes: 1 5 balls can be the outlier, and the outlier can be either heavy or light. One weighing divides the outcomes into 3 groups: the balls on the left are heavier, the balls on the right are heavier, or the outlier is in the remaining balls. So narrowing down our outcomes into 1 possibility after n weighings requires that the number of initial outcomes be at most 3 n .
In our case, we have 3 0 ≤ 3 n , so n ≥ 4 .
it should be 0, you can pick one up and feel its lighter!
Log in to reply
Even so, with just the use of your hands, and assuming you can carry 7 balls at once on each hand, you'd still take 4 weighings, at least, to determine which one of the balls is not of the normal weight.
According to me, the solution should be 2 or 3.
I) If we take the odd ball (say A) and a perfect ball (say B) and weigh, then the balance is imperfect. Now if we take another perfecct ball (say C) and weigh A and B with it one by one, we find that it would remain in balance with B but not with A. Since ball A is not in balance with 2 balls and ball B is balanced with C, we can conclude that ball A is the odd one in the set. So, number of attempts (minimum) is 3.
Ii) If we take A and B and weigh, they are imbalanced. Now, if we weigh B and C in the second weighing, they weigh the same and we can conclude that since more than one balls weigh same, therefore, they are perfect and the other which doesn't match with any one of them is imperfect. So, number of attempts (minimum) in this case is 2.
First, separate the balls into three groups of 5.
Test 1-5 vs 6-10 and then test 1-5 vs 11-15.
There are two possibilities:
1) One of those two tests will be balanced. The ten balls in the balanced groups can be ignored. The heavy/light ball is in 6-10 or 11-15, and we can deduce whether it is heavy or light from the test that includes its group.
2) Neither test is balanced. Then the heavy/light ball is in 1-5 and we can deduce whether it is heavy or light from the tests with its group.
We have reduced the set of balls to a group of five, and know whether the extra ball is heavy or is light.
Without loss of generality, the extra ball is heavy, and is in group 1-5. Weigh 1-2 vs 3-4. If they balance, the heavy ball is #5. If not, take the two balls from the heavy side and test them against each other to isolate the heavy ball.
I did not initially have a proof that 3 tests do not suffice, but I remembered my information theory at roughly the same time as helpful comments appeared, so I include a second half of the proof for the sake of completeness.
Edit: the information-theory lower bound An algorithm that takes at most n steps, and where each step has at most d possible outcomes, can only output at most d n different solutions. One can see this by modeling an algorithm as a decision tree, with branching factor d and height n . Such a tree will have at most d n leaves, which correspond to the different outputs.
In the current problem, d = 3 , since each weighing has three possible results: left heavier, right heavier, and balanced. Thus a three-step algorithm can only reach 3 3 = 2 7 different solution possibilities. But there are 15 choices of the ball, and 2 choices of "heavy" vs "light", which means there are 30 different possible scenarios. Thus a 3-step algorithm would not suffice.
With thanks to Mark Hennings.
If we run three tests, there are three different outcomes for each test, and hence 3 3 = 2 7 possible sets of results. This number of results cannot distinguish the 1 5 × 2 = 3 0 possible answers (which ball, heavier or lighter).
Log in to reply
Thanks Mark.
Yes, this is the information theory lower bound. It generalizes: an algorithm that performs n operations, where each operation has at most d possible outputs, can only reach d n possible results.
A simpler approach to mine.
See this balance puzzle article , and replace "coin" with "billiard ball".
Since the target billiard ball is different from the others and the goal is to identify the billiard ball, the number of weighings for c = 1 5 billiard balls is
⌈ lo g 3 ( 2 c + 1 ) ⌉ = ⌈ lo g 3 ( 2 ⋅ 1 5 + 1 ) ⌉ = 4 .
Normal problem with oddity of offending ball specified, it would need 3 weighings by dividing in 5,5,5 — 2,2,1 —1,1. However, one extra weighing is required in 5,5,5 to find the oddity of the ball.
Problem Loading...
Note Loading...
Set Loading...
First divide the 15 balls into three groups of five balls. Call the groups A , B , and C . Let the ball of different weight be ball X and call the group without ball X as "perfect" and the group with ball X as "imperfect".
Weighing 1 : Weigh group A and group B
Weigh A and B ⟹ { If balance, C is imperfect. If imbalance, C is perfect.
Weighing 2 : Weigh group B and group C
Weigh B & C ⟹ ⎩ ⎪ ⎪ ⎨ ⎪ ⎪ ⎧ If C is imperfect. ⟹ { If C is heavier, X is heavier. If C is lighter, X is lighter. If C is perfect. ⟹ { If balance, A is imperfect. If imbalance, B is imperfect. ⟹ { If imperfect is heavier, X is heavier. If imperfect is lighter, X is lighter.
Conclusions: After two weighing, we have identified which group of five balls has ball X , and whether ball X is heavier or lighter.
Weighing 3: Weigh a pair of two balls of the imperfect group.
Weigh 2 pairs of imperfect group ⟹ { If balance, the other ball is X. If imbalance, the imperfect pair is known.
Weighing 4: Weigh the two balls of the imperfect pair and ball X is found.
Therefore, the least number of weighing is 4 .