Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know that $$f(x)=x\cdot|x|$$ have no derivative at $$x=0$$ but how do I calculate it's derivative for the rest of the points? When I calculate for $$x>0$$ I get that $$f'(x) = 2x $$ but for $$ x < 0 $$ I can't seem to find a way to solve the limit. As this is homework please don't put the answer straight forward.

share|cite|improve this question
Hint: what is $|x|$ if $x<0$? – Sigur Jan 7 '13 at 23:49
I know that it's -x but I still can't get further... I'm stuck with a big polynom – Georgey Jan 7 '13 at 23:51
I believe you have a derivative at $x=0$. – timur Jan 7 '13 at 23:51
Do you know the following characterization, which is the root of linear approximation: $f$ is differentiable at $0$ with derivative $f'(0)$ if and only if $f(x)=f(0)+xf'(0)+x\epsilon(x)$ with $\lim_{x\rightarrow 0}\epsilon (x)=0$? In your case, $\epsilon(x)=|x|$ and $f(0)=f'(0)=0$. Here is a reference: – 1015 Jan 8 '13 at 0:22
up vote 7 down vote accepted

First, draw a picture. Second, make a guess. Third, confirm your guess.

enter image description here

Hmm, looks like $x \mapsto x^2$ for $x \geq 0$ and $x \mapsto -x^2$ for $x \leq 0$. Indeed $f(x) = x^2$ for $x >0 $, so $f'(x) = 2 x$ when $x > 0$. Similarly, $f(x) = -x^2$ when $x <0$, so $f'(x) = -2x$ for $x <0$.

The only issue is $x=0$. Looking at the picture, and indeed, looking at the limiting value for $x \downarrow 0$ and $x \uparrow 0$ suggests that if $f$ is differentiable at $x=0$, then $f'(0) = 0$.

So, working with this guess, we try $$|f(x)-f(0) - 0.x| = |(x|x|)-0 -0.x| = |x|^2$$ If $x\neq 0$, we have $\frac{|f(x)-f(0) - 0.x|}{|x|} = |x|$, from which it follows that $f'(0) = 0$. Formally.

To wrap up, notice that $f'(x) = 2|x|$.

Working without the intuition is difficult. For me, drawing a rough picture provides much of the intuition. If the intuition is sound, then it is often straightforward to formalize the result.

share|cite|improve this answer
I'm not supposed to draw the graph, just calculate the derivative. – Georgey Jan 7 '13 at 23:52
Do the extra work. – copper.hat Jan 7 '13 at 23:52
But how can I formally prove with tools I'm not allowed to use? – Georgey Jan 7 '13 at 23:52
I think the idea is that the picture can help you figure out what answer you're supposed to get; it might not end up being the method you ultimately use in your written answer. – Christopher A. Wong Jan 8 '13 at 0:03
You can turn it into a slightly more formal proof by observing that the definition of the derivative of a function at a point only depends on its values around that point. So if two functions agree near that point, they have the same derivative there. For example, since $f(x)=x^2$ for $x>0$, the derivative of $f$ and the derivative of $x\mapsto x^2$ are equal at any point $x$ with $x>0$. – user108903 Jan 8 '13 at 0:04
  • For $x \ge 0$ you have $f(x)=x \times |x| = x \times x = x^2$

  • For $x \le 0$ you have $f(x)=x \times |x| = x \times (-x) = -x^2$

so you can calculate the derivative when $x \gt 0$ and the derivative when $x \lt 0$ in the usual way.

You are wrong when you say there is no derivative when $x=0$.

share|cite|improve this answer

Hint If $x\gt 0$ we are looking at $x^2$, easy. If $x\lt 0$, we are looking at $-x^2$, easy. For $x=0$, use the definition of the derivative.

So at $0$ we want $\displaystyle\lim_{h\to 0}\,\dots$,

share|cite|improve this answer

There's a great trick that you can use. Notice that for all real $x \neq 0$ you have $|x| \equiv \sqrt{x^2}$.

If you want to know the derivative of $x|x|$ away from $x=0$ then consider $x\sqrt{x^2}$. Using the chain rule and the product rule we can show that, assuming $x \neq 0$,

$$\frac{d}{dx}x|x| \equiv \frac{d}{dx} x\sqrt{x^2} = \sqrt{x^2} + \frac{x^2}{\sqrt{x^2}} \equiv |x| + \frac{x^2}{|x|} \, . $$

