Find all integers $x$ of the form $x\equiv _5 3$, $x\equiv _8 6$. I'm asked to find all integers $x$ of the form $x\equiv _5 3$, $x\equiv _8 6$. It turns out that the set of all such integers is $$\{ x\in \mathbb{Z} : x=38+40t, \ \text{for some} \ \ t\in \mathbb{Z}\}$$
yet I haven't been able to get closer to such result. I would appreciate any help.
 A: I am assuming $\equiv_5$ is equivalence modulo $5.$
$x\equiv 3 \pmod 5$
$x \in \{3,8,11,\cdots\}$
$15 \equiv -1 \pmod 8$
$3 - 45 \equiv 6 \pmod 8$
$-42$ is a possible value of $x$
In fact, now I can see that we could have guessed at $-2$ right at the get-go.
And if we add any multiples of $40$ to it we will not change the congruence class, for the two modulos.
A: Use the Chinese remainder theorem.   
Note that $2\cdot8-3\cdot5=1$.
It follows that $x\cong16\cdot3-15\cdot6\cong-42\bmod{40}\implies x\cong 38\bmod{40}$.
Here I used the isomorphism between $\Bbb Z_5\times\Bbb Z_8$ and $\Bbb Z_{40}$ given by $\varphi(x,y)=16x-15y$.  (Under the isomorphism, $(3,6)\mapsto38$.)
A: This can be viewed as the constant case of the Chinese remainder theorem:
$x\equiv_53$ and $x\equiv_86$
$\iff x\equiv_5-2$ and $x\equiv_8-2$
$\iff x\equiv_{40}-2$
$\iff x\equiv_{40}38$
A: On one hand, $38$ is a solution to both congruence since $38=3+5\cdot 7$ and $38=6+8\cdot 4$. So, given that both $5$ and $8$ divide $40$, any number of the form $38+40t$, for $t$ an integer, will also be a simultaneous solution to the congruences because: 
$$38+40t\equiv_5 38\equiv_5 3$$ 
And similarly 
$$38+40t\equiv_8 38\equiv_8 6$$ 
On the other hand, suppose $x$ is any number that simultaneously solves both congruences.
Then: 
$$x-38\equiv_5 3-3\equiv_5 0$$ 
And 
$$x-38\equiv_8 6-6\equiv_8 0$$ 
This means $5|(x-38)$ and $8|(x-38)$. Since $5$ and $8$ are coprime, this means their product $5\cdot 8=40$, also divides $x-38$, i.e. $x-38$ is of the form $40t$ for some integer $t$, i.e. $x$ is exactly of the form $38+40t$.    
In general, if you have found at least one solution, $c$, to $n$ congruences taken $\textrm{mod}$ some numbers $a_1,a_2,\dots, a_n$, then the general solution to these $n$ simultaneous congruence equations is of the form $c+\textrm{l.c.m.}(a_1,a_2,\dots, a_n)t$ where $t$ is allowed to be any integer (this is a fairly easy result that you can get just generalizing the above proof). The tricky bit is finding the initial $c$, if it even exists. In a special case, the Chinese remainder theorem gives you an idea of how to find such a $c$.
