Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

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

$$\int |x|^3 \; dx $$ In my module it is suggest to use integration by parts,

$$ \text{ Set }I = \int (|x|^3 \cdot 1) \; dx = |x|^3 \cdot x - \int \color{red}{\frac {x^3}{|x|^3}3x^2}\cdot x \; dx$$

$$ \implies I = |x|^3 \cdot x - \color{red}{3\int |x|^3\;} dx$$

$$ \implies I = \frac 1 4 |x|^3 \cdot x +C $$

I am having trouble understanding the red parts, to be precise the differentiation of $|x|^3 $. I will also appreciate if somebody wants to share a different approach (if any).


share|cite|improve this question
"share a different approach" - split at $x=0$, and treat the two cases separately. – J. M. Apr 28 '12 at 7:34
@J. M.: I have never evaluated a definite integral by splitting. However, I would love to know about this technique, could you please point me some (worked out) examples first? – Quixotic Apr 28 '12 at 7:37
You have two integrals to evaluate, $\int x^3\mathrm dx$ for $x \geq 0$, and $\int (-x^3)\mathrm dx$ for $x < 0$. You get two results. Reconcile them, remembering how the absolute value and the sign function are defined. – J. M. Apr 28 '12 at 7:40
@Foool how did you get the red color in your latex? Sorry that is not exactly on topic. – yiyi Apr 28 '12 at 13:58
@MaoYiyi: \color{red}{\text{ I am red }}: $\color{red}{\text{ I am red }}$ – Quixotic Apr 28 '12 at 14:03
up vote 4 down vote accepted

In retrospect the below is actually not a good answer. Indeed, $x/|x|$ in place of the sign function might have been intended to either avert defining a new function or an attempt to express $\mathrm{sgn}(x)$ purely in terms of elementary functions, but this direction is problematic. The below reasoning works when the region of integration exists strictly on one side of $0$ on the real line, but by its construction it does not work when the region of integration contains $0$; the fundamental theorem of calculus is not valid across singularities.

(More generally, if we remove the appropriate points from the domain to avert the singularities, the FTC only applies on each connected component of the domain individually, and not more than one at a time; the primitive, or antiderivative, associated to each component can be modified by a $+C$ after all.) Technically it is a removable singularity so we can make it work out, but this is an unnecessarily roundabout solution method with no advantage to it.

(Deleting points from the domain and considering $x\mapsto|x|$ a piecewise differentiable function is useful in general for finding an explicit derivative when we have the absolute value composed with other complicated functions, but the same exact caveat applies in the context of integration.)

We can use the chain rule on $f(x)=|x|$ and $g(x)=x^3$, so we reduce to differentiating $|x|$. The derivative does not exist at zero (geometrically, this should be obvious), so we address two possible cases: $x>0$ and $x<0$. In the former, we differentiate as usual and we have $D|x|=1$. In the latter we have $|x|=-x$ so we conclude $D|x|=-1$. (Again this should be obvious, geometrically.) This is the sign function, and it can be written $\mathrm{sgn}(x)=x/|x|$ outside of $x=0$. Applying these facts,

$$\frac{d}{dx}|x|^3=\frac{d}{dx}|x^3|=\mathrm{sgn}(x^3)\cdot \frac{d}{dx}x^3=\frac{x^3}{|x^3|}\cdot3x^2=\frac{x^3}{|x|^3}\cdot3x^2.$$

At least I assume that's what they're getting at.

share|cite|improve this answer
So, this is how we evaluate $$ \frac{d}{dx}|x|^n=\frac{d}{dx}|x^n|=\mathrm{sgn}(x^n)\cdot n.x^{n-1}=\frac{x^n}{|x|^n}\cdot n.x^{n-1} $$ for all $n >1$? – Quixotic Apr 28 '12 at 7:46
@Foool: It applies in that case too, yes. – anon Apr 28 '12 at 7:48
$\space$ Thanks a lot! – Quixotic Apr 28 '12 at 7:50
To introduce the non differentiable function $f:x\mapsto|x|$ is not necessary. An alternative is to apply the usual integration by parts formula to the differentiable functions $u:x\mapsto|x|^3$ and $v:x\mapsto x$. – Did Apr 28 '12 at 11:41
@Didier: Indeed. Since the question already provides a function undefined at $x=0$, I figured this route (which attracted me because it is easily amenable to generalization) was thus open for use (and in this case, we have that $|x|$ is differentiable on our domain $(-\infty,0)\cup(0,\infty)$). – anon Apr 28 '12 at 11:49

