Thursday, 10 October 2013

logical deduction - 121 coins and a balance


Inspired by this puzzle...


You have 121 apparently identical gold coins. At most one of these is fake, and weighs a different amount than a genuine coin.


In front of you is balance with two pans. In your pocket you have a single coin which you know is genuine.



What is the minimum number of weighings it takes to find the fake (if there is one), and determine whether it is heavier or lighter than the others?


Hint:



Use your first weighing to reduce this to a similar problem, but with fewer coins.




Answer



Lemma. Given a set A of coins that may be too heavy, a set B of coins that may be too light. Assume AB= and exactly one of the coins is a fake. If |A|+|B|=3k, then the fake coin can be determined in k weighings.


Proof. If k=0, there is nothing to be shown. Assume the lemma is true for soem k; we shall show that it also holds for k+1: Partition A into three nearly equal-sized sets A1,A2,A3 (that is, |A|3|Ai||A|33k). Since only two possible sizes are possible, at least two of the Ai have the same size. Without loss of generality, |A1|=|A2|. Now we can partition B into sets B1,B2,B3 with |Bi|=3k|Ai| Put the coins from A1B2 into the left pan, B1A2 into the right pan. Ignore the coins in A3B3. Note that both pans contain the same number of coins. Now if the left pan goes down, we know that the fake coin is A1B1; if the right pan goes down, the fake coin is A2B2; if the pans weigh the same, the fake coin is A3B3.At any rate, the induction hypothesis applies.


Proposition. Given a known good coin and 3k12 coins among which there may be exactly one too heavy or too light fake coin or no fake coin at all. It is possible to determine which coin is fake and in which way, or that there is no fake coin, in k weightings.


Proof. Again induction. For k=0, there is nothing to be shown. Assume the proposition holds for k; we shall show that it also holds for k+1: Put the known good coin and 3k12 coins into the left pan, 3k+12 into the right pan, and leave the remaing 3k12 coins aside. If the left pan goes down, we have 3k12 coins that may be too heavy, 3k+12 that may be too light, and the rest is known good. By the lemma, we can finish with k more weighings. The case with the right pan going down is similar: we have 3k+12 coins that may be too heavy, 3k12 that may be too light, and the rest is known good. Finally, if both pans weigh the same, we are left with the 3k12 unused coins among which there may be a fake coin or not. By induction hypothesis, this can be solved with k weighings.



Remark. Since it is clar that it takes at least k weighings to distinguish among 3k possible outcomes, the result of the proposition is best possible.


Corollary. The puzzle with 121 coins can be solved in 5 weighings.


No comments:

Post a Comment

Understanding Stagnation point in pitot fluid

What is stagnation point in fluid mechanics. At the open end of the pitot tube the velocity of the fluid becomes zero.But that should result...