1 equation, 2 unknowns, need integer solution

  • Thread starter Thread starter Fellowroot
  • Start date Start date
  • Tags Tags
    Integer Unknowns
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
6 replies · 17K views
Fellowroot
Messages
92
Reaction score
0

Homework Statement



I needed to solve this single equation with two unknowns.

199x - 98y = -5

0< x <=99
0< y <=99

I typed the equation into Wolfram Alpha and got an integer solution of:

x = 98n + 31
y = 199n +63 when n is an integer

Since I know my restriction on x and y I can conclude that my solution is:

x = 31
y = 63 when n = 0

My question is, how do I obtain that integer solution that Wolfram Alpha gave me?

[edit, changed the + to a - sign from an error Ray Vickson pointed out, thanks.]
 
Last edited:
Physics news on Phys.org
Fellowroot said:

Homework Statement



I needed to solve this single equation with two unknowns.

199x + 98y = -5

0< x <=99
0< y <=99

I typed the equation into Wolfram Alpha and got an integer solution of:

x = 98n + 31
y = 199n +63 when n is an integer

Since I know my restriction on x and y I can conclude that my solution is:

x = 31
y = 63 when n = 0

My question is, how do I obtain that integer solution that Wolfram Alpha gave me?

There is something wrong with your question. If x and y are integers >= 1, then 199x + 98y is >= 207, so can't be equal to -5.

RGV
 
Ray Vickson said:
There is something wrong with your question. If x and y are integers >= 1, then 199x + 98y is >= 207, so can't be equal to -5.

RGV

Sorry, it was supposed to be:

199x - 98y = -5
 
How about solving for y and then graphing it, and looking for where the line crosses two integers?
 
Since the GCD of 99 and 198 is 1, there are integers x and y such that

99 x + 198 y = 1

You can find x and y by several methods, such as the Extended Euclidean Algorithm

http://en.wikipedia.org/wiki/Extended_Euclidean_algorithm

Then 99 (-5x) + 198 (-5y) = -5

That gives you one solution, not necessarily in the acceptable range, but maybe you can use that to find others.
 
Its a common linear diophantine equation. Go search for it :)