1 equation, 2 unknowns, need integer solution

  • Thread starter Thread starter Fellowroot
  • Start date Start date
  • Tags Tags
    Integer Unknowns
Click For Summary
The discussion centers on solving the equation 199x - 98y = -5 for integer solutions within the constraints 0 < x <= 99 and 0 < y <= 99. An initial solution was found using Wolfram Alpha, yielding x = 98n + 31 and y = 199n + 63 for integer n, leading to the specific solution of x = 31 and y = 63 when n = 0. However, a participant pointed out that the equation must be correctly stated as 199x - 98y = -5, as the original formulation was incorrect. Suggestions for finding integer solutions included graphing the equation and using methods like the Extended Euclidean Algorithm. The conversation highlights the nature of Diophantine equations and the search for integer solutions.
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 :)
 

Similar threads

  • · Replies 8 ·
Replies
8
Views
2K
Replies
2
Views
3K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 20 ·
Replies
20
Views
2K
  • · Replies 24 ·
Replies
24
Views
4K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 35 ·
2
Replies
35
Views
6K
Replies
3
Views
3K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 14 ·
Replies
14
Views
3K