23-07-2012, 13:04 #1 Iancar29 Registered User     Join Date: Jan 2009 Location: N Dublin -66m Asl Posts: 3,476 Weighted coin problem. During the lecture of this problem one of the students had to tell her how to do it , thats how bad it was at times. So ye , any help or steps how to go about it would be great guys , thanks. Btw i know the number of coins can differ but ye , heres this example.. Five coins are identical in appearance, but on coin is either heavier or lighter than the others, which all weigh the same . Draw a decision tree that gives an algorithm that identifies in at most three weighings that bad coin and determine whether it is heavier or lighter than the others using only a pan balance. I know obviously we cant draw here . So even links to a good explanation or something would be much appreciated , i just hate how its worded considering my dyslexia . Thanks in advance.
 23-07-2012, 14:33 #2 Michael Collins Moderator   Join Date: Jul 2001 Location: Dublin Posts: 1,656 Mod: Mathematics Take any 4 coins, split into 2 groups of 2 and weigh them. If the scale doesn't balance then your 'different' coin must be among this group of 4, if not it must be the coin you didn't weigh, agree? Now to determine which group of 2 above your coin is in. Take either group of 2 and separate into 1 coin on each side. If the scale doesn't balance, the different coin must be in this group. Now have a go at what happens next yourself!
 Thanks from:
23-07-2012, 15:08   #3
Iancar29
Registered User

Join Date: Jan 2009
Location: N Dublin -66m Asl
Posts: 3,476
Quote:
 Originally Posted by Michael Collins Take any 4 coins, split into 2 groups of 2 and weigh them. If the scale doesn't balance then your 'different' coin must be among this group of 4, if not it must be the coin you didn't weigh, agree? Now to determine which group of 2 above your coin is in. Take either group of 2 and separate into 1 coin on each side. If the scale doesn't balance, the different coin must be in this group. Now have a go at what happens next yourself!
Thanks pal! , very easily explained.

So assuming the odd coin is among coins 1-4

Weighing A(1& 2) ..... and B (3 & 4 )

if A is balanced then odd coin is either 3 or 4
if A is not balanced then odd coin is either 1 or 2

asssuming A is balanced weigh 3 or 4 against 1 or 2 ...
so say 3 & 1... if thats balances then odd coin is 4.
If not then odd coin is 3.

Would i also have to have the separate tree to show the 1 or 2 coin being the odd coin also?

 27-07-2012, 20:08 #4 Delphi91 Registered User     Join Date: May 2001 Location: Limerick Posts: 1,315 I think you're going overboard with your weighings there. The most you can have is three weighings. Using your notation, let A = coins 1 & 2 and B = coins 3 & 4. Leave coin 5 out on its own. Place group A on one side of the balance and group B on the other There are three possible outcomes:If the scales balance, then the heavier coin is coin 5 If group A is heavier than group B, then the heavier coin is either coin 1 or coin 2. Place the two coins from group A on either side of the balance - the heavier side side corresponds to the heavier coin If group B is heavier than group A, then the heavier coin is either coin 3 or coin 4. Place the two coins from group B on either side of the balance - the heavier side side corresponds to the heavier coin Last edited by Delphi91; 27-07-2012 at 20:12.
27-07-2012, 20:17   #5
MathsManiac
Moderator

Join Date: Apr 2007
Posts: 1,331
Quote:
 Originally Posted by Delphi91 I think you're going overboard with your weighings there. The most you can have is three weighings. Using your notation, let A = coins 1 & 2 and B = coins 3 & 4. Leave coin 5 out on its own. Place group A on one side of the balance and group B on the other There are three possible outcomes:If the scales balance, then the heavier coin is coin 5 If group A is heavier than group B, then the heavier coin is either coin 1 or coin 2. Place the two coins from group A on either side of the balance - the heavier side side corresponds to the heavier coin If group B is heavier than group A, then the heavier coin is either coin 3 or coin 4. Place the two coins from group B on either side of the balance - the heavier side side corresponds to the heavier coin
