If $x \equiv 3 \pmod 6$ and $x \equiv 5\pmod 8$ then how is this $x \equiv 21\pmod {24}$?
I understand $24$ is $\operatorname{lcm}(6,8)$ but how to get from $3$ and $5$ to $21$?
This is is a Chinese Remainder Theorem problem.
If $x \equiv 3 \pmod 6$ and $x \equiv 5\pmod 8$ then how is this $x \equiv 21\pmod {24}$?
I understand $24$ is $\operatorname{lcm}(6,8)$ but how to get from $3$ and $5$ to $21$?
This is is a Chinese Remainder Theorem problem.
$x\equiv3\pmod 6\implies x\equiv0\pmod 3$ and $x\equiv 1\pmod 2$
Again, $x\equiv5\pmod 8\implies x\equiv1\pmod 2$
So, it suffices to use CRT with $x\equiv0\pmod 3$ and $x\equiv5\pmod 8$ which is legitimate as $(3,8)=1$
Alternatively,
So, $x$ can be written as $6a+3$ where $a$ is any integer
Similarly, $x=8b+5$ for some integer $b$
$\implies 6a+3=x=8b+5\implies 6a=8b+2,3a=4b+1=4b+4-3$
$\implies 3a+3=4b+4\implies a+1=\frac{4(b+1)}3$ which must be an integer as $a+1$ is
So, $3\mid 4(b+1)\implies 3\mid(b+1)$ as $(3,4)=1$
$\implies b=3c-1$ where $c$ is any integer
So, $x=8b+5=8(3c-1)+5=24c-3\equiv-3\pmod{24}\equiv21$
$6$ and $8$ are not coprime, but their least common multiple is $2^3 \cdot 3$.
From the first equivalency we know that $x \equiv 0 \pmod 3$. That's all the information we have modulo powers of $3$.
Now, information modulo powers of $2$: From the first equivalency we know that $x \equiv 1 \pmod 2$, and from the second, we know that $x \equiv 5 \pmod 8$. Fortunately, these two equivalencies agree. If they didn't, you would have no solution. Since the second one contains all the information in the first one, we can throw out the first one.
So we need to solve $x \equiv 0 \pmod 3$ and $x \equiv 5 \pmod 8$. By the Chinese remainder theorem, we know that the answer is unique modulo $24$.
Generally, you can plug this into the CRT formula, but I guess the easiest way to solve this instance is to look at the sequence $5, 5+8, 5+16$ and pick out the one that's divisible by $3$.
Hint $\rm\,\ 6,8\mid x\!+\!3\iff lcm(6,8)=24\mid x\!+\!3\iff mod\ 24\!:\ x\equiv -3\equiv 21.\ \ $ QED
Remark $\ $ It has easy solution since the system is equivalent to a constant case of CRT, viz. $\rm\:x\equiv 3\equiv \color{#C00}{-3}\pmod 6\:$ and $\rm\: x\equiv 5\equiv \color{#C00}{-3}\pmod 8,\:$ so $\rm\:x\equiv \color{#C00}{-3}\:$ both $\rm\:mod\ 6\:$ and $\rm\:mod\ 8.\:$ Therefore, as above, we deduce that $\rm\:x\equiv \color{#C00}{-3}\pmod{24},\ $ since $\rm\: 24 = lcm(6,8).\ $ Generally we have
$$\rm\:\begin{eqnarray}x&\equiv&\rm c\ \ (mod\ m)\\ \rm x&\equiv&\rm c\ \ (mod\ n)\end{eqnarray}\iff m,n\mid x\!-\!c\iff lcm(m,n)\mid x\!-\!c\iff x\equiv c\ \ (mod\ lcm(m,n))$$
gcd(6,8) = 2, divide the moduli by this number.
x = 3 mod 6 = 3 mod 3, and x = 5 mod 8 = 5 mod 4 which solves out to be 9 (incorrectly) even though 3 and 4 are coprime
– user2175923 Mar 25 '13 at 16:06