# Prove that $p^2 - 4qr$ ($p,q,r$ odd natural numbers) is never a perfect square

The givens for the question: $p, q, r$ are odd natural numbers. We need to prove that $p^2 - 4qr$ is never a perfect square.

Inspecting a few examples it seems to be true, but I have no idea where to start. What approach would one use?

• You should learn how to format for math, it's not that hard, all I had to do was to add eight dollar signs to your post to fix it. – Gregory Grant Jul 26 '16 at 19:08

## 7 Answers

Suppose to the contrary that $p^2-4qr=x^2$, where $x$ is an integer. Then $p^2-x^2=4qr$.

It is clear that $x$ must be odd. So $p^2\equiv 1\pmod{8}$ and $x^2\equiv 1\pmod{8}$, and therefore $p^2-x^2$ is divisible by $8$. But $4qr$ is not divisible by $8$.

This is equivalent to proving that for odd $m$, if $4|n^2-m^2$ then $8|n^2-m^2$.

This is easy if we notice $n^2-m^2=(n+m)(n-m)$, and if one of them is even, both are even, and also, one is a multiple of $4$.

• Yes yes, I realized this when I was showering :) Thank you though. – Jorge Fernández Hidalgo Jul 26 '16 at 19:21

A little culture. If $p^2 - 4 q r$ were a perfect square, then we would be able to factor $$qx^2 + p x + r$$ over the integers as $$qx^2 + p x + r = ( q_1x + r_1) (q_2 x + r_2);$$ see Prove that if $b^2-4ac=k^2$ then $ax^2+bx+c$ is factorizable or Formula for factorization of a Quadratic Equation?

However, $$( q_1x + r_1) (q_2 x + r_2) = q_1 q_2 x^2 + (q_1 r_2 + r_1 q_2)x + r_1 r_2,$$ while $(q_1 r_2 + r_1 q_2)$ is even, so it cannot be equal to $p.$

• Works easier with a monic polynomial - see my answer. – Bill Dubuque Jul 26 '16 at 20:40
• @BillDubuque sure. On the other hand, there are still plenty of kids here who cannot factor $ax^2 + bx + c$ even though they can, more or less, use the quadratic formula and get the correct roots and observe when those are rational. I like to publicize that it (factoring) can be done using nothing worse that $\gcd,$ bit of wasted crusade I suppose. +1 for your answer. – Will Jagy Jul 26 '16 at 22:23
• Agreed. That's why I try to often emphasize the ideas behind the AC-method, which is often taught as a mechanical rule, completely devoid of intuition. – Bill Dubuque Jul 26 '16 at 22:33

And now a strange solution. Assuming that $p^2-4qr$ is a square, the polynomial $$s(x)= qx^2 + px + r$$ has to be reducible over $\mathbb{Q}$. However, $x^2+x+1$ is irreducible over $\mathbb{F}_2$, hence that cannot happen.

If $p,q,r$ are odd then $p^2-4qr$ is odd. So if $p^2-4qr=s^2$ then $s$ must be odd. But $4qr=(p-s)(p+s)$ The LHS is divisible by $4$ and not $8$, the RHS is divisible by $8$ because one of $p+s$ or $p-s$ is divisible by $2$ and the other by $4$.

If it's square, $x^2\! + p x\! +\! qr\,$ has odd integer roots (factors of odd $qr),\,$ contra root sum ${-}p\,$ is odd

• Or, by the Parity Root Test $\,f(x)\,$ has no roots mod $\,2\,$ (i.e. $\,f(0) \equiv 1\equiv f(1)),\,$ so no integer roots. The above polynomial arises by monicizing $\,qx^2\!+px+r\,$ via the AC method. – Bill Dubuque Jul 26 '16 at 20:20
• @Babai Please do not make such radical edits. Instead you can post your own answer elaborating on mine if you so desire. You can recover your edit from the revision history (click "on edited x mins ago") – Bill Dubuque Jul 26 '16 at 20:43
• That was not a radical edit, rather it was a expanded version of your answer. Your answer is excellent. But I don't understand why you think the edit has totally changed the answer. I thought the detailed answer I edited would have helped students to understand it in a better way. – Babai Jul 26 '16 at 20:45
• @Babai generally, I prefer not to include all the minor details but rather to highlight the essence of the matter (which is often obfuscated by treating sundry minor details). If you think that posting further details will help some readers then you are quite welcome to post another more elaborated answer. That's fine by me. – Bill Dubuque Jul 26 '16 at 20:50

$p^2$ is congruent to $1$ mod $8$ (it is equal to $8k+1$ for some $k$) but

$4qr$ is congruent to $4$ mod $8$ (it is $8m+4$ for some $m$).

Therefore the difference of those two expressions is $(1 - 4) = 5$ mod $8$ which is not the value of any perfect square mod $8$.