# My Son's Yr7 Maths Question



## Trebor76 (Apr 21, 2012)

Hi there,

My 12 year old came home with the following maths question which has got us all stuck:

"Alpha has forgotten the PIN on a credit card.  There are four digits altogether.  Here are the various PINs Aplha tries:

6204
6108
8208
8198

Each time two of the numbers are correct, and two are wrong.  Can you work out the four digits of the PIN, in their correct order?"

I think it's either 6298 or 8104 as these combinations haven't errored out before, but I'm not really sure and I can't narrow it down any further than two which seems odd 

Any guidance (and its reasoning) would be greatly appreciated.

Regards,

Robert


----------



## xenou (Apr 21, 2012)

I don't know if this is the fastest way to create the proof, but I just started with the first try and made the assumption that each of 6 possible cases of correct digits is true.  Five of the six resulted in logical impossibilities, so that leaves the sixth proven.  From there it was two short steps to infer the remaining two digits, given the information proven in the first try.

Tries:            a 6204
                  b 6108
                  c 8208
                  d 8198                        
                                            
Possible cases:     6 2 x x   correct                
(from first try)    6 x 0 x   correct                
                    6 x x 4   correct                
                    x 2 0 x   correct                
                    x 2 x 4   correct                
                    x x 0 4   correct                
                                            
Test each possible case:                                            
Hypothesis:     a    6 2 x x  correct                
                a    x x 0 4  incorrect                
Consequence:    c    8 x x 8  correct    *    
                d    8 1 x x  incorrect  *    
Result:                hypothesis disproved                            
                                            
Hypothesis:     a    6 x 0 x  correct                
Consequence:    a    x 2 x 4  incorrect                
                c    x 1 x 8  incorrect   *    
                d    x 1 x 8  correct     *    
Result:         hypothesis disproved (conflicting cases)                            
                                            
Hypothesis:          6 x x 4  correct                    
Consequence:    b    x x 0 x  incorrect                
Result:         hypothesis disproved (3 digits cannot be wrong)                            
                                            
Hypothesis:          x 2 0 x  correct                
Consequence:    c    8 x x 8  incorrect   *             
                d    8 x x 8  correct     *          
Result:                hypothesis disproved (conflicting cases)                            
                                            
Hypothesis:     a    x 2 x 4  correct                
                a    6 x 0 x  incorrect                
                b    6 x 0 x  correct                
Result:         hypothesis disproved (conflicting cases)                            
                                            
First Proof          x x 0 4  correct        (proven - all other cases disproved)        
                     6 2 x x  incorrect                
                                            
From this it follows that 1 is the second digit, since in the second try:                                            
                b   6    incorrect (known)                    
                    1    correct   (inferred)                    
                    0    correct   (known)                    
                    8    incorrect (known)                    
                                            
Second Proof        x 1 0 4 correct                        
                                            
From this it follows that 8 is the first digit since in the third try:                                            
                b   8    correct   (inferred)                    
                    2    incorrect (known)                    
                    0    correct   (known)                    
                    8    incorrect (known)                    
                                            
Third Proof         8 1 0 4 is correct


----------



## Trebor76 (Apr 21, 2012)

WOW - that's fair more scientific than my strategy 

I appreciate the effort xenou.  It's a pity you're not in Sydney as I'd tee up tutoring lessons!!

Thanks again,

Robert


----------



## xenou (Apr 21, 2012)

It reminds me of the game Master Mind - do they sell that in Australia?  One person sets up four colored pegs behind a shield, and the other has something like 10 or 12 tries to correctly guess the sequence (I think after each attempt you are told for each guessed peg if your color is correct and/or if the color and position is correct.  Amazing that this is a game for kids - it's a fun puzzle to work out.


----------



## Trebor76 (Apr 21, 2012)

> It reminds me of the game Master Mind - do they sell that in Australia?



Yes, we have it!!  I showed your reply to my wife and she said it too reminded her of Mastermind but unlike the game we could not exclude the wrong combinations to end up with the right one, as you've done.


----------



## Oaktree (Apr 23, 2012)

Hi, Xenou... I'm not sure your proof for 62XX is right.  8 x x 8  doesn't need to be correct in C if the 2 is already assumed to be correct.   

I think C becomes x2x8 correct, which means D is xx98 correct

I think the OP's original assessment is correct and both 6298 and 8104 are valid solutions.


----------



## xenou (Apr 23, 2012)

Ah rat. That's true, I made a mistake there.  If we had two pins then the puzzle is cooked as that is also a logically impossible case.

I think I found another way to disprove 62 as the first two digits:

Hypothesis:     a    6 2 x x  correct                
                a    x x 0 4  incorrect                
Consequence:    b    6 x x 8  correct
                b    x 1 0 x  incorrect *
                d    x x 9 8  correct   *  
                d    8 1 x x  incorrect
Result:         hypothesis disproved  (3rd digit cannot be both 0 and 9)


----------



## Trebor76 (Apr 23, 2012)

Thanks guys.

What I find annoying with these types of questions is that in reality you can only have one PIN which because I always arrived at the two alternatives (and after hours of trying) I thought my answer must have been wrong.

I suppose that as there are four digits and "each time two of the numbers are correct, and two are wrong" there must be two answers i.e. 4 x 2 /4

Anyway, I really appreciate the efforts.

Kind regards,

Robert


----------



## Darren Bartrup (Apr 24, 2012)

Surely this is a trick question - he tried his pin four times, but surely the machine would eat the card after the third attempt anyway?


----------



## BenMiller (Apr 25, 2012)

There are only 16 possible combinations:


Excel WorkbookABCD162042620836294462985610466108761948619898204108208118294128298138104148108158194168198Sheet1

Should take no more than two minutes to see that your original suggestion was correct. 6298 or 8104 are the only viable options.


----------



## xenou (Apr 25, 2012)

6298 has been excluded (see my post #7) so I'm still going with one solution. 

ξ


----------



## steve case (Apr 25, 2012)

Oaktree said:


> ... both 6298 and 8104 are valid solutions.



I got 8104 rather quickly, didn't try for number 2.  You don't really need Excel for this one. 

Part of it is understanding what the question is.


----------



## xenou (May 2, 2012)

No formulas were harmed in the making of this thread.
ξ


----------



## sundarrd (Mar 9, 2013)

I encountered the same situation 
reading the question again and again 
Each time two of the numbers are correct, and two are wrong. Can you work out the four digits of the PIN, in their correct order?"
The answer is NO 
reason being as soon we read the question we try to find the pin and not pay real attention to what is being asked.
The answer to this is NO because 6298 and 8104 are one of the possible combinations.

even 4108 will fit all the 4 combination and it could be the correct order .
there are 24 combinations of this number  4 factorial

for example 8104 can be written as the following 24 combinations

8104, 8140, 8014, 8041, 8410, 8401, 1804, 1840, 1084, 1048, 1480, 8408, 0814, 0841, 0184, 0148, 0481, 0418, 4810, 4801, 4180, 4108, 4081, 4018

Revisiting the attempts:
6204
6108
8208
8198

as you can see with any number out of the 24 2 digits match in each instance.



same applies for 6298

so we have 48 numbers out of which 8104 and 6298 are two combinations.
so finding the correct order is not possible.


----------



## xenou (Mar 9, 2013)

Each time two of the numbers are correct: I think that should be taken to mean that the digits are correct *and* in the right place.

Edit, however, I agree that the problem is cooked since 8014 and 6298 are both pins that would satisfy the original statement that "each time two of the numbers are correct and two are not"


----------

