# Integral abs(x)

1. Jun 8, 2005

### ktpr2

By what logic can I (if it's true) that $$\int_{-2}^{0} |x| dx = \int_{0}^{2} |x| dx = 2$$

I know the areas are both the same, positive, but the integrals can be negative. Specifically, i am trying to evaluate $$\int_{-2}^{1} |x| dx$$

which equals 11/5 so the negative turned positive and did the nasty with the other half, so to speak.

Last edited: Jun 8, 2005
2. Jun 8, 2005

### OlderDan

How can the integrals be negative? Only if you integrate from right to left (from greater x to smaller x). The logic that permits you to reflect the integral is the even symmetry of the function. Since

$$|-x| = |x|$$

you can do a change of variables with u = -x to transform the integral. After proving it for one arbitrary even function, it is customary to just claim the property for any even function. A similar claim holds for odd functions, but with a minus sign upon reflection, which proves that the integral of an odd function with symmetric limits must always be zero.

3. Jun 8, 2005

### Pyrrhus

You could define $|x|$ as a piecewise function

$$|x| = \left\{\begin{array}{cc}x,&\mbox{if } x \geq 0 \\-x,& \mbox{if } x < 0 \end{array}\right$$

and use the integral porperty

$$\int_{a}^{b} f(x) dx = \int_{a}^{c} f(x) dx + \int_{c}^{b} f(x) dx$$

4. Jun 8, 2005

### ktpr2

That makes sense OlderDan.

And I did use that integral property, but w/o substution;

$$\int_{-2}^{0} |x| dx + \int_{0}^{1} |x| dx = (0 - 2^2/2) + 1/2 = -2+1/2$$ which isn't correct.

I guess I should just use subsitution.

5. Jun 8, 2005

### Gale

ok, i'm really not the best person to be answering, but here's my train. Picture the graph of |x| notice the obvious symmetry, and how easy it is to get the area... they're just triangles. and you can see the area of both are equal. looking at just the integrals, you have to separate the absolute value function into a piecewise function i think. so for x<0 then you have f(x)= -x, for x>0 you have f(x)=x, right? so you get something positive either way. and when you take the integrals you get -1/2 x^2 and 1/2 x^2 respectively. combined you get that the area equals 1/2 |x|^2, so now it all works out yes?

 goddam i'm sooo slow... never mind....

Last edited: Jun 8, 2005
6. Jun 8, 2005

### ktpr2

yeah all this makes sense, but i was taught to do F(upper limit) - F(lower limit) (F is the antiderivative) and when I do that with 0 and -2 i get a negative answer, which make sthe integral result negative. Therein lies my problem. I can do away with it by substitution or inspection, but other than that I'm not sure.

7. Jun 8, 2005

### Gale

lets see if i'm quick enough...

so the indefinite integral for just negative x, since that's where your problem is..
$$\int |x| dx = \int -x dx = -\int x dx= - \frac {x^2}{2}$$ notice where that negative symbol is. now you do your definite integral, and your subraction yeilds two negatives, so they cancel, and you get the correct, positive answer.

8. Jun 8, 2005

### ktpr2

ahh i see. I'm mixing up the variable value and its result in the absolute value function. thanks gale17.

9. Jun 8, 2005

### Gale

no problemo! at least i feel somewhat useful now. i was confused at first too if its any consolation. there's a lot of negatives kicking around there.