Let $u:x\mapsto|x|^3$. Then $u(x)=x^3$ for $x\gt0$ hence $u'(x)=3x^2$ for $x\gt0$. Likewise $u(x)=-x^3$ for $x\lt0$ hence $u'(x)=-3x^2$ for $x\lt0$. Finally, a direct computation yields $u'(0)=0$. To sum up, $u$ is differentiable everywhere and $u'(x)=\mathrm{sgn}(x)\cdot3x^2$ for every $x$, where $\mathrm{sgn}(x)$ is defined as the sign of $x$ if $x\ne0$ and as anything one wants if $x=0$.

Alternative formulations of $\mathrm{sgn}(x)$ when $x\ne0$ are $x/|x|$ or $x^3/|x|^3$ or a number of equivalent other ones, but I fail to see their advantage over the canonical expression of $u'$ given above.

In the end, modulo the odd expression of $u'(x)$, the method in this post is a perfectly legitimate application of the integration by parts formula $\int uv'=\left[uv\right]-\int u'v$, to the functions $u$ as above, and $v:x\mapsto x$ with derivative $v':x\mapsto1$. Note that the functions $u$, $v$, $u'$ and $v'$ used in the integration by parts are defined everywhere, the point $0$ included.

share|cite|improve this answer
+1; I quite prefer splitting to integration by parts myself for this case... – J. M. Apr 28 '12 at 7:42
@J.M. I would not use integration by parts either but this is the method the question asks about and it can be made to work. – Did Apr 28 '12 at 12:21

Recall that $|x| = \sqrt {x^2}$. So $|x|^3 = (\sqrt {x^2}) ^3 = (x^2)^{3/2}$. Differentiating , you get $$\frac{ 3}{2} (x^2)^{1/2}\cdot 2x = 3x |x|.$$

share|cite|improve this answer
Try to read the question again. (y) – Ishaan Singh Apr 28 '12 at 7:58
@IshaanSingh: why the down votes? the OP said he needed precisely the differentiation of $|x|^3. no? – Kuku Apr 28 '12 at 8:00
I didn't down vote, idk why others down voted it. Hmm yes, he(OP) did. I'll up vote you. – Ishaan Singh Apr 28 '12 at 8:02

Let $\displaystyle I= \int|x|^3 dx$

\begin{align*}I =& \int x^2|x| dx \\ =& |x|\int x^2 dx - \int\frac{d}{dx}(|x|)\left(\int x^2 dx \right)dx \\ =&\frac{|x|x^3}{3} - \int\left(\frac{|x|}{x}\cdot\frac{x^3}{3}\right)dx \text{ since } \frac{d}{dx}(|x|) = \frac{|x|}{x} \\ =&\frac{|x|x^3}{3} - \frac{1}{3}\int|x|x^2dx \\ =&\frac{|x|x^3}{3} - \frac{I}{3}\end{align*}

That implies,

\begin{align*}I + \frac{I}{3} =& \frac{|x|x^3}{3} \\ \frac{4I}{3} =& \frac{|x|x^3}{3} \\ 4I =& |x|(x^3)\end{align*}

Therefore $\displaystyle I = \frac{|x|x^3}{4}$

share|cite|improve this answer

Find the primitive of $x^3$ for $x>0$,and the primitive of $-x^3$ for $x<0$. Then the primitive you want is : $\frac{x^4}{4}$ for $x>0$, $\frac{-x^4}{4}$ for $x<0$ and for $x=0$ it must be $0$ since a primitive function is continuous. (But if you have to use integration by parts this solution is not what you want).

share|cite|improve this answer

Given that $|x|=x \operatorname{sgn}(x)$ have: $|x|^3=x^3\operatorname{sgn}(x)^3$.

Hence we have: \begin{align*} \int |x|^3 ~dx & = \int x^3 \operatorname{sgn}(x)^3 ~dx \\ & = \operatorname{sgn}(x)^3 \int x^3 ~dx \\ & = \operatorname{sgn}(x)^3 \frac{x^4}{4} \\ & = \frac{1}{4}x^3 \operatorname{sgn}(x)^3 x \\ & = \frac{1}{4}|x|^3 x. \end{align*}

share|cite|improve this answer
-1. Despite the puzzling upvote, this is wrong. – Did Jul 15 '12 at 6:22

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.