Take the 2-minute tour ×

Suppose that some nonzero integer $x$ is $x = pa + qb$ where $p, q, a, b$ are also nonzaero integers.

What would be the easy way to find another decomposition of $x$ into following: $x = ra + sb$ where $a, b$ are the equal $a, b$ in the previous case and $r and s$ are free to be set (= are not fixed numbers)?

share|improve this question
add comment

3 Answers

up vote 0 down vote accepted

Plug in the new translated integers

$p\rightarrow p+d_1$

$q\rightarrow q+d_2$

to get

$x=(p+d_1)a+(q+d_2)b=x+(d_1 a+d_2 b),$

i.e. you want to solve

$d_1 a+d_2 b=0,$

and so

$d_1=b\ n$

$d_2=-a\ n$

for some $n$, which you choose to make every number in the system an integer.

share|improve this answer
add comment

Let $d$ be the gcd of $a$ and $b$, let $a=da'$, $b=db'$. Use $$r=p+tb', \qquad s=q-ta',$$ where $t$ is any integer.

share|improve this answer
add comment

If $x = p a + q b$ and also $x = r a + s b$, then $(r - p) a = (q - s) b$. You could take $r = p + k b$ and $s = q - k a$ for any integer $k$ (and these will be all the possibilities if $\gcd(a,b) = 1$).

share|improve this answer
add comment

Your Answer


