4
$\begingroup$

Today, one of my student found the following integral and asked me for its solution:

$$\int|x|\; dx$$

I used some formal methods for it, but it seems I need a magic trick. I wish, I am noting a valuable question here for others. Thanks for your time.

  • 2
    What is the magic trick?2012-11-27
  • 0
    @Tunococ: I didn't note that I could break the integral respect to $x>0$ and $x<0$ as Chris did below. Shame! I was thinking about a wrong way. Sorry.2012-11-27

1 Answers 1

4

For $x>0$, $|x|=x$, so has antiderivative $\frac{x^2}{2}$. For $x<0$, $|x|=-x$, and so has antiderivative $-\frac{x^2}{2}$. Thus we should consider the function $$f(x)=\begin{cases}\frac{x^2}{2} & x>0 \\-\frac{x^2}{2} & x \le 0 \end{cases}$$ It's not hard to check from first principles that $f'(0)=0$, and so $f$ is indeed an antiderivative of $|x|$. Of course, so is $f+c$ for any constant $c$.

  • 4
    For those not fond of "cases" constructs: You may use $\frac{x\cdot|x|}2$2012-11-27
  • 0
    @HagenvonEitzen: Honestly, I wanted to note that, but you did. Yes it is $\frac{x|x|}{2}$. Thanks both of you.2012-11-27