In reply to Paul Robertson:
> You have twelve coins which look identical but one is counterfeit. The coins all weigh the same except for the counterfeit. The counterfeit is either heavier or lighter than the other coins but you don't know which.
> Using balance scales you have to determine which coin is the fake, and whether it is lighter or heavier than the others.
> You are allowed three weighings where you can compare the weight of the coins in one pan with the weight of the coins in the other pan.
Split the coins into three groups of 4 - A, B C. Call them A1,A2,A3,A4, B1,B2,B3,B4 and C1,C2,C3,C4.
Weigh A1,A2,A3,A4 against B1,B2,B3,B4. If = then one of C1,C2,C3,C4 is counterfeit. If A > B then C1,C2,C3,C4 are genuine and either one of group A is counterfeit and too heavy or one of group B is counterfeit and too light. The situation where A < B is symmetrical with A > B (just rename the groups A -> B and B -> A).
In the situation A = B to find which of C is counterfeit. Weigh C1 C2 against C3 A1. If = then C4 is counterfeit, weigh C4 against A1 to see if it is too heavy or too light. If < then (situation with > is symmetrical and can be solved the same way)) either C1 or C2 is too heavy or C3 is too light. Weigh C1 against C2. If = then C3 is too light. If > then C1 is too heavy. If < C2 is too heavy.
In the situation A > B we know that if a coin in A is counterfeit it is too heavy and if a coin in B is counterfeit it is too light. Weigh A1 A2 B1 B2 against A3 B3 C1 C2.
If = then either A4 or B4 is counterfeit. Weigh A4 against B4 if > A4 is counterfeit and to heavy. If < B4 is counterfeit and too light.
If > then either A1 or A2 is too heavy or B3 is too light. Weigh A1 against A2. If = then B3 is counterfeit and too light. If > then A1 is counterfeit and too heavy. If < A2 is counterfeit and too heavy.
If < then either B1 or B2 is too light or A3 is too heavy. Weigh B1 against B2. If = then A3 too heavy. If < then B1 too light. If > B2 too light.