For example, how would I find integers $a$ and $b$ that satisfy the following equation?
$$5a - 12b = 13$$
I always resorted to trial and error when doing something like this and more often than not I would finally reach my answer. But for this one I just kept going and going to no avail. So it finally brought about the concern that trial and error wasn't always going to work.
So what would be the best way to get two integer solutions to the above equation?
Guide:
Since we know that $5$ and $12$ are coprime, use Eucliean Algorithm to find $x, y \in \mathbb{Z}$ such that $$5x+12y = 1$$
After which, multiply the equation by $13$.
In general to solve for $$Aa-Bb=C$$ where $A,B, C$ is given.
Use euclidean algorithm to find $\gcd(A,B)=D$, if $D$ doesn't divide $C$, then there is no integer solutions. Otherwise, express $D$ as a linear combination of $A$ and $B$ and multiply the equation to get a particular solution.