# Using limit laws while calculating the difference quotient?

I'm trying to calculate the difference quotient of $f(x) = x|x|$ to calculate to derivative at $x=0$.

Now when I try to do: $\lim_{h\to0} f(x)=\frac{(x+h)|x+h|-x|x|}{h}$ it just seems too complicated to calculate.

I even tried this:

$$\lim_{h\to0}{ \frac{x+h-x}{h}} \lim_{h\to0}{ \frac{|x+h|-|x|}{h}}$$ Is this legal?

Even so, I still don't know how to calculate to right limit.

How do you calculate the difference quotient of this function?:|

Recall: $$|x| = \begin{cases} x,& x \geq 0 \\ -x, & x < 0\text{.} \end{cases}$$ Consider $$\dfrac{(x+h)|x+h|-x|x|}{h}\text{.}$$ Notice that $$|x+h| = \begin{cases} x+h, & x +h\geq 0 \\ -(x+h), & x + h < 0 \end{cases} = \begin{cases} x+h, & h \geq -x \\ -(x+h), & h < -x\text{.} \end{cases}$$ We have two cases here: $$\dfrac{(x+h)|x+h|-x|x|}{h} = \begin{cases} \dfrac{(x+h)^2-x|x|}{h}, & h > -x \\ \dfrac{-(x+h)^2-x|x|}{h}, & h < -x\text{.} \end{cases}$$ Now, substitute $x = 0$ in both cases and simplify, and you will get your answer.
The really special behavior of this this function is at zero, so rather than do something for general $x$ and then “plug in” $x=0$, it's easier to start with $x=0$. By the definition of the derivative, then by the definition of $f$: \begin{align*} f'(0) &= \lim_{h\to 0} \frac{f(0+h)-f(0)}{h} = \lim_{h\to 0} \frac{f(h)}{h} \\ &= \lim_{h\to 0} \frac{h\left|h\right|}{h} = \lim_{h\to 0} |h| = 0 \end{align*}