TITLE: Understanding Euler's Sums of Cubes Substitution:
QUESTION [7 upvotes]: Distant relationship with this post.
In Euler's proof for $A^3+B^3+C^3=D^3$, he started with $$p(p^2+3q^2)=s(s^2+3r^2)\tag1$$
And made the substitution $\color{red}{p=ax+3by,q=bx-ay,s=3cy-dx,r=dy+cx}$ to get it into$$(a^2+3b^2)(x^2+3y^2)(ax+3by)=(d^2+3c^2)(x^2+3y^2)(3cy-dx)\tag2$$$$\beta(ax+3by)=\gamma(3cy-dx)\tag3$$
With $\beta=a^2+3b^2,\gamma=3c^2+d^2$.

Euler even made another substitution. Starting with $(3)$, substitute $\color{blue}{x=-3nb\beta+3nc\gamma,y=na\beta+nd\gamma}$.

Question: How did Euler know to substitute $p=ax+3by,q=bx-ay,s=3cy-dx,r=dy+cx$ and $x=-3nb\beta+3nc\gamma,y=na\beta+nd\gamma$?

The book does say that Euler used the identity$$A^3+B^3+C^3-D^3=n^3(\gamma^3-\beta^3)(\lambda+\mu)(\lambda^2-\lambda\mu+\mu^2-3\beta\gamma)\tag4$$But I'm not sure how this fits into the problem.

REPLY [6 votes]: We'll generalize Euler's method so we can solve,
$$x_1^3+x_2^3 =y_1^3+y_2^3\tag1$$
as well as,
$$x_1^k+x_2^k =y_1^k+y_2^k\tag2$$
though for $k>4$ the latter will need square roots.

I. Third Powers

First, do the substitution,
$$(p+q)^3+(p-q)^3=(r+s)^3+(r-s)^3$$
to get
$$p(p^2+3q^2) = r(r^2+3s^2)\tag3$$
an old trick to reduce the degree. (Notice $q,s$ is only degree $2$.) To reduce the degree even further, what Euler did was to find a substitution so each side will have a common factor that will "fall out". Assume,
$$p^2+3q^2 = (a^2+3b^2)\color{blue}{(u^2+3v^2)}$$
then factor each side separately over $\sqrt{-3}$. We get two linear equations,
$$p+q\sqrt{-3} = (a+b\sqrt{-3})(u+v\sqrt{-3})\\
p-q\sqrt{-3} = (a-b\sqrt{-3})(u-v\sqrt{-3})$$
in two unknowns $p,q$. You have Mathematica, solve for these so,
$$p = au-3bv,\quad q = bu+av$$
Changing the sign of $v$ will get the form in your post. Do the same to the other side,
$$r^2+3s^2 = (c^2+3d^2)\color{blue}{(u^2+3v^2)}$$
factor over $\sqrt{-3}$, again get the two equations, solve for $r,s$,
$$r = cu-3dv,\quad s = du+cv$$
If you substitute these formulas for $p,q,r,s$ into $(3)$, you'll have,
$$(au-3bv)(a^2+3b^2)\color{blue}{(u^2+3v^2)}=(cu-3dv)(c^2+3d^2)\color{blue}{(u^2+3v^2)}$$
Drop the common factor,
$$(au-3bv)(a^2+3b^2)=(cu-3dv)(c^2+3d^2)$$
equivalently,
$$\color{brown}{u}\big(a(a^2+3b^2)-c(c^2+3d^2)\big)=\color{brown}{3v}\big(b(a^2+3b^2)-d(c^2+3d^2)\big)$$
and, voila, you get an equation that is only linear in $u,v$ and easily solved! Euler was clever, wasn't he? (The next substitutions he took are not really necessary but just aesthetics.) 
Using these values of $u,v$, the complete solution to,  

$$(p+q)^3+(p-q)^3=(r+s)^3+(r-s)^3$$
  is then,
  $$p = 3(bc-ad)(c^2+3d^2),\quad q= (a^2+3b^2)^2-(ac+3bd)(c^2+3d^2)$$
  $$r = 3(bc-ad)(a^2+3b^2),\quad s= -(c^2+3d^2)^2+(ac+3bd)(a^2+3b^2)$$

J. Binet would later give a solution in fewer variables, though there is a simple transformation between Euler's and Binet's.

II. Fifth Powers

This time, do the substitution,
$$(\sqrt{p}+\sqrt{q})^5+(\sqrt{p}-\sqrt{q})^5= (\sqrt{r}+\sqrt{s})^5+(\sqrt{r}-\sqrt{s})^5$$
to get
$$\sqrt{p}(p^2+10pq+5q^2) = \sqrt{r}(r^2+10rs+5s^2)$$
Assume again a common factor,
$$p^2+10pq+5q^2 = (a^2+10ab+5b^2)\color{blue}{(u^2+10uv+5v^2)}$$
and factor each side separately over $\sqrt{5}$ to get two equations again linear in $p,q$. (The Mathematica command is Factor[P(x),Extension->Sqrt[5]].)
Repeat the method in Part 1, and some squaring, the complete solution to,

$$(\sqrt{p}+\sqrt{q})^5+(\sqrt{p}-\sqrt{q})^5= (\sqrt{r}+\sqrt{s})^5+(\sqrt{r}-\sqrt{s})^5$$
  is,
  $$\small p = 5(bc-ad)(c^2+10cd+5d^2)^2,\quad q = (a^2+10ab+5b^2)^3-(ac+10bc+5bd)(c^2+10cd+5d^2)^2$$
  $$\small r = 5(bc-ad)(a^2+10ab+5b^2)^2,\quad s = -(c^2+10cd+5d^2)^3+(ac+10bc+5bd)(a^2+10ab+5b^2)^2$$

Notice the similar "shape" the formulas for power $k=3$ and $k=5$ have. For $k=4$,
$$x_1^4+x_2^4 = y_1^4+y_2^4$$
well, that's a different story that uses elliptic curves...

$\color{green}{Added:}$

III. Sixth Powers

Similarly,
$$(\sqrt{p}+\sqrt{q})^6+(\sqrt{p}-\sqrt{q})^6= (\sqrt{r}+\sqrt{s})^6+(\sqrt{r}-\sqrt{s})^6$$
yields,
$$(p+q)(p^2+14pq+q^2) = (r+s)(r^2+14rs+s^2)$$
and the method used for $k=3$ still applies.

IV. Eighth Powers

The higher we go, the harder it gets. For $k=8$,
$$(\sqrt{p}+\sqrt{q})^8+(\sqrt{p}-\sqrt{q})^8= (\sqrt{r}+\sqrt{s})^8+(\sqrt{r}-\sqrt{s})^8$$
a bunch of square roots is needed, but a special case has rational $p,q,r,s$ given by,
$$p = (n-1)(n^2-n-1),\quad r= n^3-n-1\\ q = (n+1)(n^2+n-1),\quad s= n^3-n+1$$