0

I have the following equation:

$px + qy = 1$

$p,q$ are coprime integers and $x,y$ are integers. Given a specific pair of $p,q$, I want to find a pair of integers $x,y$.

It was quite easy to prove that for any given $p,q$, there are infinitely many pairs of $x,y$.

One can also see that if $x_1, y_1$ works, $x_1 + nq, y_1 - np$ also works for any integer $n$. I have been racking my brains for weeks now, but I can't seem to find a way to find $x,y$ without bruteforce.

P.S: This is a problem I came up with by myself, so I don't know what (if any) textbook I could refer to.

Paddy
  • 457
  • You may wish to look up Bezout's Theorem. https://en.m.wikipedia.org/wiki/B%C3%A9zout%27s_identity – Robbie Dec 02 '21 at 23:21
  • 1
    That is one of the applications of the Euclidean algorithm, Bézout's identity https://en.wikipedia.org/wiki/Euclidean_algorithm#B%C3%A9zout's_identity – markvs Dec 02 '21 at 23:22
  • Nice! But at least the Wikipedia article does not seem to talk about the form $x$ and $y$ takes. – Paddy Dec 02 '21 at 23:27
  • The article explains the extended Euclidean algorithm. –  Dec 02 '21 at 23:31
  • 3
    Mathematics is so universal and timeless. You and Euclid 1000's of years apart pondering the same question. – tkf Dec 03 '21 at 00:06
  • @tkf: Euclid is much older. Malik Ayaz lived approximately 1000 years ago. – markvs Dec 03 '21 at 00:22

0 Answers0