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$.

  • 4
    $\begingroup$ 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.$ $\endgroup$ – coffeemath Jan 1 at 2:08
  • 2
    $\begingroup$ math.stackexchange.com/questions/334839/… $\endgroup$ – 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.

  • $\begingroup$ This is absolutely what I was looking for! Thanks! $\endgroup$ – ersh Jan 1 at 2:20
  • 1
    $\begingroup$ 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. $\endgroup$ – user98602 Jan 1 at 3:03
  • 1
    $\begingroup$ @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. $\endgroup$ – John Omielan Jan 1 at 3:11
  • 3
    $\begingroup$ 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. $\endgroup$ – coffeemath Jan 1 at 3:12
  • 2
    $\begingroup$ @coffeemath Sorry, I misread your comment. I have corrected my answer accordingly. $\endgroup$ – 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:




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


  • 1
    $\begingroup$ Sam-- Could you link to internet article where parametrization is given? $\endgroup$ – coffeemath Jan 1 at 6:30
  • $\begingroup$ @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. $\endgroup$ – ersh Jan 1 at 16:30
  • $\begingroup$ Sam-- That solution of your link says it's an infinite parametrized solution, not claiming it is all of them. $\endgroup$ – coffeemath Jan 1 at 17:48
  • $\begingroup$ @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 $\endgroup$ – 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


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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