6
$\begingroup$

Been searching the net for awhile and everything just comes back about doing the definite integral. So just thought to ask here.

Title says it all. Is there a closed form solution for the indefinite integral $\int |x| dx$ ?

$\endgroup$
  • 4
    $\begingroup$ Define $|x|$ as a piecewise function and integrate each piece independently. Also search $sgn(x)$ and use it to convert your piecewise integral back to one equation. $\endgroup$ – Ahmed S. Attaalla Oct 6 '15 at 22:57
  • 2
    $\begingroup$ an antiderative of $f(x)=|x|$ is $F(x)=\frac 12 x |x| $ $\endgroup$ – WW1 Oct 6 '15 at 23:01
6
$\begingroup$

Using integration by parts

$$\int |x|~dx=\int \mathrm{sgn}(x)x~dx=|x|x-\int |x| ~dx$$

since $\frac{d}{dx} |x|=\mathrm{sgn}(x)$ on non-zero sets. This yields

$$\int |x| ~dx = \frac{|x|x}{2}~.$$

| cite | improve this answer | |
$\endgroup$
6
$\begingroup$

You are looking for a function $f(x)$ so that $$\int_a^b |x|dx=f(b)-f(a).$$ This is what is meant by $\int |x|dx$. I propose that $f(x)=x|x|/2$ is such a function. Let us test it. If both $a$ and $b$ are both positive, then $$\int_a^b |x|dx=\int_a^b x\,dx=b^2/2-a^2/2=b|b|/2-a|a|/2=f(b)-f(a).$$ If $a$ and $b$ are both negative, then $$\int_a^b |x|dx=-\int_a^b x\,dx=-b^2/2-(-a^2/2)=b|b|/2-a|a|/2=f(b)-f(a).$$ Finally, if $a<0$ and $b>0$, we get $$\int_a^b |x|dx=-\int_a^0 x\,dx+\int_0^b x\,dx=b^2/2+a^2/2=b|b|/2-a|a|/2=f(b)-f(a).$$ Of course, we could have $b<0$ and $a>0$, but then we could switch the limits, and this reduces to the third case.

Thus, $f(x)=x|x|/2$ is an indefinite integral, or antiderivative of $|x|$.

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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