
Casting Out Nines - Arithmetic trick to check a multiplication - SandB0x
http://mathworld.wolfram.com/CastingOutNines.html
======
kragen
Casting out elevens is a related check, and only slightly harder; you add and
subtract alternate digits, starting from the end. So 380258203 is congruent to
3-0+2-8+5-2+0-8+3 mod 11, i.e. -5, which is (congruent to) 6 mod 11. The
advantage it has over casting out nines is that it catches all digit
transpositions and most inadvertent shifts. 12345 × 67890 is, mod 11, 3 × 9 =
27, which is 5 mod 11. 838102050 is also 5 mod 11, but none of the eight
numbers you can obtain by transposing two adjacent digits in it are 5 mod 11,
while they are all congruent to 838102050 (0) mod 9. Similarly, if you shifted
one of the partial products over by one place by accident while adding up the
final product, your result would fail the casting-out-elevens check unless
that partial product was 0 mod 11.

------
happy4crazy
If you like this kind of stuff, there are a couple of fun mental math books I
can recommend:

[http://www.amazon.com/Speed-Mathematics-Secret-Skills-
Calcul...](http://www.amazon.com/Speed-Mathematics-Secret-Skills-
Calculation/dp/0471467316/ref=sr_1_1?s=books&ie=UTF8&qid=1303689258&sr=1-1)

[http://www.amazon.com/Secrets-Mental-Math-Mathemagicians-
Cal...](http://www.amazon.com/Secrets-Mental-Math-Mathemagicians-
Calculation/dp/0307338401/ref=sr_1_1?ie=UTF8&qid=1303689197&sr=8-1)

It's really baffling that people don't teach this stuff in school.

~~~
colanderman
Along these lines, here's how to do square roots in your head.

Let s be the number whose square root you wish to find, and p be the nearest
perfect square. You can then approximate √s ≈ √p+(s-p)/(2√p).

Example: √33 ≈ √36+(33-36)/(2√36) = 6 - 3/12 = 6-¼ = 5¾ = 5.75. Actual √33 =
5.74456…

I am a math tutor and taught this to one student who didn't have a square root
button on their calculator (albeit I taught it as a calculator trick rather
than mental math). He picked up on it pretty quickly.

~~~
happy4crazy
I also really like the simple-but-awesome tricks for multiplications:

1) (a + b) _(a + c) = a_ (a + b + c) + b _c.

Example: 13 _ 14 = 10 * (13 + 4) + 3 _4\. You learn to "see" 13_ 14 --> 170 +
12 = 182.

2) (a + b) _(x_ a + c) = a _(x_ a + c + x _b) + b_ c

Example: 22 * 62 = 20 _(62 + 3_ 2) + 2 _2 = 1364. Here you would see that 60 =
3_ 20, so you add 3 * 2 to 62 to get 68, multiply by 20 to get 1360, and then
add 2*2.

Edit: Er, my stars are turning into italics. You get the idea.

~~~
jerf
Try copying and pasting × or ⋅.

~~~
kragen
Or use a compose key: <http://canonical.org/~kragen/setting-up-keyboard.html>.

------
waterhouse
Related HN discussion (divisibility by 7; 48 comments):

<http://news.ycombinator.com/item?id=1852210>

------
giberson
A question of naivety--why bother with checking by "casting out 9's". Isn't it
simpler to simply redo the calculation and check if you get the same result?
If you're concerned that you multiplied wrong isn't it just as likely you'll
perform a bad check calculation resulting in a false negative/false positive?

~~~
kragen
Casting out nines has a couple of advantages over simply redoing the
calculation:

• as the other commenter mentioned, it's much less likely that you'll repeat
the same error, because you'd have to do it in a totally different way;

• if the numbers are more than two digits, it's much less work to do casting
out nines than to redo the calculation. Multiplying 38020562 by 95942, using
the standard algorithm, you have to do 40 digit multiplications, 32 carries,
and then sum five six-digit partial products (about another 25 additions) to
get your final sum of 14 or so digits; that's a total of 97 operations.
Checking it by casting out nines involves only about 26 operations, which can
be simplified further by casting out some nines ahead of time — 95942, for
example, is obviously 2 mod 9 because the other digits are 9, 9, and 5+4 = 9.

(Side note: is it worthwhile to use Karatsuba multiplication to multiply
38020562 by 95942 by hand?)

