Associated Topics || Dr. Math Home || Search Dr. Math

### Interesting Integer Problem with Diophantine Equations

```Date: 06/21/2005 at 11:19:09
From: Shamik
Subject: Number Theory: Finding out two positive numbers.....

Two positive integers are such that the difference of their squares is
a cube and the difference of their cubes is a square.

Find the smallest possible numbers that satisfy the same and a way to
find all such pairs of positive integers (a, b) that would work.

Let the two positive numbers be a and b, with a > b.  Now,
a^2 - b^2 = m^3 ==> (a+b)*(a-b) = m^3

It implies that (a-b) = m and (a-b)^2 = m^2. a = (m^2 + m)/2 and b =
(m^2 - m)/2.  Now, there would be an infinite series satisfying this
condition that follows:

m	a	b
------------------
1	1	0
2	3	1
3	6	3
4	10	6
5	15	10
6	21	15
7	28	21
8	36	28
9	45	36
10	55	45
and, so on.

But, a^3 - b^3 = n^2 => n^2 = (a-b)*(a^2 + ab + b^2)
= (m^2/4)*(3*m^3 + m)

So, {3*(m^3) + m} should be a square as (m^2/4) is of that form.  I am
completely stuck at this point.  Please, help me out.

I could find out the following by just trial and error.  The lowest
possible solution is (a,b) = (10,6)

10^2 - 6^2 =  64 = 4^3
10^3 - 6^3 = 784 = 28^2

But, I am nowhere near to finding a generic solution.

Thanks and regards, Shamik

```

```
Date: 06/21/2005 at 18:25:04
From: Doctor Pete
Subject: Re: Number Theory: Finding out two positive numbers.....

Hi Shamik,

If we have

a^2 - b^2 = m^3,  a > b > 0,

then

(a-b)(a+b) = m^3,

but I don't see how this implies a-b = m.  Indeed, for m = 3, we find
a = 14, b = 13, since

14^2 - 13^2 = (14-13)(14+13) = 27 = 3^3.

In fact for any positive integer k,

a^2 - b^2 = (2k+1)^3

a = 4k^3 + 6k^2 + 3k + 1,
b = 4k^3 + 6k^2 + 3k.

This includes a class of solutions to the first condition that is not
among those you mentioned.

- Doctor Pete, The Math Forum
http://mathforum.org/dr.math/

```

```
Date: 06/22/2005 at 00:40:31
From: Shamik
Subject: Number Theory: Finding out two positive numbers.....

Hi Doctor Pete,

Thanks for your reply.  It was a mistake that I overlooked the other
class of solutions.

As I was not able to proceed on pure mathematical grounds, I used
computer programming to get hold of a few answers.

Case (1): When a - b = 1, we have the following answers:

a                   b
------------------  ------------------
1                   0
296247805703169927  296247805703169926
354103272035509784  354103272035509783

Case (2): When (a - b) is NOT = 1, we have the following answers:

a              b
-------------  ------------
1             0
10             6
50005000      49995000
800020000     799980000
4050045000    4049955000
12800080000   12799920000
31250125000   31249875000
64800180000   64799820000
120050245000  120049755000
204800320000  204799680000
328050405000  328049595000

There are lots more of them.  Is there any mathematical way to arrive
at these answers?  Or is computer programming the only way we can
think of?  Please, give me some directions.

Thanks and regards, Shamik

```

```
Date: 06/23/2005 at 05:50:36
From: Doctor Pete
Subject: Re: Number Theory: Finding out two positive numbers.....

Hi Shamik,

I don't have an answer for you, but I have conducted my own computer
search and found the following solutions, which are minimal in the
sense that there are no other pairs (a,b) for which a^2 - b^2 = m^3
for m <= 1000:

(10, 6),
(640, 384),
(7290, 4374),
(8954, 5687),
(70434, 64350).

Notice that all but the first solution are not listed among any of the
ones you have found so far.

- Doctor Pete, The Math Forum
http://mathforum.org/dr.math/

```

