# 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$$