<s>[INST] A ring such that $(a+b)^2=a^2+b^2$ and $(a+b)^3=a^3+b^3$ 
Let $(A,+,\cdot)$ be a ring such that there are $a,b \in A$ which satisfy $$(a+b)^2=a^2+b^2, \quad (a+b)^3=a^3+b^3$$
  Prove that $(a+b)^n=a^n+b^n,$ for all positive integers $n.$

I have found the following solution, but I am not quite satisfied with it.
From the hypothesis we get $ab+ba=0$ and $ab^2+ba^2=0.$ We will prove the identity using induction. Suppose that it is true for $1,2,...,n-1, \: n \geq 4.$ We can write $$(a+b)^n=(a+b)^{n-1}(a+b)=(a^{n-1}+b^{n-1})(a+b)=a^n+a^{n-1}b+b^{n-1}a+b^n$$
It is left to prove that $a^{n-1}b+b^{n-1}a=0.$ We can write $$a^{n-1}b+b^{n-1}a=a^{n-2}ab+b^{n-2}ba=-a^{n-2}ba-b^{n-2}ab \quad (*)$$
But $(a+b)^{n-1}=(a+b)^{n-2}(a+b)=(a^{n-2}+b^{n-2})(a+b)=a^{n-1}+b^{n-1},$ so $$a^{n-2}b+b^{n-2}a=0 \Rightarrow b^{n-2}a=-a^{n-2}b$$
Plugging this back in $(*)$ gives $$a^{n-1}b+b^{n-1}a=-a^{n-2}ba+a^{n-2}b^2=a^{n-2}(-ba+b^2)=a^{n-3}ab(-a+b)$$
But $0=ab^2+ba^2=ab^2-aba=ab(b-a),$ so $$a^{n-1}b+b^{n-1}a=a^{n-3}\cdot 0 = 0$$ and this completes the indution.
Is there any other solution, maybe quicker or more beautiful?
 [/INST] It is no hard to see by using induction $a^nb=-b^na$ and $a^nb^n=-b^na^n$

Assume that $n$ is even.
$$(a+b)^n= \underbrace{(a+b)^2(a+b)^2(a+b)^2(a+b) ^2\cdots(a+b)^2}_{\text{$\frac{n}{2}$}\ \  \text{times}}$$
$$=(a^2+b^2)(a^2+b^2)\cdots(a^2+b^2)$$
$$=(a^4+a^2b^2+b^2a^2+b^4)\cdots (a^4+a^2b^2+b^2a^2+b^4)$$
Using $a^nb^n=-b^na^n$
$$=(a^4+b^4)(a^4+b^4)\cdots(a^4+b^4)$$
 $$\vdots$$

  
*
  
*Finally, we reach two components by using $a^nb^n=-b^na^n$, We get $a^nb=-b^na$ if used as much as necessary we obtain
  $$=a^n+b^n$$
  $\textbf{Note:}$ When we reach the odd number of components, we do not handle the final component.
  

$\textbf{Example:}$ The logic is as follows:
$$(a+b)^6=(a+b)^2(a+b)^2(a+b)^2$$
$$=(a^2+b^2)(a^2+b^2)(a^2+b^2)$$
$$=(a^4+a^2b^2+b^2a^2+b^4)(a^2+b^2)$$
$$=(a^4+b^4)(a^2+b^2)=(a^6+a^4b^2+b^4a^2+b^6)$$
$$=a^6-b^4ab-a^4ba+b^6$$
$$=a^6+b^5a+a^5b+b^6=a^6+b^6$$
Similarly, we can think  when $n$ is odd as following:(Actually, we encounterd above the situation below.) 
$$(a+b)^n= \underbrace{(a+b)^2(a+b)^2(a+b)^2(a+b)^2\cdots (a+b)^2}_{\text{$\frac{n-1}{2},
$}\  \  
\text{times}}
\underbrace{(a+b)}_{\text{$1$ times}}=a^n+b^n $$
</s>