# Congruences with LCM and Relatively Prime Numbers

How do I verify that if $a \equiv b\pmod{n_1}$ and $a \equiv b\pmod{n_2}$, then $a \equiv b \pmod n$, where the integer $n = \operatorname{lcm} (n_1, n_2)$. Hence, whenever $n_1$ & $n_2$ are relatively prime, $a \equiv b \pmod{n_1 n_2}$

• So suppose $p^r$ is the highest power of $p$ dividing $n_1,n_2$. What does $a=b\bmod n_1$ and $a=b\bmod n_2$ tell you? – almagest Apr 12 '16 at 16:20
• Notice the use of \pmod and \operatorname in my edit to the question. $\qquad$ – Michael Hardy Apr 12 '16 at 16:23