Moreover, this little trick works in many more situations. For example, consider $f(|x|)$. Provided we stay away from $x = 0$, $g(|x|) \equiv g(\sqrt{x^2})$ and so:

$$\frac{d}{dx} g(|x|) = \frac{x}{|x|}\frac{d}{dx}g(|x|) \, . $$

share|cite|improve this answer

When $x<0$ replace $|x|$ by $-x$ (since that is what it is equal to) in the formula for the function and proceed.

Please note as well that the function $f(x)=x\cdot |x|$ does have a derivative at $0$.

share|cite|improve this answer
so is $f(x)' = 2x$ for $x >= 0$ and $f(x)' = -2x$ for $x < 0$? – Georgey Jan 7 '13 at 23:58
@Eran Strictly speaking, $f(x)$ is a number and so $f(x)' = 0$ for all $x$. It's better to write $f'(x)$, i.e. $f'$ evaluated at $x$. – Fly by Night Jan 8 '13 at 0:10
@Fly by Night Even more strictly speaking, f(x) is a number and so it is not a function and thus can't be differentiated at all. – Ittay Weiss Jan 8 '13 at 0:19
@IttayWeiss Of course it can. You can think of it as a constant function if you like. – Fly by Night Jan 8 '13 at 0:28
Not if you are being strict about the notation. Otherwise, you can also think of f(x)' as the derivative of f at x. Either f(x)' has no meaning (if you want to be strict), or you assign to it some plausible meaning. There are at least two (inconsistent) ways to do the latter. – Ittay Weiss Jan 8 '13 at 0:36

By definition, the derivative (if exists) of $f$ at $x_0$ is $$ f'(x_0)=\lim_{x\to x_0}\frac{f(x)-f(x_0)}{x-x_0}. $$ When $x_0<0$, $f(x_0)=x_0(-x_0)=-x_0^2$. Now you have $$ \begin{align} f'(x_0)&=\lim_{x\to x_0}\frac{x|x|+x_0^2}{x-x_0}\\ &=\lim_{x\to x_0;x\in(x_0-\epsilon,x_0+\epsilon)\setminus\{x_0\}}\frac{x|x|+x_0^2}{x-x_0}\\ &=\lim_{x\to x_0;x\in(x_0-\epsilon,x_0+\epsilon)\setminus\{x_0\}}\frac{-x^2+x_0^2}{x-x_0}\\ &=\lim_{x\to x_0;x\in(x_0-\epsilon,x_0+\epsilon)\setminus\{x_0\}}-(x+x_0)=-2x_0. \end{align} $$ Here $\epsilon$ is such that $x_0+\epsilon<0$.

share|cite|improve this answer

$\newcommand{\+}{^{\dagger}} \newcommand{\angles}[1]{\left\langle #1 \right\rangle} \newcommand{\braces}[1]{\left\lbrace #1 \right\rbrace} \newcommand{\bracks}[1]{\left\lbrack #1 \right\rbrack} \newcommand{\ceil}[1]{\,\left\lceil #1 \right\rceil\,} \newcommand{\dd}{{\rm d}} \newcommand{\down}{\downarrow} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\expo}[1]{\,{\rm e}^{#1}\,} \newcommand{\fermi}{\,{\rm f}} \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,} \newcommand{\half}{{1 \over 2}} \newcommand{\ic}{{\rm i}} \newcommand{\iff}{\Longleftrightarrow} \newcommand{\imp}{\Longrightarrow} \newcommand{\isdiv}{\,\left.\right\vert\,} \newcommand{\ket}[1]{\left\vert #1\right\rangle} \newcommand{\ol}[1]{\overline{#1}} \newcommand{\pars}[1]{\left( #1 \right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\pp}{{\cal P}} \newcommand{\root}[2][]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,} \newcommand{\sech}{\,{\rm sech}} \newcommand{\sgn}{\,{\rm sgn}} \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}} \newcommand{\ul}[1]{\underline{#1}} \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert} \newcommand{\wt}[1]{\widetilde{#1}}$ $$ \color{#00f}{\large\totald{\pars{x\verts{x}}}{x}} =\verts{x} + x\sgn\pars{x} = \verts{x} + \verts{x} = \color{#00f}{\large 2\verts{x}} $$

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.