Task 3. Determine all pairs $(a, b)$ of positive integers such that $(a+b)^{3}-2 a^{3}-2 b^{3}$ is a perfect square.
Solution. We first determine the pairs $(a, b)$ with $\operatorname{gcd}(a, b)=1$. It holds that

$$
\begin{aligned}
(a+b)^{3}-2 a^{3}-2 b^{3} & =a^{3}+3 a^{2} b+3 a b^{2}+b^{3}-2 a^{3}-2 b^{3} \\
& =-a^{3}-b^{3}+3 a b(a+b) \\
& =-(a+b)\left(a^{2}-a b+b^{2}\right)+3 a b(a+b) \\
& =(a+b)\left(-a^{2}+a b-b^{2}+3 a b\right) \\
& =(a+b)\left(-a^{2}-b^{2}+4 a b\right)
\end{aligned}
$$

This must be a perfect square. Since $a+b$ is positive, the other factor must also be positive, and thus both are perfect squares. Because $\operatorname{gcd}(a, b)=1$, at least one of $a$ and $b$ is odd. Then $a^{2}+b^{2}$ is congruent to 1 or 2 modulo 4, so $-a^{2}-b^{2}+4 a b$ is congruent to 3 or 2 modulo 4. It must, however, be a perfect square, so the number 3 modulo 4 is impossible, and in the case of 2 modulo 4, it can only be equal to 2. We conclude that $-a^{2}-b^{2}+4 a b=2$.

Suppose that $a+b$ is at least 8. Since it is a perfect square, it is then divisible by 8, so we can write $b=8 m-a$ for some positive integer $m$. Then it holds that

$$
\begin{aligned}
2 & =-a^{2}-b^{2}+4 a b \\
& =-a^{2}-(8 m-a)^{2}+4 a(8 m-a) \\
& =-a^{2}-64 m^{2}+16 m a-a^{2}+32 m a-4 a^{2} \\
& =-6 a^{2}+48 m a-64 m^{2}
\end{aligned}
$$

so

$$
1=-3 a^{2}+24 m a-32 m^{2} \text {. }
$$

Now, modulo 8, this is $1 \equiv-3 a^{2}$. If $a$ is even, then the right side is even, and if $a$ is odd, then the right side is -3 modulo 8. In both cases, this equation does not hold modulo 8. We conclude that $a+b$ is not at least 8. Since $a$ and $b$ are both at least 1, $a+b$ must then be equal to 2 or 4.

- If $a+b=2$, then $a=b=1$. Now $-a^{2}-b^{2}+4 a b=2$, so the product of the two factors is indeed a perfect square (namely 4). Thus $(1,1)$ is a solution.
- If $a+b=4$, then because $\operatorname{gcd}(a, b)=1$, it must hold that $a=1$ and $b=3$ or vice versa. Now $-a^{2}-b^{2}+4 a b=2$, so the product of the two factors is also a perfect square (namely 8). Thus $(1,3)$ and $(3,1)$ are solutions.

Now consider a solution $(a, b)$ with $\operatorname{gcd}(a, b)=d>1$. Then $d$ is a divisor of $(a+b)^{3}-2 a^{3}-2 b^{3}$, so $d$ must itself be a perfect square. We now see that $\left(\frac{a}{d}, \frac{b}{d}\right)$ is also a solution, because the perfect square $(a+b)^{3}-2 a^{3}-2 b^{3}$ has $d^{3}$ divided out, leaving another perfect square. Thus $\left(\frac{a}{d}, \frac{b}{d}\right)$ must be one of the three pairs found earlier. Conversely, each of those three pairs, multiplied by any arbitrary perfect square, gives another solution. We conclude that all solutions are given by

$$
(a, b)=\left(2^{k}, 2^{k}\right), \quad(a, b)=\left(2^{k}, 3 \cdot 2^{k}\right), \quad \text { and } \quad(a, b)=\left(3 \cdot 2^{k}, 2^{k}\right)
$$

where $k$ varies over the non-negative integers.