Chinese remainder theorem: Difference between revisions
imported>Barry R. Smith |
imported>Richard Pinch (gave two proofs) |
||
Line 17: | Line 17: | ||
has solutions, and any two solutions differ by a [[multiple (mathematics)|multiple]] of <math>n</math>. | has solutions, and any two solutions differ by a [[multiple (mathematics)|multiple]] of <math>n</math>. | ||
==Methods of proof== | |||
The Theorem for a system of ''t'' congruences to coprime moduli can be proved by [[mathematical induction]] on ''t'', using the theorem when <math>t=2</math> both as the base case and the induction step. We mention two proofs of this case. | |||
=== Existence proof === | |||
As usual we let <math>\mathbf{Z}/n</math> denote the set of integers modulo ''n''. | |||
Suppose that <math>n_1, n_2</math> are coprime. We consider the map ''f'' defined by | |||
:<math>x \bmod n_1n_2 \mapsto (x \bmod n_1,x\bmod n_2) \,</math> | |||
We claim that this map is [[injective function|injective]]: that is, if <math>x \not\equiv y \bmod n_1n_2</math> then <math>x \not\equiv y \bmod n_1</math> or <math>x \not\equiv y \bmod n_2</math>. Suppose that <math>x \equiv y \bmod n_1</math> or <math>x \equiv y \bmod n_2</math>. Then each of <math>n_1</math> and <math>n_2</math> divides <math>x-y</math>: but since <math>n_1</math> and <math>n_2</math> are coprime, it follows that their product <math>n_1n_2</math> divides <math>x-y</math> also. | |||
But the two sets in question, the first consisting of all residue classes modulo <math>n_1n_2</math> and the second consisting of pairs of residue classes modulo <math>n_1</math> and <math>n_2</math>, have the same number of elements, namely <math>n_1n_2</math>. So if the map ''f'' is injective, it must also be [[surjective function|surjective]]: that is, for every possible pair <math>(x_1 \bmod n_1,x_2 \bmod n_2)</math>, there is an | |||
<math>x \bmod n_1n_2</math> mapping to that pair. | |||
=== Explicit construction === | |||
The existence proof assures us that the solution exists but does not help us to find it. We can do this by appealing to the [[Euclidean algorithm]]. If <math>n_1</math> and <math>n_2</math> are coprime, then there exist integers <math>u_1</math> and <math>u_2</math> such that | |||
:<math>u_1n_1 + u_2n_2 = 1 ,\,</math> | |||
and these can be computed by the [[extended Euclidean algorithm]]. | |||
We now observe that putting | |||
:<math>x = u_1n_1x_2 + u_2n_2x_1 ,\,</math> | |||
we have | |||
:<math>x \equiv x_1 \bmod n_1,~~x \equiv x_2 \bmod n_2 . \,</math> |
Revision as of 15:02, 22 November 2008
The Chinese remainder theorem is a mathematical result about modular arithmetic. It describes the solutions to a system of linear congruences with distinct moduli. As well as being a fundamental tool in number theory, the Chinese remainder theorem forms the theoretical basis of algorithms for storing integers and in cryptography. The Chinese remainder theorem can be generalized to a statement about commutative rings; for more about this, see the "Advanced" subpage.
Theorem statement
The Chinese remainder theorem:
Let be pairwise relatively prime positive integers, and set . Let be integers. The system of congruences
has solutions, and any two solutions differ by a multiple of .
Methods of proof
The Theorem for a system of t congruences to coprime moduli can be proved by mathematical induction on t, using the theorem when both as the base case and the induction step. We mention two proofs of this case.
Existence proof
As usual we let denote the set of integers modulo n. Suppose that are coprime. We consider the map f defined by
We claim that this map is injective: that is, if then or . Suppose that or . Then each of and divides : but since and are coprime, it follows that their product divides also.
But the two sets in question, the first consisting of all residue classes modulo and the second consisting of pairs of residue classes modulo and , have the same number of elements, namely . So if the map f is injective, it must also be surjective: that is, for every possible pair , there is an mapping to that pair.
Explicit construction
The existence proof assures us that the solution exists but does not help us to find it. We can do this by appealing to the Euclidean algorithm. If and are coprime, then there exist integers and such that
and these can be computed by the extended Euclidean algorithm. We now observe that putting
we have