But this is not a correct solution, because you have assumed that the odd coin is heavier than the others rather than lighter. In OP's problem, all you are told is that there is one coin that is EITHER heavier OR lighter, but you don't know which. As well as identifying the dodgy cpin, you also have to determine whether it is heavier or lighter than the others.

 27-07-2012, 20:46 #6 MathsManiac Moderator     Join Date: Apr 2007 Posts: 1,331 Mod: Mathematics Michael Collins's suggestion will get you there, but don't forget the second part of the task. For example, if the first weighing is balanced, so that you know the remaining coin is odd, you still need to use another weighing to decide whether it's heavier or lighter than the others. Similarly, if the scales are unbalanced in the first weighing, it's not enough to just note that they are different, you also need to note which pair was heavier. Taking the information "The odd one is one of these two" into the second weighing is not enough. You need to be taking in information like: "One of these two is heavier than all the other coins, or else one of those two is lighter than all the other coins". Only after you answer this with the second weighing can you fully answer the question with the third. Interestingly, it's possible to identify one odd coin among twelve with only three weighings, even when, as in this case, you don't know in advance whether it's heavier or lighter.
27-07-2012, 22:30   #7
Delphi91
Registered User

Join Date: May 2001
Location: Limerick
Posts: 1,315
Quote:
 Originally Posted by MathsManiac But this is not a correct solution, because you have assumed that the odd coin is heavier than the others rather than lighter. In OP's problem, all you are told is that there is one coin that is EITHER heavier OR lighter, but you don't know which. As well as identifying the dodgy cpin, you also have to determine whether it is heavier or lighter than the others.
Good point, didn't read the problem carefully!

 30-07-2012, 17:08 #8 Rubecula Registered User     Join Date: Jul 2010 Location: Anglesey, North Wales. Where mankind fears to go. Posts: 2,659 A = (1 + 2) B = (3 + 4) C = (1 + 5) D = (2 + 5) weigh A against B if both the same then the odd coin must be 5. If not then you now weigh C against B if both the same then the odd coin is 2. If not the same you weigh D against B. If both the same then the odd coin must be 1. If it is still unequal the odd coin must be in group B. Weigh coin 3 against any of 1, 2, or 5. If they are the same it must be 4 if it is not the same then 3 is the odd coin and this can be verified with a measure against any of the remaining coins. Obviously by weighing them and finding the difference you will also know whether it is lighter or heavier than a real coin.
30-07-2012, 20:05   #9
MathsManiac
Moderator

Join Date: Apr 2007
Posts: 1,331
Quote:
 Originally Posted by Rubecula A = (1 + 2) B = (3 + 4) C = (1 + 5) D = (2 + 5) weigh A against B if both the same then the odd coin must be 5. If not then you now weigh C against B if both the same then the odd coin is 2. If not the same you weigh D against B. If both the same then the odd coin must be 1. If it is still unequal the odd coin must be in group B. Weigh coin 3 against any of 1, 2, or 5. If they are the same it must be 4 if it is not the same then 3 is the odd coin and this can be verified with a measure against any of the remaining coins. Obviously by weighing them and finding the difference you will also know whether it is lighter or heavier than a real coin.
But this strategy does not solve the problem in at most three weighings. (After your third sentence, you have used your three weighings and yet the problem is not finished.)

31-07-2012, 16:28   #10
hivizman
Moderator

Join Date: Jun 2007
Location: In exile
Posts: 1,157
Mod: Islam
Quote:
 Originally Posted by MathsManiac Interestingly, it's possible to identify one odd coin among twelve with only three weighings, even when, as in this case, you don't know in advance whether it's heavier or lighter.
This takes me back.

I was introduced to this problem when I was at school, in the idle days that filled the time between the end of examinations and the end of the school year. My maths teacher introduced us to an algorithmic approach for working out three weighings of four coins against four coins that would identify the odd coin and whether it was lighter or heavier depending on the outcomes of the three weighings. Basically, each weighing can have one of three outcomes (left side goes down = 0, weighing balances = 1, right side goes down = 2), and the three weighings give you enough possibilities to match uniquely the 24 possible situations (12 coins multiplied by two possibilities for the odd coin) with 24 possible outcomes of the weighing process.

Also, the method generalises to n weighings, where the number of coins that can be involved is given by (3^n - 3)/2. So you can detect the odd coin, and whether it is heavier or lighter, out of 39 coins with 4 weighings, out of 120 coins with 5 weighings, and so on.

Some years later, I was discussing the 12-coin problem with a friend who had a maths degree, and he presented a solution that involved a complicated decision tree with subsequent weighings depending on the outcome of previous weighings. We were both delighted to work out that his solution and mine were actually isomorphic.

