1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

1 equation, 2 unknowns, need integer solution

  1. Sep 10, 2011 #1
    1. The problem statement, all variables and given/known data

    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: Sep 10, 2011
  2. jcsd
  3. Sep 10, 2011 #2

    Ray Vickson

    User Avatar
    Science Advisor
    Homework Helper

    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
     
  4. Sep 10, 2011 #3
    Sorry, it was supposed to be:

    199x - 98y = -5
     
  5. Sep 11, 2011 #4
    How about solving for y and then graphing it, and looking for where the line crosses two integers?
     
  6. Sep 11, 2011 #5

    phyzguy

    User Avatar
    Science Advisor

    These are called Diophantine equations:
    http://en.wikipedia.org/wiki/Diophantine_equation#Linear_Diophantine_equations
    I don't think there is a general method for finding solutions - with relatively small numbers like this, the quickest way is to simply exhaustively search through the allowed integers and see if there are any solutions.
     
  7. Sep 11, 2011 #6
    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.
     
  8. Sep 12, 2011 #7
    Its a common linear diophantine equation. Go search for it :)
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: 1 equation, 2 unknowns, need integer solution
Loading...