how to derive the condition for when $(x+y)^n=x^n+y^n$? I encountered this in Spivak Calculus problem 16. I realize that the condition is $x=0=y=0$ for all even $n$ and $x=y=0$ and $x=-y$ for all odd $n$. However I'm not sure if there's a way to derive it through the given $(x+y)^n=x^n+y^n$
 A: $n=1$ trivially works for all $x, y$. Let's consider $n \geq 2$.
Dividing both sides by $x+y$, we define $a = \frac{x}{x+y}$. Then we wish to find solutions to
$$a^n + (1-a)^n = 1.$$
By taking a derivative, we obtain $na^{n-1} - n(1-a)^{n-1}$, which is zero only at $a = \frac 12$. So the function $f(a) = a^n + (1-a)^n - 1$ only has one turning point, and hence can only have two roots (since between any two roots there is a turning point).
But $a = 0, 1$ are clearly roots, and so they are the only such roots, and converting back gives that either $x$ or $y$ are $0$.
(Alternatively, under the restriction that $x, y$ are positive integers, observe that no solutions for $n \geq 3$ exist, by Fermat's Last Theorem.)
A: First off, for $n>0$:
$$(x+y)^n = x^n + y^n + \sum_{i=1}^{n-1} {n \choose i} x^iy^{n-i} = x^n + y^n \implies \sum_{i=1}^{n-1}{n \choose i}x^iy^{n-i} = 0$$
It is apparent that if $x = 0$ or $y = 0$ the sum goes to $0$ because the argument of the summation will always have both $x$ and $y$ raised to a degree greater than or equal to $1$.
Now, there is a special case if $n$ is odd. Because you can pair terms:
$$\sum_{i=1}^{n-1}{n \choose i}x^iy^{n-i} = \sum_{i=1}^{(n-1)/2}{n \choose i}(x^iy^{n-i} + x^{n-i}y^i) = 0 $$
so if $(x^iy^{n-i} + x^{n-i}y^i) = 0$ for all $i$ then their sum will also be $0$. This can be accomplished by setting $x = -y$, now:
$(x^iy^{n-i} + x^{n-i}y^i) = (x^i(-x)^{n-i} + x^{n-i}(-x)^i) = x^n1^{n-i}+x^n1^{i} = 0$
because if $n$ is odd, $1^i = -1^{n-i}$. Thus we have our condition. This is not a proof that there is not another condition, if that is something you also desire then let me know and I will update my post.
