The Chinese remainder theorem I'm trying to do some questions on the Chinese remainder theorem, I've being reading the Wikipedia explanation but I still don't get it. Can someone explain it to me, please?
Here is the question I'm working with. If you have a simpler example, that would be great.

Find an integer $x$ such that $x\equiv2\bmod5$, $x\equiv1\bmod13$ and $x\equiv5\bmod17$.

 A: Considering $x \equiv 1$ (mod 13) and $x \equiv 5$ (mod 17), we get $x = 1 + 13a$ and $x = 5 + 17b$. So, $1+13a=5+17b$.
So, by letting $a=a'-1$ and $b=b'-1$, we get $x = -12 + 13a' = -12 + 17b'$, $x \equiv -12$ (mod $13\times17$). ie. $x\equiv -12$ (mod 221)
Considering $x\equiv -12$ (mod 221) and $x \equiv 2$ (mod 5), we get $x = -12 + 221m = 2 + 5n$.
We can let $m=m'+4$ and $n=n'+174$ to get $x=872 + 221m' = 872 + 5n'$.
So, we get $x = 872 + 1105k$, or $x \equiv 872$ (mod 1105).
A: It's easier than usual because an evident constant-case optimization of CRT exists.  Notice that $\rm\ x \equiv 1\equiv \color{#0a0}{-12}\:\ (mod\ 13),\:$ and $\rm\:x\equiv 5\equiv \color{#0a0}{-12}\ \: (mod\ 17),\:$ so $\rm\:13,17\mid x\!+\!\color{#0a0}{12},\:$ so $\rm\:13\cdot 17\mid x\!+\!\color{}{12},\:$ by $\rm\:lcm(13,17)= 13\cdot 17.\:$ So $\rm\: x = -12 + 13(17 j)\:$ for some integer $\rm\:j.\:$ Hence, applying CRT $\rm mod\ \color{blue}5\!:\: 2 \equiv x \equiv -12\! +\! 13(17j)\equiv -2\! +\! j\Rightarrow j\equiv \color{#c00}{ 4},\,$  so $\rm\,x\equiv -12\! +\! 13(17(\color{#c00}4\!+\!\color{blue} 5i)\!)\!\equiv 872\!+\!1105i$
A: I'd do it as follows (which is, basically, one of the most usual proofs of the CRT): we have the coprime (primes, in fact) integers $5,13,17$:
$$(1)\;\;\;\text{solve}\;\; 13\cdot 17y_5=1\pmod 5:\;\;\;\color{red}5\cdot(-44)+\color{red}{13\cdot 17}\cdot1=1\;\;\;\implies \color{blue}{y_5=1}$$
$$(2)\;\;\;\;\text{solve}\;\; 5\cdot 17y_{13}=1\pmod {13}\;\;\;\color{red}{13}\cdot (-13)+\color{red}{5\cdot17}\cdot2=1\;\;\;\implies \color{blue}{y_{13}=2}$$
$$(3)\;\;\;\;\;\,\text{solve}\;\; 5\cdot 13y_{17}=1\pmod {17}\;\;\;\color{red}{17}\cdot23+\color{red}{5\cdot13}\cdot(-6)=1\;\;\;\implies \color{blue}{y_{17}=-6}$$
and now define
$$x:=\color{green}2\cdot\color{blue}1\cdot13\cdot17+\color{green}1\cdot\color{blue}2\cdot5\cdot17+\color{green}5\cdot\color{blue}{(-6)}\cdot5\cdot13=-1338=-233=872\pmod{5\cdot13\cdot17}$$
You could, of course, have chosen $\,11\,$ instead of $\,-6\,$ in (3) above, but you'd have obtained a much bigger solution, $\,4187\pmod{5\cdot13\cdot17}\,$ , so a negative solution here and there isn't usually a problem but, in fact, an advantage.
The biggest pro in the above method, in my opinion, is that it serves you in any case, whether you have 2, 3 or more congruencies to solve, and is very mechanical.
A: $$\begin{align}
   x &\equiv 2 \pmod5 \\
   x &\equiv 1 \pmod{13} \\
   x &\equiv 5 \pmod{17}
\end{align}$$

This is not the fastest way; but it is the most straightforward way. This method only works when the moduli are pairwise prime:
$$\gcd(5,13) = \gcd(5,17) = \gcd(13,17) = 1$$
We start with $ x \equiv 2 \pmod5$. Then for some integer, $u$, we must have
$$x = 5u+2$$ Then $x \equiv 1 \pmod{13}$ becomes
\begin{align}
   x &\equiv 1 \pmod{13} \\
   5u+2 &\equiv 1 \pmod{13} \\
   5u &\equiv -1 \equiv12 \equiv 25\pmod{13} 
      &\text{(Add $13$ until you get a multiple of $5$.)} \\
   u &\equiv 5 \pmod{13} \\
\hline
   u &= 13v + 5
\end{align}
So now we have $$x = 5u+2 = 5(13v+5)+2 = 65v + 27$$
Next we take $x \equiv 5 \pmod{17}$. (The first few multiples of $17$ are
$17, 34, 51, 68, 85$).
\begin{align}
   x &\equiv 5 \pmod{17} \\
   65v + 27 &\equiv 5 \pmod{17} \\
   -3v&\equiv -5 \pmod{17} \\
   3v &\equiv 5 \equiv 22 \equiv 39 \pmod{17} \\
   v &\equiv 13 \pmod{17} \\
\hline
   v &= 13 + 17w
\end{align}
So $x = 65v + 27 = 65(17w + 13)+27 = 1105w + 872$
Which we can write as
$$x \equiv 872 \pmod{1105}$$
