# How to prove that the derivative f this function is |x|

1. Feb 24, 2009

### transgalactic

how to prove that the derivative of this expression

$$f(x)=-\frac12x^2,x<0$$
$$f(x)=\frac12x^2,x>=0$$
is f'(x)=|x|

i tried
$$\lim _{x->0^-}\frac{f(x)-f(0)}{x}=\lim _{x->0^-}\frac{-\frac12x^2-0}{x}=\lim _{x->0^-}-\frac12x=0\\$$
$$\lim _{x->0^-}\frac{f(x)-f(0)}{x}=\lim _{x->0^-}\frac{+\frac12x^2-0}{x}=\lim _{x->0^+}+\frac12x=0$$
but i get values
it doesnt show that f'(x)=|x|
??

Last edited: Feb 24, 2009
2. Feb 24, 2009

### CompuChip

You calculated f'(0) and found that it is 0. So this doesn't contradict f'(x) = |x|. Now calculate the derivative for all other x as well :tongue:

3. Feb 24, 2009

### transgalactic

$$\lim _{h->0^-}\frac{f(x+h)-f(x)}{h}=\lim _{h->0^-}\frac{-\frac12(x+h)^2+\frac12x^2}{h}=\lim _{h->0^-}\frac{-\frac12(x^2+2xh+h^2)+\frac12x^2}{h}=\lim _{h->0^-}\frac{-\frac12(2x+h)}{1}=-x\\$$
$$\lim _{h->0^+}\frac{f(x+h)-f(x)}{h}=\lim _{h->0^+}\frac{\frac12(x+h)^2-\frac12x^2}{h}=\lim _{h->0^+}\frac{\frac12(2xh+h^2)}{h}=\lim _{h->0^+}\frac{+\frac12(2x+h)}{1}=x\\$$

what to write in order to finish this prove??

4. Feb 24, 2009

### CompuChip

Almost... you didn't mean to write $h \to 0^\pm$ under the limits, because both limits are two-sided. So, the first one is just
$$\lim _{h\to0}\frac{f(x+h)-f(x)}{h}=\lim _{h\to0}\frac{-\frac12(x+h)^2+\frac12x^2}{h}=\lim _{h\to0}\frac{-\frac12(x^2+2xh+h^2)+\frac12x^2}{h}=\lim _{h\to0}\frac{-\frac12(2x+h)}{1}=-x\\$$
You probably meant to say, that the top line is for x < 0 and the bottom line is for x > 0 (because on the top line you are using the part of the definition for x < 0 and on the bottom line you are using the definition of f for x >= 0).

So now you have shown that f' exists everywhere and is equal to
$$f'(x) = \begin{cases} -x & \text{ if } x < 0 \\ 0 & \text{ if } x = 0 \\ x & \text{ if } x > 0 \end{cases}$$

Can you conclude now that f'(x) = |x| ?

5. Feb 24, 2009

### transgalactic

can I ?

6. Feb 24, 2009

### Tom Mattson

Staff Emeritus
You should know. Compare his expression for $f'(x)$ with the definition of $|x|$.

7. Feb 24, 2009

### Redbelly98

Staff Emeritus
Look at robueler's post concerning y(x) = |x|.