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.
You got so close:
$$\frac {x^2 - a^2+2x-2a}{x - a} $$
Then you just need to know $x^2-a^2=(x+a)(x-a)$.
More generally $x^n-a^n=(x-a)(x^{n-1}+x^{n-2}a+...+a^{n-1})$. This formula is used all over the place in maths. You can see it's true by considering what happens if you put $x=a$ into $x^n-a^n$.