*The original question was*: Please help me solve this math card trick, I do not understand how it works:

**Physicist**: The trick to this trick is hidden away in modular arithmetic. Modular arithmetic is regular arithmetic, except that you state that some number is now equal to zero. This has the effect of wrapping the number line into a loop. The number you set to zero is called the “mod” or “modulus”. So for example, counting in “mod 4” would be: 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, …

Clocks are just numbers mod 12. If someone told you “it’s 17 o’clock”, you might be inclined to say “do you mean 5 o’clock?” A mathematician would say “17 mod 12 equals 5 mod 12”. You can write this [17]_{12} = [5]_{12}, or 17 mod 12 = 5 mod 12.

You can pass addition, subtraction and multiplication through the mod (though not division, that’s a whole thing). For example,

An example for multiplication:

So we’ve got

and

But when you do math mod nine you get one more, strange property: a number mod 9, is equal to the sum of its digits mod 9. In other words, if you write down a number as “abcd”, then [abcd]_{9}=[a+b+c+d]_{9}. All the fancy tricks you may have learned in grade school involving nines all boil down to this property. Personally, I’d say that this “nine property” is also what makes this seem more like a magic trick. It doesn’t *feel* like any useful information would survive digit adding.

Here’s a quick proof!

Any number of the form “9…99” is equal to 0 mod 9, because they’re all multiples of 9, so when you subtract 9 enough times (1…11 times, in fact) you’re left with zero.

So [9…99]_{9} = [0]_{9}, and adding 1 to both sides you get, [10…00]_{9}=[1]_{9}. Now check this out! Take a number like 3427. You can figure out (with the help of a calculator or something) that [3527]_{9}=[8]_{9}.

Here’s a better way:

*The trick*: [52]_{9}=[7]_{9}. This trick amounts to saying: if [x+y]_{9}=[7]_{9}, then [x]_{9}=[7-y]_{9}.

y is the number of cards in the “hold pile”. Adding up the digits has no effect on the value mod 9. The subtraction (from 7 for 1≤y≤6, and from 16 for 7≤y≤9) amounts to subtracting from 7 mod 9. So the “prediction number” is exactly [7-y]_{9}.

x is the number of cards in all of the other piles. It doesn’t matter if you look at x or the sum of x’s digits (don’t change mod 9). It also doesn’t matter if you split x into different piles, since [A+B]_{M}=[A]_{M}+[B]_{M}.

So there it is. It also doesn’t matter that you’re using cards. Were you so inclined, you could do this same trick with any number of arbitrary objects. The only thing that changes is what number you subtract from (mod 9) to get the prediction number. Cards: [52]_{9}=[7]_{9}. With jokers: [54]_{9}=[9]_{9}. A big box of matches: [300]_{9}=[3]_{9}. Your mom: [1]_{9}=[1]_{9}.

By the by, the “mod 9 invariance” thing was used by accountants in ye olde times to double check their summations. Take the sum you got mod 9, and compare it to the sum of all the digits involved mod 9 (which is easier to do). If you get the same number, then you probably did the original sum right.

Or, at the very least, if you did the sum wrong there’s a 8 in 9 chance you’ll catch it.

**Update**: Since this post was put up we’ve received more “nine-based” questions. Rather than put them in a new post:

*The original question was*: I have been searching for dayyyys for this trick’s proof. I have had one professor tell me it involves mod 9 arithmetic and another say it’s digital root theorem. Any help??

*STEP 1*

Ask a friend to write down a number (any number with more than 3 digits will do, but to save time and effort you might suggest a maximum of 8 digits).

*Example: 83 972 105*

*STEP 2*

Ask them to add the digits.

*Example: 8+3+9+7+2+1+0+5 = 35*

*STEP 3*

Ask them to subtract this number from the original one.

*Example: 83 972 105 – 35 = 83 972 070*

*STEP 4*

Ask them to select any digit from this new number and strike it out, without showing you.

*Example: 83 972 070*

*STEP 5*

Ask them to add the remaining digits and write down the answer they get.

*Example: 8+3+9+7+0+7+0 = 34*

*STEP 6*

Ask them to tell you the number they get *(34)* and you will tell them which number they struck out.

*SOLUTION*

The way you do this is to subtract the number they give you from the next multiple of 9. The answer you get is the number they struck out.

*Example: The next multiple of 9 here is 36 (9 x 4 =36)
36 – 34 = 2 and there you have your answer, easy isn’t it!*

Note: If the number they give you after step 5 is a multiple of 9, there are two possible answers then you simply tell them that this time they crossed out either a 9 or a zero.

**Physicist**: In steps 2 and 3 you’re forcing your friend to create a

*new*number X, such that [X]

_{9}= [0]

