<s>[INST] Solving a system of congruences: CRT 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.
 [/INST] $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$
</s>