How does $\frac {(x^2 + 2x) - (a^2 + 2a)}{x-a}$ reduce to $x + a + 2$? With the given function:
$$f(x) = x^2 + 2x $$
I am trying to evaluate the following expression:
$$\frac {f(x) - f(a)}{x-a} $$
I've been informed that the solution is:
$x + a + 2$, where $x \ne a$
But I don't know how to get there. Can someone help me understand the logic behind the solution and where I'm going wrong? I hope this question is appropriate. It's my first on the site.
I started by replacing the functions with their bodies respecting the given inputs.
$$\frac {(x^2 + 2x) - (a^2 + 2a)}{x-a}$$
Then, it appears to me that one could factor out the X's and the A's.
$$\frac {x(x + 2) - a(a + 2)}{x - a} $$
At this point I'm actually stumped. I can see there's an $x$ and an $a$ with subtraction between them, but I don't see how they're related.
But given the solution, I guess the $x-a$ in the denominator cancels out the $x-a$ in the numerator (somehow?). Then I'd be left with
$$(x+2)+(a+2)$$
Adding this up I get $x+a+4$. I'm not sure what problems like these are called, so I'm not sure what to search to find what I'm missing.
Thank you in advance for helping me.

We have that
$$\frac {(x^2 + 2x) - (a^2 + 2a)}{x-a} =\frac {x^2 -a^2 + 2x-2a}{x-a}=\frac {(x+a)(x-a) + 2(x-a)}{x-a}=$$
$$=\frac {(x+a)(x-a) }{x-a}+\frac {2(x-a)}{x-a}=x+a+2$$
for $x\neq a$, the key point it to recognize that $x^2-a^2=(x+a)(x-a)$.
As an alternative we can proceed using that
$$x^2  +2x-a^2-2a=0 \implies x=\frac{-2\pm \sqrt{4-4(-a^2-2a)}}{2}=-1\pm(a+1)$$
and therefore, since $u=-a-2$ and $v=a$ are roots for the polynomial
$$x^2 +2x-a^2-2a=(x-u)(x-v)=(x+a+2)(x-a)$$

Another way by long division
\begin{array}{rrr|ll} 
x^2 & +2x & -a^2-2a   & x  -  a
\\   -x^2 & +ax &  &  &   x +a+2
\\ \hline     & (a+2)x & -a^2-2a
\\&-(a+2)x & a^2+2a & & & & 
\\ \hline & 0&  0  \end{array}
