Take the 2-minute tour ×
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.

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.

share|improve this question
2  
What is the magic trick? –  Tunococ Nov 27 '12 at 20:19
    
@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. –  B. S. Nov 27 '12 at 20:25
add comment

1 Answer 1

up vote 4 down vote accepted

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$.

share|improve this answer
3  
For those not fond of "cases" constructs: You may use $\frac{x\cdot|x|}2$ –  Hagen von Eitzen Nov 27 '12 at 20:25
    
@HagenvonEitzen: Honestly, I wanted to note that, but you did. Yes it is $\frac{x|x|}{2}$. Thanks both of you. –  B. S. Nov 27 '12 at 20:27
add comment

Your Answer

 
discard

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.