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

Given a natural number $n$, find inegers $a, b$ such that $n^3=a^2-b^2$. I've tried, but I'm a bit rusty. Please Help

share|cite|improve this question
Are you trying to characterize the numbers $n$ whose cubes are equal to a difference of squares? – Dimitrije Kostic Nov 24 '11 at 18:03
Nope, given the natural number I just want to find two integers that satisfy the equation above. Not interested in finding them all. – Sak Nov 24 '11 at 18:10
What natural number $n$ are you talking about? – Dimitrije Kostic Nov 24 '11 at 18:17
Hint: $a^2-b^2=(a-b)(a+b)$. How can you make this product exactly $n^3$? – N. S. Nov 24 '11 at 18:25
@Dimitrije Kostic It is possible to do it for ALL numbers. – N. S. Nov 24 '11 at 18:26
up vote 6 down vote accepted

Note that $$n^3=\left(\frac{n^2+n}{2}\right)^2-\left(\frac{n^2-n}{2}\right)^2.$$

Comment: The magic identity that solved the problem in fact did not (for me) come by magic. Given a number $K$, we want to find numbers $a$ and $b$ such that $a^2-b^2=K$. So we want $(a+b)(a-b)=K$. This means that $a+b$ and $a-b$ are two integers whose product is $K$.

Suppose that $x$ and $y$ are any two integers whose product is $K$. If we set $a+b=x$ and $a-b=y$, then we will have $(a+b)(a-b)=K$. But will $a$ and $b$ be integers?

Solve the system $a+b=x$, $a-b=y$. Algebra gives $a=\frac{x+y}{2}$, $b=\frac{x-y}{2}$. In order to make sure that $a$ and $b$ are integers, $x+y$ (and therefore $x-y$) must be even. This means that $x$ and $y$ have to be of the same parity (both odd or both even).

Can we express $n^3$ as a product of two numbers of the same parity? If $n$ is odd, we can use $x=n^3$, $y=1$. That won't work if $n$ is even. But $x=n^2$, $y=n$ always works, because $n^2$ and $n$ have the same parity.

In general, the integer $K$ is a difference of two squares unless $K$ is even but not divisible by $4$. So $\pm 2$, $\pm 6$, $\pm 10$, $\pm 14$, and so on cannot be expressed as a difference of two squares, and everybody else can be.

share|cite|improve this answer
@Andres: I wanted to point something out: Recall that we have the surprising identity $$\sum_{k=1}^n k^3=\left(\sum_{k=1}^n k\right)^2 =\left(\frac{n^2+n}{2}\right)^2.$$ A short proof of follows from your above identity, along with using the fact that the series telescopes. – Eric Naslund Nov 24 '11 at 19:38
Nice observation! It gives an attractive explanation of the sum of cubes formula. Alternately, we have the combinatorial version $\binom{n+1}{2}^2-\binom{n}{2}^2=n^3$. – André Nicolas Nov 24 '11 at 20:05

If $n$ is odd, then $a=(n^3+1)/2$ and $b=(n^3-1)/2$ will work. If $n$ is even, then $a=(n^3+2)/2$ and $b=(n^3-2)/2$.

share|cite|improve this answer

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.