Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

How to solve this eqution

  1. Aug 17, 2005 #1
    I need to solve this kind of equqtions

    [tex]x^2-y^2+ax-by = c [/tex]

    a,b,c are know.I want to find out x & y.

    a,b & c are positive integers

    I need only positive x & y pairs in integers.
    Last edited: Aug 17, 2005
  2. jcsd
  3. Aug 17, 2005 #2


    User Avatar
    Science Advisor
    Homework Helper

    Complete the square for both x and y and you will see that the set of points satisfying the equation form either an ellipse or hyperbola depending on the values of a, b and c.If you need to you can compare the equation with one of the standard forms to determine foci, major & minor radii and so forth.

    In any case, you can simply solve the given equation or a simplified version of it for either x or y in terms of the other variable and substitute values of one into the solution to find the corresponding values of the other variable.
  4. Aug 17, 2005 #3
    Thus we have
    (x+a/2)^2 -(y+b/2)^2 = c + (a^2-b^2)/4
    (x+a/2-y-b/2)*(x+a/2+y+b/2) = c + (a^2 -b^2)/4
    These two factors differ by 2y+b
    To reduce typing let s= x+a/2-y-b/2 and t = x+a/2+y+b/2
    then t-s=2y+b

    Case 1 = b and a are both odd. Then the two factors must be of opposite parity, i.e. x and y are of opposite parity. Let P = the odd part of c+(a^2-b^2)/4 then c+(a^2-b^2) = 2^k*P where k>1. From Euclid's lemma and the fact that the above factors are both integers of opposite parity, there are only two possibilities.
    1a s = 2^k*N where N divides P and t = P/N or
    2a t = 2^k*N where N divides P and s = P/N
    We need only to factor P. As an example, let P = 15 = 1*3*5 then for each of 1a and 2a there are 4 possibilities that have to be eliminated: N=1,3,5,or 15. With each choice y = (t-s-b)/2 from which x can be calculated and we can varify whether or not x and y are both positive.

    I think the case where a and b are both even is similar to case 1. However, s and t, i.e. x and y, must be of the same parity

    Case 2, a and b are of opposite parity
    Multiply both sides by 4 to get
    (2x+a-2y-b)*(2x+a+2y+b) = 4c+a^2-b^2 = s*t
    here t-s = 4y-2b

    This can be rewritten as s*t = P where P is odd, Factor P as N and P/N. For instance let s= 1,3,5,or 15 and t equal 15,5,3,1 respectively for P = 15. The solution continues as for case 1: first solving y = (t-s-2b)/4 and then solving t= 2x+a+2y+b for x.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook