Differentiate $f(x) = xe^x$ from first principles I am trying to prove the derivative of $f(x) = xe^x$ is $f'(x) = e^x + xe^x$ from first principles.
The derivative is $ \frac{f(x+h) - f(x)}{h} $ as h tends to zero
So:
$ \frac{f(x+h) - f(x)}{h}  =  \frac{(x+h)e^{x+h} - xe^x}{h} $
$ = \frac{x(e^{x+h}-e^x)+he^{x+h}}{h} $
$ = \frac{x(e^{x+h}-e^x)}{h} + e^{x+h} $
This tends to infinity as h tends to zero. Where have I gone wrong?
 A: You have incorrectly evaluated the limit of $\frac{e^{x+h}-e^x}{h}$, which tends to $e^x$, rather than to infinity as $h$ tends to zero.
Note that $\frac{e^{x+h}-e^x}{h}$ is the standard difference quotient in the computation of the derivative of $e^x$.
A: Note that
$$
\frac{x(e^{x+h}-e^x)}{h}=\frac{x(e^x\cdot e^h-e^h)}{h}
=
\frac{xe^x(e^h-1)}{h}=xe^x\frac{e^h-1}{h}
$$
and the limit of the last factor is the derivative of $t\mapsto e^t$ at $0$, so it is $1$ rather than infinity.
How do you compute it? It depends on how you define $e$: if you define $e$ as the only number $a$ such that
$$
\lim_{h\to0}\frac{a^h-1}{h}=1
$$
then you're done.
If you define $e=\lim_{n\to\infty}(1+1/n)^n$ then much more work needs to be done. First show that
$$
\lim_{x\to\infty}\left(1+\frac{1}{x}\right)^{\!x}=e=
\lim_{x\to-\infty}\left(1+\frac{1}{x}\right)^{\!x}
$$
Then we can do the substitution $x=1/t$ and get
$$
\lim_{t\to0}(1+t)^{1/t}=e
$$
so, by continuity of the logarithm,
$$
\lim_{t\to0}\frac{\log(1+t)}{t}=1
$$
Now set $\log(1+t)=h$ so that $t=e^h-1$; therefore
$$
\lim_{h\to0}\frac{h}{e^h-1}=1
$$
A: If you know/can use power/Taylor series, then
$$\frac{e^h-1}h=\frac{1+h+\mathcal O(h^2)+\ldots-1}{h}=1+\mathcal O(h)\xrightarrow[h\to 0]{}1$$
A: Use 
$\dfrac{d[f(x)\cdot g(x)]}{dx}=\lim_{h\to0}\dfrac{f(x+h)g(x+h)-f(x)g(x)}h$
$=\lim_{h\to0}f(x+h)\lim_{h\to0}\dfrac{g(x+h)-g(x)}h+g(x)\lim_{h\to0}\dfrac{f(x+h)-f(x)}h$
Set $f(x)=x,g(x)=e^x$ or $g(x)=x,f(x)=e^x$
Finally use $\lim_{h\to0}\dfrac{e^h-1}h=1$
