1

If we have two linear congruence and we want to use CRT to combine them, we have to find the intersection of the solution sets of these two linear congruence, right? For example, if I want to combine $n$ congruent to $a_1 (\text{mod} \ m_1)$ and $n$ congruent to $a_2 (\text{mod} \ m_2)$, then I have to first find the intersection of $[a_1]$ and $[a_2]$, right?

Slavica
  • 99

1 Answers1

0

If you set up each congruence as linear equations equal to each other, you'll get $a_1 + m_1 x = a_2 + m_2 y \implies m_1 x - m_2 y = a_2 - a _1$

And then you'll only have to solve the linear diophantine equation. So you'll have to show that $gcd(m_1, m_2) | (a_2 - a_1)$ for there to be a solution set.

In calculating the greatest common divisor with the Euclidean algorithm, we can walk back the calculation to find a solution to $m_1 x' - m_2 y' = gcd(m_1, m_2)$

If we let $ k ={a_2 - a_1 \over gcd(m_1, m_2)}$ then $(x, y) = (kx', ky')$

And then we can use $n = a_1 + m_1 x = a_2 + m_2 y$ to represent the resultant intersection

${n \over gcd(m_1, m_2)} (mod$ $lcm(m_1, m_2))$

JustKevin
  • 113
  • 11