# Finding a perfect square within an interval

I have a function $$f(x) = 4x^2 + 4ax + b$$ where $$a$$ and $$b$$ are both even numbers. I also have an interval within which there are only two integers $$x$$ that will result in a perfect square. $$a$$, $$b$$, and the larger of the two perfect squares are known.

Is there some way that does not involve prime factorization to find or get a rough estimate of what value $$x$$ will result in the smaller perfect square?

Let us call these two values of $$x, \ x_1$$ and $$x_2$$, being the larger of the two. Then as $$x_2$$ is known, we can write that $$x_1=x_2-m$$ for some integer $$m$$. Then we get that we know $$f(x_1)$$ to be a perfect square we get that $$f(x_2-m)$$ is also a perfect square. $$f(x_2-m)=4(x_2-m)^2+4a(x_2-m)+b=4m^2-(8x_2+4a)m+(4x_2^2+4ax_2+b)$$ which is a quadratic in $$m$$. Solve this for $$m$$ to be in your known interval and you have $$x_1$$

• Maybe I'm missing something, but don't quadratic equations work on the assumption that the equation equals 0? Since this equals the perfect square I'm looking for, I would have to subtract that square from the equation first. That means I'd have to know the answer to find the answer, no? – strogre May 9 '19 at 22:30
• If it is a perfect square, you can complete the square as it were, and you know that the remaining term is 0 – W M Seath May 9 '19 at 22:43