Possible Solutions for $x_0=\frac{c-by_0}{a}$ with $c-by_0$ multiples of $a$

78 Views Asked by At

I am trying to solve equations where I am to use the formula $x_0=\dfrac{c-by_0}{a}$ with $c-by_0$ being a multiple of $a$, in which I would be given values for $c, b \text{ and } a$. How can I find values for $y_0$ ensuring that $c-by_0$ is a multiple of $a$?

For example: $$x_0=\frac{2-4y_0}{21}$$

For what values of $y_0$ is $2-4y_0$ a multiple of $21$? Is there an equation form I can use to solve this?

1

There are 1 best solutions below

0
On BEST ANSWER

If $\gcd(a,b)\not\mid c$, then there is no such $y_0$.

If $\gcd(a,b)\mid c$, then there exists an integer $k$ such that $c=k\gcd(a,b)$. By Bézout's identity, there exist integers $s,t$ such that $as+bt=\gcd(a,b)$ where $s,t$ can be computed by the extended Euclidean algorithm. Multiplying the both sides by $k$ gives $$ask+btk=c,$$ i.e.$$sk=\frac{c-btk}{a}$$ Now, take $y_0=tk$.