# Positive integer solution of Diophantine equation $a^2+b^2=z^3$

We have this theorem (https://en.wikipedia.org/wiki/Sum_of_two_squares_theorem) which gives conditions on positive integer $$n$$ such that $$n=a^2+b^2$$. I was wondering if there exists any such $$n>1$$ which is also a perfect cube? In other words, we seek the solutions of Diophantine equation $$a^2+b^2=z^3$$.

We see $$a=b=z=2$$ is one of the solutions. I am interested in other positive non-trivial solutions with $$a\ne b$$.

• Any $n$ whose prime factorization has no prime $3$ mod $4$ to an odd power is a sum of two squares. This can be applied when $n=z^3$ to get restriction on $z^3,$ then on $z.$ – coffeemath Jan 1 at 2:08
• math.stackexchange.com/questions/334839/… – individ Jan 1 at 6:57

Consider $$b = ka$$ for some integer $$k > 1$$. Then we have

$$a^2 + b^2 = a^2 + \left(ka\right)^2 = \left(1 + k^2\right)a^2 = z^3 \tag{1}\label{eq1}$$

Now, if $$z = a$$, \eqref{eq1} would be true if

$$k^2 + 1 = a \tag{2}\label{eq2}$$

Thus, if $$k = 2$$ for example, then $$a = 5$$ and $$b = 10$$ giving

$$5^2 + 10^2 = 5^3 \tag{3}\label{eq3}$$

There are, of course, many other such similar examples. If you wish for $$a \neq z$$ as well, then you could also have, for example, that $$z = ga$$, for an integer $$g \gt 1$$, so $$1 + k^2 = \left(g^3\right)a$$, but there are no solutions for certain cases, such as $$g = 2$$.

More generally, if you wish to have other restrictions, such as that $$\gcd\left(a, b, z\right) = 1$$, then consider what coffeemath wrote in a comment to the question. In particular, any number $$n$$ is a sum of two squares if and only if all prime factors of $$n$$ which are $$\; 3 \mod 4 \;$$ have an even exponent in the prime factorization of $$n$$. This is stated and proven in Which Numbers are the Sum of Two Squares?. Thus, any $$z$$ with all prime factors which are $$\; 3 \mod 4 \;$$ having an even exponent in its prime factorization will work. My example of $$5$$ is basically the simplest such case involving positive integers.

As Mike Miller pointed out in the comments to this answer, there is a formula for the number of representations of a number as the sums of squares at Sums of squares function, although you might need to remove cases where it provides $$a$$ or $$b$$ to be $$0$$ as the question specifically is looking for only positive integer solutions.

• This is absolutely what I was looking for! Thanks! – ersh Jan 1 at 2:20
• There is also a nice formula here for the number of representations of $z$ as $a^2 + b^2 = z$, so you can even count solutions. Getting a formula to actually list out the solutions is much less likely. – user98602 Jan 1 at 3:03
• @ersh I believe the answer to your question is related to the formula that Mike Miller has provided, and which I have added to my answer. I'm not sure offhand what the parametric solutions would be, or even if they can be expressed in closed form for the general case, but it seems like a good place to start. Unfortunately, number theory is not my specialty (I got a master's in applied math almost 30 years ago but haven't done much higher level math since), so I don't know if I can help you much more than this. – John Omielan Jan 1 at 3:11
• John-- How is your "more general" solution more general than that of my comment? In both cases the primes $3$ mod $4$ should appear to even power. – coffeemath Jan 1 at 3:12
• @coffeemath Sorry, I misread your comment. I have corrected my answer accordingly. – John Omielan Jan 1 at 3:16

Above equation shown below:

$$a^2+b^2=z^3$$ -----(A)

I came across the parametric solution of equation (A) on the internet

and have written it below:

$$a=s(s^2-3t^2)$$

$$b=t(3s^2-t^2)$$

$$z=(s^2+t^2)$$

For $$(s,t)=(3,2)$$, we get:

$$9^2+46^2=13^3$$

• Sam-- Could you link to internet article where parametrization is given? – coffeemath Jan 1 at 6:30
• @coffeemath, I found this (emis.de/journals/GM/vol13nr2/andrica/andrica.pdf) where reference is also given to Sam's solution and and what S.I posted. – ersh Jan 1 at 16:30
• Sam-- That solution of your link says it's an infinite parametrized solution, not claiming it is all of them. – coffeemath Jan 1 at 17:48
• @cofeemath. The solution (identity) could be a general solution, but I have not come across a proof yet. Untill the day somebody comes up with a numerical solution that is not satisfied by the identity we may have to assume it is so. Just as, [(m^2-n^2)^2+(2mn)^2= (m^2+n^2)^2] is a general solution to the phytogorous equation – Sam Jan 1 at 23:17

$$a x^2 + b y^2 = z^3$$ $$a x^2 + b y^2 = z^5$$ $$a x^2 + b y^2 = z^7$$ $$...$$ https://youtu.be/WycaoCnKcU0