Find $b \in \Bbb Z$ for which exists $a \equiv 4 \pmod 5$ such that $6a+21b=15$ I'm starting to study diophantic equations and congruence and I have found this problem that I don't know how to solve: 

Find $b \in \Bbb Z$ for which exists $a \equiv 4 \pmod 5$ such that $6a+21b=15$.

I can see that the equation is equivalent to $2a + 7b = 5$ and that all $a$ would be of the form $a = -1 + 7s$ and similarly $b = 1-2s$. But I don't understand how to pick $b$ such that $a \equiv 4 \pmod 5$. Any thoughts on how to solve it? Thanks
 A: Notice that if $a\equiv 4 \pmod 5$ then
$$6a+21b \equiv a+b \equiv 0 \pmod 5,$$
so $b \equiv 1 \pmod 5$.  In this case, using the form of the general answer you yourself found, we have that $-2s \equiv 0 \pmod 5$, which implies $s=5k$ for some $k \in \mathbb{Z}$. It follows that any solution respecting the modular condition on $a$ is of the form $b = 1-10k$ and $a=-1+35k$ for some $k \in \mathbb{Z}$.
Finally, observe that for any choice of $k$, we have $a \equiv -1 \equiv 4 \pmod 5$ and $b \equiv 1 \pmod 5$, so all of those are solutions. Even $k=0$ ($a=-1, b=1$) is a solution
A: Write $a = 5k+4$.  The we may solve for $b$: \begin{align}
6(5k+4) + 21 b &= 15  \\
21b &= 15-24-30k  \\
b &= (-9-30k)/21  \\
b &= -(10k+3)/7  \text{.}
\end{align}
For $b \in \Bbb{Z}$, we must have $10k+3 \cong 0 \pmod{7}$, which simplifies to $k \cong 6 \pmod{7}$.
As a check:


*

*$k=-1 \implies a = -1 \implies b = 1$ works, 

*$k=6 \implies a = 34 \implies b=-9$ works, 

*and none of $b=0, -1, -2, \dots, -8$ allow an integer $a$.

