## Why do the divisibility 'rules' work?

### Explaining: The origin of many divisibility rules

#### - contributed by Mr. Christopher Mulliss astrophysics doctoral candidate, The University of Toledo

Divisibility Rules || 10,2,4,8,2^k,5,25 || 3,9,11,7,13,17... || Alternate test

### Why do the divisibility "rules" work?

#### The Power of Modulo Arithmetic

Modulo arithmetic is a powerful tool that can be used to test for divisibility by any number. The great disadvantage of using modulo arithmetic to test for divisibility is the fact that it is usually a slow method. Under some circumstances, however, the application of modulo arithmetic leads to divisibility rules that can be used. These rules are important to mathematics because they save us lots of time and effort.

In fact, many of the divisibility rules that are commonly used (rules for 3, 9, 11) have their roots in modulo arithmetic. This page will show you how some of these common divisibility rules are connected to modulo arithmetic.

#### Some Background Information

Consider any number (call the number N) written in base 10. Let n be the number of digits in N, and Di be the "i"th digit (reading right to left) in the number, i = 1 to n. This number can be expressed by the following summation:

N = [Dn * 10^(n-1)] + [Dn-1 * 10^(n-2)] + ... + [D2 * 10^1] + [D1 * 10^0].

Consider the number N = 6788. This number contains 4 digits, so n = 4. The first digit is D1 = 8, the second digit is D2 = 8, the third digit is D3 = 7, and the fourth is D4 = 6, so

6788 = [6 * 10^3] + [7 * 10^2] + [8 * 10^1] + [8 * 10^0].

#### Applying the Rules of Modulo Arithmetic

The rules of modulo arithmetic state that the number N is divisible by some number (P) if the above expression is also divisible by P after the base (10) is replaced by the remainder of 10 divided by P. In compact notation, this remainder is denoted by (10 mod P). Thus, N is divisible by P if the following expression is also divisible by P:

[Dn * (10 mod P)^(n-1)] + ... + [D2 * (10 mod P)^1] + [D1 * (10 mod P)^0].

#### Origin of Divisibility Rules for 3, 9, and 11

We can now see how the divisibility rules for P = 3, 9, and 11 are rooted in modulo arithmetic.

Consider the case where P = 3.

Because 10 mod 3 is equal to 1, any number is divisible by 3 if the following expression is also divisible by 3:

[Dn * (1)^n-1] + ... + [D2 * (1)^1] + [D1* (1)^0].

Because 1 raised to any power is equal to 1, the above expression can be simplified as:

Dn + ... + D2 + D1 + D0,

which is equal to the sum of digits in the number. Thus modulo arithmetic allows us to state that any number is divisible by 3 if the sum of its digits is also divisible by 3.

Now consider the case where P = 9.

Because 10 mod 9 is also 1, any number is divisible by 9 is the sum of its digits are also divisible by 9. Thus, the divisibility rules for 3 and 9 come directly from modulo arithmetic.

Finally, consider the case where P = 11.

Because 10 mod 11 is equal to -1, any number is divisible by 11 if the following expression is also divisible by 11:

[Dn * (-1)^n-1] + ... + [D2 * (-1)^1] + [D1* (-1)^0].

Because -1 raised to any even power is equal to 1 and -1 raised to any odd power is equal to -1, the above expression becomes a summation of the digits involving alternated signs:

Dn -... - D2 + D1 (for even n)
and
Dn + ... - D2 + D1 (for odd n).

This "alternating" summation rule for P = 11 is well known and has two versions. The first version states a number is divisible by 11 if the alternating sum of the digits is also divisilbe by 11 (i.e., the alternating sum is a muliple of 11). The second version states that a number is divisible by 11 if the sum of every other digit starting with the rightmost digit is equal to the sum of every other digit starting with the second digit from the right (i.e., the alternating sum is 0). Both of these versions come directly from the rules of modulo arithmetic.

#### Bases Other Than 10

Up to this point, we have only considered numbers written in base 10. A number can, however, be written in any base (B). Such a number can be expressed by the following summation:

N = [Dn * B^n-1] + [Dn-1 * B^(n-2)] + ... + [D2 * B^1] + [D1* B^0].

The rules of modulo arithmetic apply no matter what base is used. These rules tell us that N is divisible by P if the following expression is also divisible by P:

[Dn * (B mod P)^n-1] + ... + [D2 * (B mod P)^1] + [D1* (B mod P)^0].

Most bases other than 10 are difficult to use, but bases that are powers of 10 can easily be used to construct divisibility rules using modulo arithmetic.

Consider writing the base-10 number N = 1233457 in base-100. This can be done by starting with the rightmost digit and grouping the digits in pairs of two. Each grouping of two digits is considered a single "digit" when the number is written in base-100. Written in base-100, the number is 1 23 34 57 where 57, 34, 23, and 1 are considered single "digits." In a similar fashion, this number written in base-1000 is 1 233 457 where 457, 233, and 1 are considered single "digits." Once the base-10 digits are grouped to form the "digits," the above expression can be used to test for divisibility.

Consider P = 7.

Use the base, B = 1000. Because 1000 mod 7 = -1, the alternating summation rule (used for P = 11 in base-10) can be applied. Before applying this rule, the base-10 digits must be properly grouped to form base-1000 "digits."

Consider P = 11.

Use the base, B = 100. Because 100 mod 11 = 1, a number written in base-100 is divisible by 11 if the sum of its "digits" is divisible by 11. Before applying this rule, the base-10 digits must be properly grouped to form base-100 "digits."

Consider P = 13.

Use the base, B = 1000. Because 1000 mod 13 = -1, the alternating summation rule can be applied. Before applying this rule, the base-10 digits must be properly grouped to form base-1000 "digits."

Back to Rules for 3,9,11,7,13,17...
Back to Rules for 10,2,4,8,2^k,5,25