```
Date: 06/30/2005 at 19:57:40
From: Doctor Vogler
Subject: Re: Number Theory: Finding out two positive numbers.....

Hi Shamik,

I thought I would say a few things about your question, such as how I
would attack it.  You have two simultaneous Diophantine equations

x^2 - y^2 = z^3
x^3 - y^3 = w^2.

Whenever you have a Diophantine problem like this, there are several

The first is:  Is there a solution?  If you can't find one, then you
try to prove that there is no solution.  But you already found the
solution (10, 6, 4, 28), so you know the answer to this question is yes.

In that case, you go on to the second question:  Are there only
finitely many solutions, or infinitely many?  If you think there are
only finitely many, then you try to find all of them, and then you try
to prove that you have all of them.  If you think there are infinitely
many, then you try to prove this, usually by either coming up with a
formula to get from one solution to a bigger solution, or by coming up
with a formula in terms of some variable n that gives a different
solution for every integer n.  Neither of those is possible for every
problem.  But it is for yours.

Finally, you try to show that your formula gives you all integer
solutions.  Again, this is not always possible.  For your problem, it
is easy to prove that any of the particular formulas I come up with
does NOT cover all of the solutions, simply by finding one not in the
list, but it is much harder to prove that there is no formula that
DOES cover all of the solutions.

As for answering the question of whether there are finitely many
solutions or infinitely many, it is helpful to have a computer try to
find some solutions.  Doctor Pete already listed off some

(10, 6),
(640, 384),
(7290, 4374),
(8954, 5687),
(70434, 64350),

and there are more; they just keep getting bigger.  So we might be led
to suspect that there are infinitely many solutions.  (We will see
later that this is true.)  Now let's start out by seeing what we can
say about ALL solutions.  At some point, we'll have to take a leap and
give up covering all of them, but it's good to see how far you can get
trying not to miss any (especially since you might miss all of the
solutions if you make too many assumptions too soon).  (Of course, you
have the infinitely many solutions (10n^6, 6n^6), but that seems like
cheating; in some sense that's only one solution.)

So let's see if we can find all integer solutions to

x^2 - y^2 = z^3.

The left side factors as

(x - y)(x + y) = z^3.

Now let's consider what x - y might be.  Let m = x - y.  (Notice that
x^3 - y^3 = w^2 >= 0 implies that m >= 0.  And m = 0 is always a
solution.)  Then

m(2x - m) = z^3.

So clearly m divides z^3.  What does that say about z?  Well, if m=1,
it doesn't mean anything.  But if m=2 or m=3, or if m is any
squarefree integer, then the only way that m can divide z^3 is if m
divides z.  But that's not true for m=4.  In general, if we let a be
the largest number whose cube divides m, then m/a^3 will be a product
of primes raised to the first and second powers.  If we group those
into two numbers c and b^2, then we have

m = a^3 * b^2 * c

where b and c are squarefree, relatively prime positive integers.  And
then m divides z^3 exactly when abc divides z.  So let

k = z/abc,

and then

2x - m = z^3/m
2x - a^3*b^2*c = k^3*b*c^2
2x = k^3*b*c^2 + a^3*b^2*c
x = bc(k^3*c + a^3*b)/2.

And this will be an integer exactly when b is even, or c is even, or a
and k have the same parity (both even or both odd).  And then

x = bc(k^3*c + a^3*b)/2,
y = bc(k^3*c - a^3*b)/2,
z = kabc.

Well!  We're making progress!  Now we have a nice expression for all
solutions to the first equation.  We let b and c run over all pairs of
relatively prime squarefree positive integers, and let a and k run
over all integers, and that will give us all solutions to the first
equation,

x^2 - y^2 = z^3.

Now we need to decide which of those solutions also provide solutions to

x^3 - y^3 = w^2.

So if we substitute our expressions for x and y into this equation,
and simplify, we get

a^3*b^4*c^3*(a^6*b^2 + 3c^2*k^6) = 4w^2.

That doesn't look pretty.  But right away we can say that

a^3*b^4*c^3 divides (2w)^2,

which tells us that a*b^2*c divides 2w.  In fact, since c is
squarefree, that means that a*b^2*c^2 divides 2w.  But then this
implies that (a*b^2*c^2)^2 divides the right side of the equation, and
we can already see that it divides the second term on the left side,
namely

a^3*b^4*c^3*(3c^2*k^6),

which means that it also has to divide the first term

a^3*b^4*c^3*(a^6*b^2),

which means that

c divides a^7*b^2.

But b and c are relatively prime, so that means that c divides a^7.
And c is squarefree, which means that this can only happen if c
divides a.  So if we let d = a/c, then we have

c^3*d^3*b^4*c^3*(c^6*d^6*b^2 + 3c^2*k^6) = (2w)^2,

and we find that

b^4*c^8*d^3 divides (2w)^2,

so that

r = 2w/(b^2*c^4*d)

is an integer.  Then our equation becomes

d(c^4*d^6*b^2 + 3k^6) = r^2.

Now we have the same kind of issue that we had before with m dividing
z^3; if d is squarefree, then d dividing r^2 implies that d divides r.
But if d is not squarefree, then it does not.  As before, we can write

d = s^2*t

where t is squarefree, by dividing by the largest possible square, and
then d dividing r^2 implies that st divides r.  So now we can write

r = stu,

and this turns our equation into

t*u^2 = b^2*c^4*t^6*s^12 + 3k^6.

The thing to do at this point is to use the fact that t must divide
3k^6.  But then you have to split into two cases, one for t divisible
by 3, and one for t not divisible by 3.  (In the second case, remember
that t is squarefree, so this implies that t divides k.  Very nice.)
But those two equations don't help us very much anyway, so I will stop
here and change gears.

If you want a program that will find all solutions, then I might
recommend starting with this equation (or the two cases, where t
divides k and where t/3 divides k).  Then substitute back to get x and
y.  This will allow you to get many more solutions with much smaller
numbers.  Also, it might be helpful to change

b^2 * c^4 * t^6 * s^12

back to a single number q^2, but the only trouble with this is that
you have to find the prime divisors of q whose exponents (in the prime
factorization of q) are 3, 4, or 5 mod 6, since the product of these
primes is the number t, which appears elsewhere in the equation.  Of
course, you only have to check primes up to m^(1/3), so this isn't all
that much work.

But now let's take a leap.  We suspect that there are infinitely many
solutions, so maybe we won't lose too many if we make an assumption
like t = 1.  When we do this, then we can factor the equation as

(u + b*c^2*s^6)(u - b*c^2*s^6) = 3k^6.

Now all we need to do is find some factor f of 3k^6, and set

g = 3k^6/f,

and then solve

u + b*c^2*s^6 = f
u - b*c^2*s^6 = g

for

u = (f + g)/2
b*c^2*s^6 = (f - g)/2.

In this case, we get

r = su = su
d = s^2
a = cd = cs^2
w = a*b^2*c^3*r/2 = b^2*c^4*s^3*u/2
x = (1/2)*b*c^2*(k^3 + b*c^2*s^6)
y = (1/2)*b*c^2*(k^3 - b*c^2*s^6)
z = b*c^2*s^2*m.

But then how will we know the factorization of f - g?  We need to be
able to distinguish s^6 from b*c^2, at least.  And we need that all of
the exponents of prime factors of f - g are 0, 1, or 2 mod 6 (and not
3, 4, or 5), since otherwise we wouldn't have t = 1.  But if we just
picked some random f and some random g, then it probably won't have
very many cubes dividing it.  So let's just suppose that f - g is
cubefree.  Then that gives us s = 1, and b*c^2 = (f - g)/2.  We
substitute that and get

x = (1/2)*(f - g)/2*(k^3 + (f - g)/2)
y = (1/2)*(f - g)/2*(k^3 - (f - g)/2)
z = k*(f - g)/2
w = (f - g)^2(f + g)/16

[(1/2)*(a - b)/2*(c^3 + (a - b)/2),(1/2)*(a - b)/2*(c^3 - (a - b)/2),
c*(a - b)/2,(a - b)^2*(a + b)/16]

Of course, we also need f and g to have the same parity (both even or
both odd) in order that these numbers be integers.  But now let's see
if we can find some factors f and g of three times sixth powers 3k^6,
and see what we get.

If we let f = 3n^2, g = n^4, k = n, then we get polynomials in n for
x, y, z, and w, namely

x = 1/8*n^8 - 1/4*n^7 - 3/4*n^6 + 3/4*n^5 + 9/8*n^4,
y = -1/8*n^8 - 1/4*n^7 + 3/4*n^6 + 3/4*n^5 - 9/8*n^4,
z = -1/2*n^5 + 3/2*n^3,
w = 1/16*n^12 - 3/16*n^10 - 9/16*n^8 + 27/16*n^6.

And these polynomials satisfy your two equations, which means that,
for any number n, they will still satisfy the equations.  The
coefficients are not all integers, but if you substitute n = 2m, then
you have all integer coefficients (so all even numbers give integer
results) and if you substitute n = 2m+1 then you have all integer
coefficients (so all odd numbers give integer results).  We can do the
same thing by substituting other combinations like f = 3n, g = n^5, k
= n (which gives integers results when n is odd or divisible by 4),
and f = 3n^6, g = 1, k = n (which requires n to be odd).  But you
might complain that all of these give polynomials in y with negative
leading terms, meaning that most y values will be negative.  If you
want positive values for y, then you can try something like f = 3n^6,
g = m^6.  You'll need n and m to be fairly close to one another (but
of the same parity), so try something like m = n + 2, or m = n + 4, or
something like m = 9h, n = 7h + 2, or something similar.  For example,
m = n + 2 gives you

x = n^12 - 6*n^11 - 39*n^10 - 62*n^9 + 306*n^8 + 2016*n^7 +
6000*n^6 + 11520*n^5 + 15264*n^4 + 13952*n^3 +
8448*n^2 + 3072*n + 512

y = 6*n^11 - 15*n^10 - 262*n^9 - 1314*n^8 - 4032*n^7 - 8688*n^6 -
13824*n^5 - 16416*n^4 - 14208*n^3 - 8448*n^2 - 3072*n - 512

z = n^8 - 4*n^7 - 42*n^6 - 140*n^5 - 280*n^4 - 336*n^3 -
224*n^2 - 64*n

w = n^18 - 9*n^17 - 45*n^16 - 12*n^15 + 1440*n^14 + 12276*n^13 +
63132*n^12 + 235584*n^11 + 676368*n^10 + 1534720*n^9 +
2787840*n^8 + 4068864*n^7 + 4751616*n^6 + 4386816*n^5 +
3133440*n^4 + 1671168*n^3 + 626688*n^2 + 147456*n + 16384

You might also find that most of your solution polynomials factor
nicely too.  Take any one of these, and then every integer n will give
you a different solution.  Well, there might be a few repeats, but
you'll still get infinitely many solutions.

back and show me what you have been able to do, and I will try to
offer further suggestions.

- Doctor Vogler, The Math Forum
http://mathforum.org/dr.math/

```

