0
$\begingroup$

Given $x,y,z$ and knowing that all variables are integers, how could one uniquely solve:

$$xa-yb = z$$ ($\text{mod}\; xy$, of course).

I came across this when trying to solve a modulo question on a competition and I realized I always just guessed when I had the answer down to that form and it worked.

1 Answers 1

0

Apply the extended Euclidean Algorithm; see Wikipedia

First solve ax + by = d where d is the GCD, then multiply by z/d to get the solutions to ax + by = z.

  • 0
    Can you explain how you would apply it, given arbitrary $x,y,z$?2017-02-17