<s>[INST] How do I prove that $x^n-y^n=(x-y)(x^{n-1}+x^{n-2}y+\dotsb+xy^{n-2}+y^{n-1})$ I am unsuccessfully attempting a problem from Spivak's popular book 'Calculus' 3rd edition. The problem requires proof for the following equation: 
$$x^n-y^n=(x-y)(x^{n-1}+x^{n-2}+\dotsb+xy^{n-2}+y^{n-1})$$
The solution to the problem, contained in the answer book, is as follows:
\begin{align*}
x^n-y^n &= (x-y)(x^{n-1}+x^{n-2}y+\dotsb+xy^{n-2}+y^{n-1})\\
&= x(x^{n-1}+x^{n-2}y+\dotsb+xy^{n-2}+y^{n-1})\\
&\qquad -[y(x^{n-1}+x^{n-2}y+{...}+xy^{n-2}+y^{n-1})]&\Rightarrow \mathbf{Equation1}\\
&=x^n+x^{n-1}y+\dotsb+x^2y^{n-2}+xy^{n-1}\\
&\qquad -[x^{n-1}y+x^{n-2}y^2+xy^{n-1}+y^n]&\Rightarrow \mathbf{Equation2}\\
&=x^n-y^n
\end{align*}
While I believe that the distributive law was used to arrive at Equation 1, I do not understand how Equation 2 was arrived at. 
I have tried to solve this independently to no avail. I cannot seem to understand how $x^n$ and $y^n$ came about in Equation 2 for example.
To summarise the question, what principle was Equation 2 based upon? And how was this applied in the above problem. 
 [/INST] I like using $\sum$ like this:
$\begin{array}\\
(x-y)(x^{n-1}+x^{n-2}y+\dotsb+xy^{n-2}+y^{n-1})
&=(x-y)\sum_{k=0}^{n-1} x^{n-1-k} y^k\\
&=x\sum_{k=0}^{n-1} x^{n-1-k} y^k-y\sum_{k=0}^{n-1} x^{n-1-k} y^k\\
&=\sum_{k=0}^{n-1} x^{n-k} y^k-\sum_{k=0}^{n-1} x^{n-1-k} y^{k+1}\\
&=\sum_{k=0}^{n-1} x^{n-k} y^k-\sum_{k=1}^{n} x^{n-k} y^{k}\\
&=x^n+\sum_{k=1}^{n-1} x^{n-k} y^k-\left(y^n+\sum_{k=1}^{n-1} x^{n-k} y^{k}\right)\\
&=x^n-y^n+\sum_{k=1}^{n-1} x^{n-k} y^k-\sum_{k=1}^{n-1} x^{n-k} y^{k}\\
&=x^n-y^n\\
\end{array}
$
</s>