```
Date: 07/04/2005 at 04:23:40
From: Shamik
Subject: Thank you (Number Theory: Finding out two positive numbers.....)

Thank you very much.  The process you have shown is wonderful.  I was
on a leave away from computers so it took me some time to thank you.
I thank you very much.

Regards, Shamik

```

```
Date: 07/04/2005 at 12:23:19
From: Doctor Vogler
Subject: Re: Thank you (Number Theory: Finding out two positive
numbers.....)

Hi Shamik,

Here's another idea.  Recall that we started with

x^2 - y^2 = z^3, and
x^3 - y^3 = w^2.

And then we defined the variables

m = x - y,
m = a^3 * b^2 * c,

with b and c relatively prime squarefree and positive,

k = z/abc,

so that

x = bc(k^3*c + a^3*b)/2,
y = bc(k^3*c - a^3*b)/2,
z = kabc.

Then we defined the integer variables

d = a/c,
r = 2w/(b^2*c^4*d),
d = s^2*t

with t squarefree, and

u = r/st.

This finally left us with the equation

t*u^2 = b^2*c^4*t^6*s^12 + 3k^6,

and I suggested:

The thing to do at this point is to use the fact that t must divide
3k^6.  But then you have to split into two cases, one for t divisible
by 3, and one for t not divisible by 3.

The idea here is that if t is not divisible by 3, then we see that t
divides 3k^6, and therefore t divides k^6.  But since t is squarefree,
that means that t divides k.  Therefore,

m = k/t

is an integer, and then t^6 divides the right side of the equation,
which means that t^5 divides u^2, which means (since, again, t is
squarefree) t^3 divides u, so that

v = u/t^3

is an integer.  Then we have

tv^2 = b^2*c^4*s^12 + 3m^6.

The nice thing here is that no variable appears in more than one term.
That means that we can find all of the solutions where t is not
divisible by 3 in the following way.  Let b and c run over all
relatively prime squarefree positive numbers, and let s and m run over
all integers.  Compute the sum

b^2*c^4*s^12 + 3m^6

and then factor it into prime factors.  Let v be the largest square
divisor, and let t be the remaining squarefree part.  Then define

u = v*t^3,
k = m*t,
r = u*s*t,
d = t*s^2,
a = d*c,
w = (r*b^2*c^4*d)/2,
x = bc(k^3*c + a^3*b)/2,
y = bc(k^3*c - a^3*b)/2,
z = kabc.

And you can throw out all of those solutions where the division by 2
doesn't give you an integer.  This will give you all solutions where t
is not divisible by 3 (and perhaps some where it is, but you can throw
those out so as not to duplicate them in the next part).

Now what happens when t is divisible by 3?  Then we have t = 3*t', and
t' divides k^6, so t' divides k, and then t'^5 divides u^2, and now we
have

m = k/t'
v = u/t'^3
t'*v^2 = 3^5*b^2*c^4*s^12 + m^6.

Now we let b and c run over all relatively prime squarefree positive
numbers, and let s and m run over all integers.  Compute the sum

3^5*b^2*c^4*s^12 + m^6

and then factor it into prime factors.  Let v be the largest square
divisor, and let t' be the remaining squarefree part.  If t' is not
divisible by 3, then define

u = v*t'^3,
k = m*t',
t = 3*t',
r = u*s*t,
d = t*s^2,
a = d*c,
w = (r*b^2*c^4*d)/2,
x = bc(k^3*c + a^3*b)/2,
y = bc(k^3*c - a^3*b)/2,
z = kabc.

And this will give us all of the other solutions.  In each case, the
only hard part is the factoring.  But at least you only have to look
for primes up to the cube root of vt^2, since if p > N^(1/3) and p^2
divides N, then you would have already found and factored out

M = N/p^2 < N^(1/3).

- Doctor Vogler, The Math Forum
http://mathforum.org/dr.math/

```

```
Date: 07/05/2005 at 00:55:54
From: Shamik
Subject: Thank you (Number Theory: Finding out two positive numbers.....)

Doctor Vogler,

Thank you very much.  I am in a position to understand your excellent
approach but then this is the first time I am learning the process.  I
couldn't have contemplated going in the direction that you have
described.  Thank you once again.

Regards, Shamik
```
Associated Topics:
College Number Theory

Search the Dr. Math Library:

 Find items containing (put spaces between keywords):   Click only once for faster results: [ Choose "whole words" when searching for a word like age.] all keywords, in any order at least one, that exact phrase parts of words whole words

Submit your own question to Dr. Math
Math Forum Home || Math Library || Quick Reference || Math Forum Search