How would one solve a linear equation in two integer variables? 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?

The Euclidean algorithm is best for large numbers, but for a small example like this, trial and error, combined with a little modular arithmetic works just fine, and is less work.  Reducing $5a−12b=13$ modulo $12$, we have $a\equiv 1 \pmod{12},$ and $a\equiv 5 \pmod{12},$ by trial.  Then it's clear that $a=5,$ $b=1$ is a solution.
Alternatively, we might reduce modulo $5,$  getting $3b \equiv 3 \pmod{5},$ so $b\equiv 1 \pmod{5},$ and again we find that $b=1$ gives $a=5.$    
