Best way to solve a first degree equation with multiple variables

323 Views Asked by At

I would like to solve a first degree equation with multiple variables (not a system of equations) like :

10x + 5y + 7z = 630

Is there any way to solve it without using bruteforce?

Solutions must be integers.

2

There are 2 best solutions below

3
On

No you can't, you have an infinity of solutions in this case.

To solve such problem you shoud have a system with at least the same number of equations as the number of variables.

Another trick, in some cases you could solve it as an underdetermined system.

2
On

Regroup the first two terms as 10x+5y = 5(2x+y) = 5t.

Then t/7 + z/5 = 18.

As 5 and 7 are relative primes, t = 7k and z = 5(18-k), where k is abritrary.

Finally, y = t - 2x = 7k - 2x, where x is arbitrary.

As we can check,

10 x + 5 (7k - 2x) + 7 5 (18-k) = 630.