_{9}. Since [

*83972105*]

_{9}= [

*8+3+9+7+2+1+0+5*]

_{9}= [

*35*]

_{9}you have [

*83972105 – 35*]

_{9}= [

*0*]

_{9}. So X = 83972070. Let’s call the digit they remove “D” (in this case, D=2). Since the sum of X’s digits is [0]

_{9}, subtracting D leaves you with [-D]

_{9}which is what you have at the end of step 5: [-D]

_{9}=[34]

_{9}.The final subtraction done in the solution is subtracting negative D (leaving D). That multiple of 9 that you find is still equal to [0]

_{9}. It’s only purpose is to make the math a little easier to do in your head. So in this case [-(-D)]

_{9}= [-34]

_{9}= [-25]

_{9}= [-16]

_{9}= [-7]

_{9}= [2]

_{9}. Or equivalently, [-34]

_{9}= [0]

_{9}+ [-34]

_{9}= [36]

_{9}+ [-34]

_{9}= [2]

_{9}. It may seem strange that negative numbers are the same as positive numbers, but in modular arithmetic “positive” and “negative” don’t mean much, since you can add or subtract the modulus whenever. It’s like saying “negative 2 o’clock is equal to 10 o’clock” (just add 12!).

**Another update**:

*The original question was*: ok write three numbers, mix them around, subtract the two, pick a number out of those three and tell me the other two and i can guess your answer. how is it done?

Say you have a number like 537 then you you mix them up to make another number like 375 then subtract 375 from 537 and its 162 and ill pick a number lets say 6( if its a zero you cant use it) ill tell you 1 and 2 and you guess 6.

**Physicist**: Clever! This trick is similar to the last one, and again involves forcing someone to come up with a number that’s equal to [0]

_{9}.

Say the original number is written “abc” (in the example a=5, b=3, c=7). The new number is X = abc-bca (any rearrangement is fine). Now check this out!

[X]_{9}=[abc-bca]_{9}=[abc]_{9}-[bca]_{9}=[a+b+c]_{9}-[b+c+a]_{9}=[a+b+c-b-c-a]_{9}=[0]_{9}. This follows from the rules for mod 9 arithmetic (near the top of this post), namely that [A+B]_{M}=[A]_{M}+[B]_{M} and [abcd…]_{9}=[a+b+c+d+…]_{9}.

[X]_{9}=[0]_{9} is just a fancy way of saying that X is a multiple of 9. Moreover (using that same rule again) the sum of X’s digits must also be a multiple of 9. With this information in hand, given all but 1 digit (or even just the sum of all but one digit), you can find the remaining digit.

In the example X=162. You know the sum of the digits must be a multiple of 9, so given 1 and 2, the remaining digit must be 6.

This system breaks down when the sum of the given digits is already 9. For example, if you’re given 5 and 4, you might guess 0 or 9 (540 and 549 are both multiples of 9, after all), but only one of them can be the hidden digit.

Who discovered, or what source is there for the 105 number trick:

The 105 Trick!

Ask your friend to think of a mystery number Q between 1 and 105.

Then ask him to work out [Q]mod3 and tell you the answer. (In other words he has to divide his mystery number by 3 and tell you what the remainder is). Call the answer x

Ask him to work out [Q]mod5. Call the answer y

Ask him to work out [Q]mod7. Call the answer z

You then put the answers for x,y and z in this formula: [70x+21y+15z]mod105

…and you can work out Q !

That’s the “Chinese Remainder Theorem“, named after little known mathematician “Friedrich Von Chinese”.

Pingback: Q: Why is it that (if you exclude 2 & 3) the difference between the squares of any two prime numbers is divisible by 12? « Ask a Mathematician / Ask a Physicist

I need help with math. The question is: The sum on this digital clock is 15. At what other times will the digits add up to 15? Give at least 2 answers.

Please email any questions you have to [email protected].

Any idea how to solve this?

Find A,B.C,D, and E such that AB X C.DE = AB + C.DE. A,B,C,D, and E each stand for a distinct, single digit from 0 – 9

Pingback: Q: Does how you deal cards affect how random they are? | Ask a Mathematician / Ask a Physicist

i have one Q

my friend write 4 digit number and sys write any 4 digit number and write agian 4 digit number i agian i write one 4 digit number and my friend write one more 4 digit number

my friend ans write in first step how its work plz ans me

Exp

my firend write 4587 and tel me ans is 24575

As all these ‘9 tricks’ work in base 10 numbers, am I right to hypothesize that in base N you would get the same N-1 tricks?

Pingback: Q: When you write a fraction with a prime denominator in decimal form it repeats every p-1 digits. Why? | Ask a Mathematician / Ask a Physicist