Harman Patil (Editor)

Midy's theorem

Updated on
Edit
Like
Comment
Share on FacebookTweet on TwitterShare on LinkedInShare on Reddit

In mathematics, Midy's theorem, named after French mathematician E. Midy, is a statement about the decimal expansion of fractions a/p where p is a prime and a/p has a repeating decimal expansion with an even period (sequence A028416 in the OEIS). If the period of the decimal representation of a/p is 2n, so that

Contents

a p = 0. a 1 a 2 a 3 a n a n + 1 a 2 n ¯

then the digits in the second half of the repeating decimal period are the 9s complement of the corresponding digits in its first half. In other words,

a i + a i + n = 9 a 1 a n + a n + 1 a 2 n = 10 n 1.

For example,

1 13 = 0. 076923 ¯  and  076 + 923 = 999. 1 17 = 0. 0588235294117647 ¯  and  05882352 + 94117647 = 99999999.

Extended Midy's theorem

If k is any divisor of the period of the decimal expansion of a/p (where p is again a prime), then Midy's theorem can be generalised as follows. The extended Midy's theorem states that if the repeating portion of the decimal expansion of a/p is divided into k-digit numbers, then their sum is a multiple of 10k − 1.

For example,

1 19 = 0. 052631578947368421 ¯

has a period of 18. Dividing the repeating portion into 6-digit numbers and summing them gives

052631 + 578947 + 368421 = 999999.

Similarly, dividing the repeating portion into 3-digit numbers and summing them gives

052 + 631 + 578 + 947 + 368 + 421 = 2997 = 3 × 999.

Midy's theorem in other bases

Midy's theorem and its extension do not depend on special properties of the decimal expansion, but work equally well in any base b, provided we replace 10k − 1 with bk − 1 and carry out addition in base b.

For example, in octal

1 19 = 0. 032745 ¯ 8 032 8 + 745 8 = 777 8 03 8 + 27 8 + 45 8 = 77 8 .

In duodecimal (using inverted two and three for ten and eleven, respectively)

1 19 = 0. 076 E 45 ¯ 12 076 12 + E 45 12 = E E E 12 07 12 + 6 E 12 + 45 12 = E E 12

Proof of Midy's theorem

Short proofs of Midy's theorem can be given using results from group theory. However, it is also possible to prove Midy's theorem using elementary algebra and modular arithmetic:

Let p be a prime and a/p be a fraction between 0 and 1. Suppose the expansion of a/p in base b has a period of , so

a p = [ 0. a 1 a 2 a ¯ ] b a p b = [ a 1 a 2 a . a 1 a 2 a ¯ ] b a p b = N + [ 0. a 1 a 2 a ¯ ] b = N + a p a p = N b 1

where N is the integer whose expansion in base b is the string a1a2...a.

Note that b  − 1 is a multiple of p because (b  − 1)a/p is an integer. Also bn−1 is not a multiple of p for any value of n less than , because otherwise the repeating period of a/p in base b would be less than .

Now suppose that  = hk. Then b  − 1 is a multiple of bk − 1. (To see this, substitute x for bk; then b = xh and x − 1 is a factor of xh − 1. ) Say b  − 1 = m(bk − 1), so

a p = N m ( b k 1 ) .

But b  − 1 is a multiple of p; bk − 1 is not a multiple of p (because k is less than  ); and p is a prime; so m must be a multiple of p and

a m p = N b k 1

is an integer. In other words,

N 0 ( mod b k 1 ) .

Now split the string a1a2...a into h equal parts of length k, and let these represent the integers N0...Nh − 1 in base b, so that

N h 1 = [ a 1 a k ] b N h 2 = [ a k + 1 a 2 k ] b     N 0 = [ a l k + 1 a l ] b

To prove Midy's extended theorem in base b we must show that the sum of the h integers Ni is a multiple of bk − 1.

Since bk is congruent to 1 modulo bk − 1, any power of bk will also be congruent to 1 modulo bk − 1. So

N = i = 0 h 1 N i b i k = i = 0 h 1 N i ( b k ) i N i = 0 h 1 N i ( mod b k 1 ) i = 0 h 1 N i 0 ( mod b k 1 )

which proves Midy's extended theorem in base b.

To prove the original Midy's theorem, take the special case where h = 2. Note that N0 and N1 are both represented by strings of k digits in base b so both satisfy

0 N i b k 1.

N0 and N1 cannot both equal 0 (otherwise a/p = 0) and cannot both equal bk − 1 (otherwise a/p = 1), so

0 < N 0 + N 1 < 2 ( b k 1 )

and since N0 + N1 is a multiple of bk − 1, it follows that

N 0 + N 1 = b k 1.

Corollary

From the above,

a m p is an integer

Thus m = 0 ( mod p )

And thus for k = l 2

b l 2 + 1 = 0 ( mod p )

For k = l 3 and is an integer

b 2 3 l + b l 3 + 1 = 0 ( mod p )

and so on.

References

Midy's theorem Wikipedia