The general formula above tells us that we can assess three coins with two weighings (weigh coin 1 against coin 2 and then coin 2 against coin 3 - if the first weighing balances, then coin 3 is odd and the second weighing tells us whether coin 3 is heavier or lighter than the normal coin 2; if the first weighing doesn't balance, then coin 3 is normal and the second weighing tells us whether coin 2 is lighter, heavier or normal, in the last case implying that coin 1 is odd, so the first weighing tells us whether coin 1 is lighter or heavier).

With four coins, we need three weighings. We have to weigh two coins against the other two coins to begin with (if we weigh one against one, then two weighings allows us to decide whether the odd coin is one of coins 1, 2 and 3, and, if so, whether the odd coin is light or heavy, but if both the first two weighings balance, then we know the odd coin is coin 4 but we need a third weighing to determine whether coin 4 is lighter or heavier). But this weighing can have only one of two outcomes - (a) either one of coins 1 and 2 is lighter or one of coins 3 and 4 is heavier, or (b) either one of coins 1 and 2 is heavier or one of coins 3 and 4 is lighter. A second weighing, say coin 1 against coin 2, allows us to tell whether coin 1 is lighter or heavier than coin 2 (which implies that coins 3 and 4 are normal), or the same weight (which implies that coins 1 and 2 are normal). In either case, we need to weigh one of the two coins 1 and 2 against one of the two coins 3 and 4 to get enough information to identify the odd coin and whether it is lighter or heavier.

Is there a general proof that shows that, for all numbers of coins between 4 and 12, we need three weighings to identify the odd coin and whether it is lighter or heavier? Or is there a counter-example where we need more than three weighings? Is there a general algorithm for determining the actual sequence of weighings, or do we have to work it out for each number of coins through logic-informed trial and error?

 Thanks from:
31-07-2012, 16:43   #11
Iancar29
Registered User

Join Date: Jan 2009
Location: N Dublin -66m Asl
Posts: 3,476
Heres the descision tree format for a 12 coin problem..

I rather not do a long one like this as it easy to makes mistakes... 9 or less im ok with..
Attached Images
 Screen shot 2012-07-31 at 16.44.28.png (297.3 KB, 195 views)

 31-07-2012, 23:40 #12 hivizman Moderator     Join Date: Jun 2007 Location: In exile Posts: 1,157 Mod: Islam Number the coins from 1 to 12. For each weighing, record "0" if the left side of the balance goes down, "1" if the weighing balances and "2" if the right side of the balance goes down. Weighing 1: 1,3,4,5 against 2,6,7,8 Weighing 2: 1,6,7,8 against 2,9,10,11 Weighing 3: 2,3,8,11 against 5,6,9,12 Outcomes 000 and 222 are impossible because there is no coin on the same side in all three weighings. Outcome 111 is impossible because this would imply no odd coin. There remain 24 possible outcomes, which map onto the 24 possible values for the odd coin as follows: 001 1H 221 1L 002 2L 220 2H 010 3H 212 3L 011 4H 211 4L 012 5H 210 5L 020 6L 202 6H 021 7L 201 7H 022 8L 200 8H 100 9L 122 9H 101 10L 121 10H 102 11L 120 11H 110 12L 112 12H The weighing sequence is quite similar to the decision tree. For example, if the first weighing shows a balance, we know that the odd coin is one of 9,10,11 and 12. The second weighing above is equivalent to the second weighing in this situation in the decision tree (three coins known to be true against coins 9, 10, and 11 is equivalent to four coins known to be true against coins 9, 10 and 11 and a fourth coin known to be true). The third weighing then incorporates both a comparison of coins 9 and 11 (equivalent to the comparisons of coins 9 and 10 in the decision tree with renumbering of the coins), if the second weighing is unbalanced, and a comparison of coin 12 with a coin known to be true, if the second weighing is balanced - in either situation, the other coins in the weighings above will be true so won't affect the comparisons. The assignment of coins to the three weighings is determined by writing the numbers from 1 to 12 in ternary notation together with their complements (where 0 is rewritten as 2, 1 as 1 and 2 as 0). It's necessary to ensure that there are exactly four coins on each side of each weighing and four omitted from each weighing. This is done by selecting either the ternary representation of the number or the complement to represent the odd coin being heavy. The selection is made by looking at the sequence of numbers and selecting the sequence where the digits "ascend" rather than "descend" - that is, the digits follow the cyclical order 0-1-2-0 rather than 0-2-1-0. So, for coin 1, we select 001 as "heavy" but for coin 2, we select 220 as "heavy", because 002 follows the descending cyclical order. Note that, once we make a decision based on the first digits, we ignore subsequent digits, so the "heavy" allocation for 6 is 202, which begins by following the ascending order, even though the last two digits follow the descending order. The same approach can be applied for 39 coins in 4 weighings and 120 coins in 5 weighings, and so on. The problem with this approach is that it's not obvious how you would apply it to numbers of coins other than those representing the maximum coins for different numbers of weighings. On the other hand, once you have a clear grasp of how to apply the decision tree approach, this can be used for any number of coins.
 01-08-2012, 01:00 #13 MathsManiac Moderator     Join Date: Apr 2007 Posts: 1,331 Mod: Mathematics ...and one can try out one's strategy here: http://nrich.maths.org/5796
01-08-2012, 12:22   #14
hivizman
Moderator

Join Date: Jun 2007
Location: In exile
Posts: 1,157
Mod: Islam
Quote:
 Originally Posted by MathsManiac ...and one can try out one's strategy here: http://nrich.maths.org/5796

Looking at my earlier post, there is an underlying logic. The twelve coins are in effect divided into four groups of three: {1,2,12}, {3,4,5}, {6,7,8} and {9,10,11}. The solution could be written as a decision tree - which I've set out in words rather than try to draw.

The outcomes of the first weighing provide the following information:

(A) Left side of scale goes down: odd coin must be 1H, {3,4,5}H, 2L or {6,7,8}L
(B) Scale balances: odd coin must be {9,10,11} or 12 (can't tell whether H or L).
(C) Right side of scale goes down: odd coin must be 1L, {3,4,5}L, 2H or {6,7,8}H

The second weighing narrows the possibilities:

(A) In weighing 1, left side of scale went down:

(A1) Left side of scale goes down: odd coin must be 1H or 2L (from first weighing, {9,10,11} and 12 must be true, and{3,4,5} must be true - otherwise scale would balance given that these are omitted from the second weighing - and {6,7,8} must be true - can't both be light from weighing 1 and heavy from weighing 2).
(A2) Scale balances: odd coin must be {3,4,5}H as these coins were in weighing 1 but not weighing 2.
(A3) Right side of scale goes down: odd coin must be {6,7,8}L.

(B) In weighing 1, scale balanced:

(B1) Left side of scale goes down: odd coin must be {9,10,11}L.
(B2) Scale balances: odd coin must be 12, but we don't yet know whether this is L or H.
(B3) Right side of scale goes doen: odd coin must be {9,10,11}H.

(C) In weighing 1, right side of scale went down:

(C1) Left side of scale goes down: odd coin must be{6,7,8}H
(C2) Scale balances: odd coin must be {3,4,5}L
(C3) Right side of scale goes down: odd coin must be 1L or 2H.

The third weighing needs to be no more than a weighing of one coin against another, but the actual weighing {2,3,8,11} against {5,6,9,12} does all the weighings in one go - which one is actually relevant is contingent on the outcomes of the first two weighings. Depending on the outcome of the previous weighings, we have narrowed the possible outcomes down to the odd coin being in one of the four groups. For the three groups {3,4,5}, {6,7,8} and {9,10,11}, we know whether the odd coin is heavy or light. Weighing one coin from each group against another coin tells us which is the odd coin from the group (if the scale balances, then the odd coin is the one left out of the comparison).

So the final weighing is comparing 3 with 5, 8 with 6 and 11 with 9. It is also comparing 2 with 12 - either 2 is true and 12 is odd, in which case this tells us whether 12 is heavy or light, or 12 is true and we know whether we have either (1H or 2L) or (1L or 2H).

Is this solution, with some relabelling of coins and possibly some reversals of the pans in which the coins are placed, effectively the same as that of Iancar29, or is it a distinct solution?

01-08-2012, 21:58   #15
ZorbaTehZ
Registered User

Join Date: Aug 2006
Posts: 2,000
There is a famous solution to that problem, published in Eureka, by the Blanche Descartes collective: (F refers to Professor Felix Fiddlesticks)
Quote:
 F set the coins out in a row And chalked on each a letter, so, To fom the words 'F AM NOT LICKED' (An idea in his brain had clicked.) And now his mother he'll enjoin: MA DO LIKE ME TO FIND FAKE COIN