<s>[INST] Solve in integers the equation $2x+3y = 5$ If I have the following equation $$2x+3y = 5$$
I know all the integer solutions is $$x = 1+3n$$ $$y  = 1-2n$$ $$n \in \Bbb Z$$
since I can just plug them in $$2(1+3n)+3(1-2n) = 5+6n-6n = 5$$
but I don't know how to derive the answer from the equation... also is there a name for algorithms to solve these integer function?
 [/INST] First you find a particular solution. Say $(x, y) = (1, 1)$.
Then you suppose that $2x + 3y = 5$ for some $(x, y)$
So
\begin{align}
   2x + 3y &= 2(1) + 3(1)\\
   2(x-1) &= -3(y-1)\\
\end{align}
Hence $2 \mid -3(y-1)$.
Since $2$ and $-3$ are relatively prime, we must have $2 \mid y-1$. That is $y - 1 = 2t$ for some integer $t$.
So $y = 2t + 1$ for some integer $t$.
Substituting this back into $2(x-1) = -3(y-1)$, we find $x = -3t + 1$.
What we have shown is that, if $(x, y)$ is a solution to $2x + 3y = 5$, then
$(x,y) = (-3t+1, 2t+1)$ for some integer $t$.
It is easy to verify that if $(x,y) = (-3t+1, 2t+1)$ for some integer $t$, then
 $(x, y)$ is a solution to $2x + 3y = 5$.
Hence $(x, y)$ is a solution to $2x + 3y = 5$, if and only if
$(x,y) = (-3t+1, 2t+1)$ for some integer $t$.
</s>