Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Prove or disprove the claim that there are integers $n,m, 0<n<m$ such that $m^2 +mn+n^2$ is a perfect square.

share|cite|improve this question
You can weaken the restriction to $0<n\le m$ since if $m=n$ the expression is $3m^2$ which cannot be square. – vadim123 Dec 15 '13 at 21:54
Is this a homework question? What work have you done on it so far? – Hovercouch Dec 15 '13 at 21:55
Hovercouch: This is sort of homework. The original was with m and n being integers. Then it's easy to prove it as m=-n or m or n being 0 yields a square number. But I was curious about this modified version. I thought it should be easy but maybe because I'm getting tired but I couldn't prove it so far. – elang Dec 15 '13 at 22:02
I deleted a (wrong) proof I had to the contrary. I will put it here instead: View the expression as a polynomial in $\mathbb{Z}[m]$. If it is irreducible over $\mathbb{Q}$, clearly it cannot be factored as a perfect square. If we reduce modulo $2$, we find that $n$ is even, otherwise the polynomial is irreducible. Similarly, we can find the $m$ is even. We can then factor a $4$ out of the whole expression, and we must still get a perfect square (since $4$ is a perfect square itself). Let $m' = m/2$ and $n' = n/2$. We get that $m'^2 + m'n' + n'^2$ is also a perfect square. Repeat to infinity. – Eric Thoma Dec 15 '13 at 22:10
up vote 3 down vote accepted

For instance, let $m=5$ and $n=3$.

Remark: Here is a beginning to a general analysis. We want $x^2+xy+y^2$ to be a perfect square. It is easier to multiply by $4$, and solve $4(x^2+xy+y^2)=z^2$. Complete the square. So we want $(2x+y)^2+3y^2=z^2$. More generally look for solutions of $u^2+3v^2=z^2$. To produce solutions, we take a reasonable $v^2$, and express $3v^2$ as a difference of squares.

Added: In a comment OP asked whether there are infinitely many (relatively prime) pairs $(m,n)$.

Let $n$ be odd. Note that $$\left(\frac{3n^2-1}{2}\right)^2 + 3n^2=\left(\frac{3n^2+1}{2}\right)^2.$$ So if $2m+n=\frac{3n^2-1}{2}$, then the pair $(m,n)$ should do the job. That gives $m=\frac{3n^2-2n-1}{4}$. (It is easy to check that $3n^2-2n-1$ is divisible by $4$).

This by no means produces all pairs $(m,n)$ with the desired property.

share|cite|improve this answer
Thanks! I was so convinced that there are no such numbers that I didn't even try to look for counterexamples. No wonder I couldn't prove it. :-) – elang Dec 15 '13 at 22:07
How difficult would be to try to answer the question if there are infinite many m,n pairs that satisfy the claim? – elang Dec 15 '13 at 22:10
I happen to have sketched an approach. Of course there are infinitely many in a trivial way, $5k,3k$. But there are also infinitely relatively prime pairs. – André Nicolas Dec 15 '13 at 22:13
Thanks Andre! :-) – elang Dec 15 '13 at 22:22
You are welcome. I have added an explicit way to produce infinitely many examples. For instance take $n=5$. We get $m=16$, and $m^2+mn+n^2=19^2$. – André Nicolas Dec 15 '13 at 22:36

Hint $\rm\ \ A^2 + AB+ B^2 = (a^2+ab+b^2)^2\ $ for $\rm\ A = a^2-b^2,\,\ B = b^2 + 2ab$

This arises from the norm-multiplicativity $\rm\ N(\alpha^2) = (N(\alpha))^2\ $ for $\alpha$ an Eisenstein integer.

share|cite|improve this answer
Thanks this was really useful. – elang Dec 15 '13 at 22:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.