0

Is there some kind of algorithm that I can use to find the exact values for v, u, e and f so that I can solve for a and b in the equation below?

av + bu = 5

ae + bf = 9

If I were to apply random values to v, u, e and f, Most of the time, I am able to solve for a and b. But there are some times that I am not able to solve for a and b because the random values applied to v, u, e and f made the equation unsolvable (Haven't you guys encountered problems like this before where you can't solve for the unkown values of an equation because of its coefficients v,u,e and f?). Is there an exact method that I can use to initialize v, u, e and f so a and b is always solvable?

1 Answers1

1

These are two linear Diophantine equations. It is well known that $av+bu=5$ is solvable in $\Bbb Z$ if and only if $\gcd(u,v) \mid 5$, and similarly $ae+bf=9$ is solvable if and only if $\gcd(e,f)\mid 9$.

Reference:

How to find solutions of linear Diophantine ax + by = c?

Dietrich Burde
  • 130,978
  • If I were to apply random values to v, u, e and f, Most of the time, I am able to solve for a and b. But there are some times that I am not able to solve for a and b because the random values applied to v, u, e and f made the equation unsolvable (Haven't you guys encountered problems like this before where you can't solve for the unkown values of an equation because of its coefficients v,u,e and f?). Is there an exact method that I can use to initialize v, u, e and f so a and b is always solvable? – Emmanuel Feb 18 '21 at 11:50
  • Yes, see the answer. You will not able to solve the first equation if and only if $\gcd(u,v)$ is not dividing $5$, and similarly for the second equation. Note that this includes also the case $u=v=0$, or $e=f=0$. – Dietrich Burde Feb 18 '21 at 12:18
  • Please, what does gcd(u,v)∣5 mean? – Emmanuel Feb 18 '21 at 12:23
  • See the reference. For example, $u=2,v=6$, then the gcd is the greatest common divisor, namely $2$, which does not divide $5$. So $\gcd(2,6)\nmid 5$. But $\gcd(20,25)=5$, which divides $5$. – Dietrich Burde Feb 18 '21 at 12:25