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. 
 A: 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}
$
A: You have an error; it should be $x^n - y^n = (x-y)(x^{n-1} + x^{n-2}y + ... + xy^{n-2} + y^{n-1})$. Just distribute.
A: The simplest way is to prove first
$$1-t^n=(1-t)(1+t+\dots+t^{n-1})$$
by induction.
The formula is trivial for $n=1$. So suppose the formula is valid for some $n\ge 1$, and consider the exponent $n+1$.
\begin{align}
1-t^{n+1}&=(1-t^n)+(t^n-t^{n+1})\\
&=(1-t)(1+t+\dots+t^{n-1})+t^n(1-t)\\
&=(1-t)(1+t+\dots+t^{n-1+t^n}),
\end{align}
 which proves the inductive step.
Now for the general formula: set $y=tx$, and substitute in the expression:
\begin{align}
x^n-y^n&=x^n(1-t^n)=x^n(1-t)(1+t+\dots+t^{n-1})\\
&=x(1-t)\cdot x^{n-1}(1+t+\dots+t^{n-1})\\
&=(x-tx)(x^{n-1}+x^{n-2}tx+\dots +(tx)^{n-1})\\
&=(x-y)(x^{n-1}+x^{n-2}y+\dots +y^{n-1}).
\end{align}
A: 
The step from equation 1 to equation 2 uses both the distributive law as well as the commutative law.

In order to better see what's going on, we look at small special cases $n=2,3$. We also use somewhat more detailed transformations.

n=2:
  \begin{align*}
(x-y)\left(x^{1}+y^1\right)&=x\left(x^{1}+y^1\right)-y\left(x^1+y^1\right)\\
&=\left(x\cdot x^1+x\cdot y^1\right)-\left(y\cdot x^1+y\cdot y^1\right)\\
&=\left(x^2+xy\right)-\left(yx+y^2\right)\\
&=x^2+xy-yx-y^2\\
&=x^2-y^2
\end{align*}
n=3:
  \begin{align*}
&(x-y)\left(x^{2}+x^1y^1+y^2\right)\\
&\qquad=x\left(x^{2}+x^1y^1+y^2\right)-y\left(x^{2}+x^1y^1+y^2\right)\\
&\qquad=\left(x\cdot x^2+x\cdot x^1y^1+x\cdot y^2\right)-\left(y\cdot x^2+y\cdot x^1y^1+y\cdot y^2\right)\\
&\qquad=\left(x^3+x^2y+xy^2\right)-\left(yx^2+y^2x+y^3\right)\\
&\qquad=x^3+x^2y+xy^2-yx^2-y^2x-y^3\\
&\qquad=x^3-y^3
\end{align*}
general n:
  \begin{align*}
&(x-y)\left(x^{n-1}+x^{n-2}y^1+\cdots+xy^{n-1}+y^{n-1}\right)\\
&\qquad=x\left(x^{n-1}+x^{n-2}y^1+\cdots\cdots\cdot\cdot+xy^{n-1}+y^{n-1}\right)\\
&\qquad\qquad\qquad\ \ -y\left(x^{n-1}+x^{n-2}y^1+\cdots\cdots+xy^{n-1}+y^{n-1}\right)\\
&\qquad=\left(x\cdot x^{n-1}+\color{blue}{x\cdot x^{n-2}y^1}+\cdots\cdots+x\cdot xy^{n-1}+\color{blue}{x\cdot y^{n-1}}\right)\\
&\qquad\qquad\qquad\quad-\left(\color{red}{y\cdot x^{n-1}}+y\cdot x^{n-2}y^1+\cdots\cdots\cdot+\color{red}{y\cdot xy^{n-1}}+y\cdot y^{n-1}\right)\\
&\qquad=\left(x^{n}+ \color{blue}{x^{n-1}y}+\cdots\cdots\cdots\cdots+x^2y^{n-1}+\color{blue}{xy^{n-1}}\right)\\
&\qquad\qquad\ -\left( \color{red}{y x^{n-1}}+x^{n-2}y^2+\cdots\cdots\cdots\cdots\cdot+\color{red}{xy^{n-1}}+y^{n}\right)\\
&\qquad=x^{n}\;+ \color{blue}{x^{n-1}y}+\cdots\cdots\cdots\cdots+x^2y^{n-1}+\color{blue}{xy^{n-1}}\\
&\qquad\qquad\ \ -\color{red}{x^{n-1}y}-x^{n-2}y^2-\cdots\cdots\cdots\cdots-\color{red}{xy^{n-1}}-y^{n}\\
&\qquad=x^n-y^n
\end{align*}

A: Equation 1 by distributive law and Equation 2 also by distributive law (just expand the expressions)
Another method: Use polynomial long division on
$$(x^n-y^n):(x-y)$$.
