Download presentation

Presentation is loading. Please wait.

Published byKaylyn Moad Modified over 2 years ago

1
Fake coin detection

2
Fake coins Suppose we have a number of coins, at most one is fake (i.e. either one is fake or none is fake). You have a pair of scales (a balance), and you want to find the fake coin, if it exists, with the minimum number of comparisons. Coins can be placed on the left or right of the scales or not (i.e. we place the remaining coins on the table).

3
problem solving process. What is important here is the problem solving process. We first find that we cannot solve the problem as it is stated (if we only have one coin, what does it mean to say if it is genuine or fake). We then go on to solve a second problem (which we will call the marked coin problem), and this will help us to solve the original problem (which we can call the unmarked coin problem).

4
2m+1 possibilities Suppose that there are m coins, and one is heavy (then there are m possibilities). If one coin is heavier or lighter, then there are 2m possibilities. And if there is not a fake coin then there are 2m+1 possibilities.

5
1+2m≥3^{n}. When we make a comparison with the scales there are three possibilities, tip left, right or balance. With n comparisons there are 3^{n} different possibilities, giving an upper bound on the number of situations we can distinguish. Therefore 1+2m≥3^{n}.

6
c(n) The most coins we can distinguish between is where there is equality. By rearranging with a little algebra m=1/2 (3^{n}-1). Let us call this value c(n) = 1/2 (3^{n}-1).

7
how this function grows We can see how this function grows for the first few values. c(0)=0, c(1)=1, c(2)=4, c=(13).

8
Two coins??? The base case is trivial, with no coins we make no comparisons, and the problem is solved. But with one coin we cannot say if it is genuine or fake as we have nothing to compare it with. Therefore the question does not make sense, so let us assume that we have a reference coin which is genuine.

9
The induction step The induction step is as follows. We assume that if the fake coin exists among a set of c(n) coins, it can be found with at most n comparisons. We have to show (build on this assumption) how to find the fake coin among c(n+1) coins, with at most n+1 comparisons.

10
If the scales balance, then the fake coin must be on the table (i.e. the coin is not on the scales). Therefore we can examine the coins on the table. We have made one comparison, therefore we must be left with no more than c(n) coins on the table. As we know how many coins are not on the scales, we know how many coins are on the scales.

11
c(n+1) c(n+1) = 3.c(n)+1. (by basic algebra) so c(n+1)-c(n) = 2c(n)+1=3^{n}.

12
the additional reference This number is odd (2c(n) is even), 3^{n} is odd. Therefore we cannot split this number in two and put half on left and right of the scales. But we have the additional reference coin, therefore we put c(n)+1 coins on one side and c(n)+reference coin on the other side of the scales.

13
we cannot apply the inductive hypothesis. If the scales tip, we can eliminate the coins on the table (i.e. not on the scales), but then we are left with 2c(n)+1 coins!!! And this is greater than c(n), so we cannot apply the inductive hypothesis.

14
possibly heavier and possibly lighter. But this comparison not only tells us that the fake coin is among the coins on the scales, but it also tells us which coins are possibly heavier and possibly lighter. This is important information and should be utilized. Let us now move onto a new problem where the coins are marked either possibly heavier or lighter.

15
marked coin problem Here is the marked coin problem. We are supplied with a number of coins, each marked possible heavy (H) or possibly light (L), and exactly one coin is fake (note that this is different to the original problem above, and is a sub-problem).

16
L1+H1=L2+H2 Suppose L1 coins are placed on the left and H1 coins are placed on the left. Suppose L2 coins are placed on the right and H2 coins are placed on the right. The number of coins on the left and right must be equal (in order to make any meaningful comparison). L1+H1=L2+H2 (=3^{n}).

17
L1+H2=L2+H1 If the scales tip (e.g. to the left), then the L1 coins and H2 coins must be genuine (and vice versa). In order to apply the inductive hypothesis, this number must be equal to 3^{n}. This means L1+H2=L2+H1.

18
L1=L2 and H1=H2 These two equations imply that L1=L2 and H1=H2, in other words, each side must contain the same number of coins of the same type. This is another example of symmetry. This can always be achieved as, given three coins at least two must be of the same type. We can now describe the solution to the marked coin problem and then the solution to the unmarked coin problem.

19
marked coin problem The solution to the marked coin problem is as follows. Given 3^{n+1} marked coins, place 3^{n} on each side of the scale so that there are the same number of each type of coin on each side. If the scales balance proceed with the coins on the table (i.e. not on the scale). Else, if the scales tip to the left proceed with the possibly heavy coins on the left and possibly light coins n the right (vice versa if tip right).

20
unmarked coins problem The solution to the unmarked coins problem is as follows. Divide the coins into 3 piles (3^{n}- 1)/2 + reference coin (put on the left), (3^{n}- 1)/2 +1 (put on the right), and (3^{n}-1)/2 (to leave on the table). If the scales balance, proceed with the coins on the table with the unmarked solution. If the scales tip, mark all of the coins as either possibly heavy or possibly light, and proceed with the marked coin solution.

Similar presentations

OK

MTH 10905 Algebra THE ADDITION PROPERTY OF EQUALITY CHAPTER 2 SECTION 2.

MTH 10905 Algebra THE ADDITION PROPERTY OF EQUALITY CHAPTER 2 SECTION 2.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on save tigers in india download music Ppt on social media analytics Ppt on h1n1 swine flu Ppt on river ganga pollution Ppt on holographic data storage system technology Ppt on abs system in bikes Ppt on life of william shakespeare A ppt on computer networking Ppt on principles of peace building solutions Ppt on bullet train