"Casting out nines" is an elementary check of a multiplication which makes use of the congruence (mod 9). Let decimal numbers
be written
,
, and their product
be
.
Let the digit sums of these numbers be
,
, and
. Then
,
, and
. Furthermore
, so
. So if
and
are incongruent (mod 9), the multiplication
has been done incorrectly.
For example, .
The digit sums of 12345 and 67890 are 15 and 30, respectively,
and their product is 450. Similarly, the digit
sum of 838102050 is 27. And
, so the check shows agreement.
Casting out nines is also an addition test, since , and a subtraction
test, since
.
It can also be used as a division test for
(i.e.,
) since
.
The left side of the figure shows a modern reconstruction of the check for Lincoln's multiplication. The right side shows Lincoln's handwritten check.
Because the check compares only residues modulo 9, it does not detect errors that preserve the digit sum, including a transposition of digits or the insertion of a zero. In 1824, Abraham Lincoln used casting out nines to check long multiplication in his cyphering book. A surviving page shows an extra zero in his written work that the check did not reveal (History of Mathematics Project). The manuscript leaf is now held by Columbia University's Rare Book & Manuscript Library in New York as Plimpton 089.001.
Casting out nines was transmitted to Europe by the Arabs, but was probably developed somewhere on the Indian subcontinent and is therefore sometimes also called "the Hindu check," with "Hindu" simply meaning the people of the Indian subcontinent.
The procedure was described by Fibonacci in his Liber Abaci (Wells 1986, p. 74).