# Given quadratic equation how are the integer solutions found?

1. Apr 25, 2015

### curiouschris

Not homework but given the question it probably fits here best

Given the following equation
$$x^2+138x+317=y^2$$
How do you find the integer solutions?

For example wolframalpha has the solutions. but I cannot see how they are derived
http://www.wolframalpha.com/input/?i=x^2+138x+317=y^2

By completing the squares and setting $y$ to $0$ I get the x intercepts

$$x^2+138x+317=y^2$$ ... $$x+69=+/-sqrt(4444)$$ $$x=-69+/-sqrt(4444)= -2.34\ or\ -135.66$$
But I don't understand how to take it further!

How do I calculate the integer solutions that WolframAlpha shows?

2. Apr 25, 2015

### SammyS

Staff Emeritus
It looks like you completed the square correctly.

After completing the square, you can write the equation as:
$\displaystyle\ (x+69)^2-y^2=4444 \$​

Do you recognize that equation?

3. Apr 25, 2015

### curiouschris

Hi Sammy

No I don't recognise it. As explained this is not homework just personal research. From my research it looks like Fermat's theorem.
So...
$$(x+69)^2-y^2 = (x+69+y)(x+69-y)=4444$$
Is that correct?
My problem is I can't make sense of the 4444! The actual n value should be 1111 and I am looking to only solve it at the simple factor of $1111 * 1$

I seem to have missed a step but I don't know what that step is :(

Do I divide both sides by 4? and where did the 4 come from...

4. Apr 25, 2015

### haruspex

Yes, that's what you needed to do. You have two integer factors on the left. How can they lead to the number on the right? There are only so many possibilities.

5. Apr 25, 2015

### SammyS

Staff Emeritus
harupex is better prepared to work with you on this than I am.

I just wanted to get you started.

6. Apr 26, 2015

### curiouschris

So

$$(x+69)2−y2=(x+69+y)(x+69−y)= 4444 = 4 * 1111 = 1 * 4444$$

is valid and for 1 solution I just need to find combinations of $x$ and $y$ where $x+y=-65$ and $x-y=1042$?

Hmmm ok it makes my next problem a little harder I need to code that as an excel macro

7. Apr 26, 2015

### haruspex

Yes, but what about other factorisations?
I don't follow. Where are you getting those numbers from?
Not sure how to factorise using Excel. Google for it.

8. Apr 26, 2015

### curiouschris

The numbers are from the factors $4$ and $1111$ which have the product $4444$

$$(x+y+69)=4=(x+y)=4-69=-65\ and\ (x-y+69)=4=(x-y)=1111-69=1042$$
Isn't this correct? If not then I have missed something.

In this instance I am only interested in the largest number which in this case is $1111$.

9. Apr 26, 2015

### haruspex

Ok, I see where you get those numbers, but they won't give you integer solutions.
Think about the parities of the two terms on the left. Can x+y be odd but x-y even?

10. Apr 26, 2015

### Staff: Mentor

There are more possible factorizations of 4444. Some of them will lead to integer solutions.

11. Apr 26, 2015

### curiouschris

Oops an erroneous $=4$ in that lot.
Never thought about odds and evens. Like signs its something I always forget :( so the sum of an odd and an even can never be an even
$$(x-y+69)=2=(x-y)=2-69=-67\ and\ (x+y+69)=2222=(x+y)=2222-69=2153$$
Is that better?

So working that through
$$( 2153 - 67 )/2 = 1043$$
$$( 2153 - 1043 ) = 1110$$
so 1 possible solution is
$$x=1043: y=1110$$

Have I done this correctly?

12. Apr 26, 2015

### haruspex

Yes, that looks right. Earlier you said you were only interested in the largest number, but I'm not sure what you meant by that. Do you mean the largest possible value of x or y?

13. Apr 26, 2015

### curiouschris

Thanks haruspex for all your help, Sammys and mfb too.

The largest integer number I am interested in is a semiprime. In this case the semiprime is 1111. That's why 4444 threw me. Why did the equation complete to 4444 when I was actually thinking it should have completed to 1111?

Its starting to make sense to me why by completing the squares I got a number different from what I was expecting. I know I am a long way from complete understanding.

Being a semiprime I know that factoring (when its large enough) its only two prime factors is computationally expensive. so I am trying to avoid that. The answers I managed to derive above with your help are exactly what I am looking for.

14. Apr 27, 2015

### Staff: Mentor

$$(x-y+69)=2=(x-y)=2-69=-67\ and\ (x+y+69)=2222=(x+y)=2222-69=2153$$
Be careful with equal signs. This would imply 2=-67 and 2222=2153 which is clearly wrong.

Yes, if your factors have more than 20-25 digits it starts to take some time. Factorizing 1111 is trivial.

15. Apr 28, 2015

### curiouschris

Haha I see what you mean. I'll be more careful next time thru