1

I want to solve the following system of congruences: $$ x \equiv 1 \bmod 2\\ x \equiv 2 \bmod 3\\ x \equiv 3 \bmod 5$$ By checking all small numbers, I got $x=23$ as smallest solution. I think that all $x$ of the form $23 + k \cdot 30$, $k \in \mathbb{Z}$ are solutions but I don't see how to prove it.

Also can this be generalized to divisors which aren't pairwise coprime like $2,3,5$ above? If yes, are my solutions then of the form $x_0 + k\cdot lcm(d_1,...,d_n)?$ If yes, how do I prove this?

xxxxxxxxx
  • 13,688
Marc
  • 3,403
  • 3
    http://en.wikipedia.org/wiki/Chinese_remainder_theorem – Adam Hughes Jan 07 '15 at 03:39
  • There have been close to four hundred Questions related to the Chinese Remainder Theorem/solving linear congruences modulo relatively prime moduli. See this one for a representative (and early) instance. – hardmath Jan 07 '15 at 03:52
  • Thanks, this answered my first question. I'm still a bit unsure about the general case where the divisors aren't necessarily pairwise coprime. – Marc Jan 07 '15 at 03:59
  • Short story: a solution might not exist if the moduli are not pairwise coprime, but if a solution $x_0$ exists, then yes, you can get other solutions by adding multiples of the LCM of "divisors". The proof is basically just substitution (since the LCM is divisible by all the respective moduli). – hardmath Jan 07 '15 at 04:20
  • Ok, thanks! (15 chars) – Marc Jan 07 '15 at 04:44

2 Answers2

-1

Say you have $x \equiv 5 \bmod{n} $ as one of your equations where $ n$ is a composite and not coprime with other moduli then factor $ n $ and replace the equation with $ x \equiv 5 \bmod {p_i}$ for each factor and proceed as normal with CRT.

  • You might want to add a few words about detecting when the resulting equations are inconsistent (and thus no solution to either the original or the rewritten system is possible). – hardmath Jan 07 '15 at 19:24
-1

Since the divisors are relatively prime to each other (co-prime) i.e. $\text{gcd}(2,3,5)=1$ You can directly apply the Chinese Remainder Theorem

CRT: $$x \equiv \sum_{i=1}^k a_i \cdot b_i \cdot c_i \pmod{N}$$

Where, $$a_i=\text{Remainder when a number is divided by divisor}$$ $$b_i = c_i^{-1} \pmod{m_i}$$ $$c_i=\frac{m_1\cdot m_2\cdot...\cdot m_n}{m_i}=$$

Now to calculate $a_i$, $$a_1=1$$ $$a_2=2$$ $$a_3=3$$

Now to calculate $c_i$, $$c_1=\frac{2\cdot 3\cdot 5}{2}=15$$ $$c_2=\frac{2\cdot 3\cdot 5}{3}=10$$ $$c_3=\frac{2\cdot 3\cdot 5}{5}=6$$

Now to calculate $b_i$, $$b_1=c_1^{-1} \pmod{m_1}\rightarrow 15^{-1} \pmod{2}=1$$ $$b_2=c_2^{-1} \pmod{m_2}\rightarrow 10^{-1} \pmod{3}=1$$ $$b_3=c_3^{-1} \pmod{m_3}\rightarrow 6^{-1} \pmod{5}=1$$

Now, $$x\text{(is congruent to)} a_1\cdot b_1\cdot c_1 + a_2\cdot b_2\cdot c_2 + a_3\cdot b_3\cdot c_3 \pmod{m1\cdot m2\cdot m3}$$ $$x\text{(is congruent to)} 53 \pmod{30}$$

Hence, $$x=30k+53$$ where $k\in Z$

Hope It Helps!