# Complete square values of quadratic formula

For Which values of $$x \in [0,n]$$ the polynomial $$P(x)=ax^2+bx+c$$ $$\$$ gives a complete square value. For instance the polynomial $$P(x)=3x^2+5x+7$$ on the interval $$x \in [0,100]$$ has only two values for $$x=3 \rightarrow P(3)=49$$ and for $$x=54 \rightarrow P(54)=9025$$. I was wondering if there is a method to find such values of $$x$$ directly.

• are you familiar with Pell's equation? – J. W. Tanner Jan 17 at 22:05
• Anything to say about the answers you have received, Paul? – Gerry Myerson Jan 19 at 22:53
• It's not polite, Paul, to ask for help and then disappear when people help you. You've had three answers to your question. If you have found one of them does the trick, I encourage you to "accept" it by clicking in the check mark next to it. And if no answer is satisfying, please come back to let us know what more you need. – Gerry Myerson Jan 21 at 2:24

$$y^2=3x^2+5x+7$$.

$$12y^2=36x^2+60x+84=(6x+5)^2+59$$.

$$u^2-3v^2=-59$$ where $$u=6x+5$$, $$v=2y$$.

Given one solution of $$u^2-3v^2=-59$$, and a fundamental solution of $$u^2-3v^2=1$$, you can get infinitely many solutions of $$u^2-3v^2=-59$$, and from those infinitely many solutions of $$y^2=3x^2+5x+7$$.

Now a fundamental solution of $$u^2-3v^2=1$$ is $$u=2$$, $$v=1$$. A solution of $$u^2-3v^2=-59$$ is given by $$u=4$$, $$v=5$$. If you let $$a_n+b_n\sqrt3=(2+\sqrt3)^n(4+5\sqrt3)$$, $$n=1,2,3,\dots$$, then you'll get $$a_n^2-3b_n^2=-59$$. Then you can see which of those solutions yield integers for $$x,y$$.

So I will interpret this question as asking which integers $$x \in \mathbb{Z}$$ satisfy $$ax^2 + bx + c = y^2$$ for some $$y \in \mathbb{Z}$$.

In general there may be no such $$x, y$$. Consider for example $$a = -1$$, $$b=0$$ $$c = -1$$. Then the LHS is always negative, hence has no solutions, even in $$\mathbb{R}$$.

The name for this problem is determining whether a quadratic form has integer solutions, and has motivated a lot of modern number theory.

In particular, consider the following situation, when $$b=0$$ we are often concerned with finding integers $$c$$ represented by forms $$y^2- ax^2$$ (i.e., can be written in this was $$c = y^2 - ax^2$$). Even answering this question with $$c = 1$$ yields the problem of Pell's equation, and otherwise is the Generalised Pell's equation (you can read the wikipedia page for an overview).

You may be interested to know that to find rational solutions to this equation, it suffices to find a single solution - in which case one can "project away" from the point to find a rational parametrisation for this curve (viewing it in the $$(x,y)$$-plane).

I don't know how useful it gets with calculations, but if you let $$k\in \Bbb N$$, and set $$P(x)=ax^2+bx+c = k^2 ,$$ and rewriting it as an equation equaling zero $$ax^2+bx+c-k^2=0,$$ you can use the quadratic formula to find $$x= \frac{-b\pm \sqrt{b^2-4a(c-k^2)}}{2a}.$$ So in theory you should get solutions only of this type with $$k$$ natural number, in particular you need $$ak^2 \ge \frac{4ac-b^2}{4}.$$ I hope I answered you question, or at least helped a bit.