Integration with absolute values

In summary: Well, if you have something like: abs(-x) - abs(-y) then that equals abs(x) - abs(y).But note that, for example, abs(-x) is not the same as -x.It is the same as x.
  • #1
Shannabel
74
0

Homework Statement


if f(x)=abs(x-2) and g(x)=abs(x), then solve the integral from -1 to 3 of abs(f(x)-g(x))dx


Homework Equations





The Attempt at a Solution


resolved absolute values:
when x<0, abs(x-2)-abs(x) = -x-2+x = 2
when 0<x<1, abs(x-2)-abs(x) = (-x+2)-x = 2-2x
when 1<x<2, abs(x-2)-abs(x) = (-x+2)-x = 2-2x
when x>2, abs(x-2)-abs(x) = x-2-x = 2

so now i have
2dx(between 0 and -1)+(2-2x)dx(between 0 and 1)+(2-2x)dx(between 1 and 2)+2dx(between 2 and 3)
= 2x(from 0 to -1) + 2x-x^2(between 0 and 1)+ 2x-x^2(between 1 and 2) + 2x(from 2 to 3)
= -2 + (2-1) + (2-1) +2 = 2

I should have had 6 as my answer, so I'm guessing that the first integral should be 2 instead of -2, but I'm not sure why.. any ideas?
also, if f(x)-g(x) is the same between 0 and 1 and 1 and 2, why is it that when i solve just between 0 and 2 i get a different answer than when i solve the two separately?
 
Physics news on Phys.org
  • #2
Hi Shannabel! :smile:

Let's see.
I'm going to add some parentheses:

[tex]\int_{-1}^{3} |~ |x-2| - |x| ~| dx[/tex]
[tex]= \int_{-1}^{0} 2 dx + \int_{0}^{1} (2-2x) dx + \int_{1}^{2} (2x-2) dx + \int_{2}^{3} 2 dx[/tex]
[tex]= (2x) |_{-1}^0 + (2x - x^2) |_0^1 + (x^2 - 2x) |_1^2 + (2x) |_2^3[/tex]
[tex]= (0 - 2\cdot -1) + ((2\cdot 1 - 1^2) - 0) +( (2^2 - 2\cdot 2) - (1^2 - 1\cdot 2)) + (2\cdot 3 - 2 \cdot 2)[/tex]
[tex]= 2 + (2-1) + ((4-4)-(1-2)) + (6-4)[/tex]
[tex]= 2 + 1 + 1 + 2[/tex]
[tex]= 6[/tex]

I should have had 6 as my answer, so I'm guessing that the first integral should be 2 instead of -2, but I'm not sure why.. any ideas?
also, if f(x)-g(x) is the same between 0 and 1 and 1 and 2, why is it that when i solve just between 0 and 2 i get a different answer than when i solve the two separately?

As for these questions, can you redo calculating these, this time adding parentheses where they are appropriate?
 
Last edited:
  • #3
I like Serena said:
Hi Shannabel! :smile:

Let's see.
I'm going to add some parentheses:

[tex]\int_{-1}^{3} |~ |x-2| - |x| ~| dx[/tex]
[tex]= \int_{-1}^{0} 2 dx + \int_{0}^{1} (2-2x) dx + \int_{1}^{2} (2-2x) dx + \int_{2}^{3} 2 dx[/tex]
[tex]= (2x) |_{-1}^0 + (2x - x^2) |_0^1 + (2x - x^2) |_1^2 + (2x) |_2^3[/tex]
[tex]= (0 - 2\cdot -1) + ((2\cdot 1 - 1^2) - 0) +( (2\cdot 2 - 2^2)- (1\cdot 2 - 1^2)) + (2\cdot 3 - 2 \cdot 2)[/tex]
[tex]= 2 + (2-1) + ((4-2)-(2-1)) + (6-4)[/tex]
[tex]= 2 + 1 + 1 + 2[/tex]
[tex]= 6[/tex]



As for these questions, can you redo calculating these, this time adding parentheses where they are appropriate?

hi! :)

i still don't understand.. in your third step, why do you have (0-2*(-1)) instead of (0*2*(-1))?
 
  • #4
Shannabel said:
hi! :)

i still don't understand.. in your third step, why do you have (0-2*(-1)) instead of (0*2*(-1))?

Why would you want to do a multiplication here?

To write it out more, it is:
[tex](2x)|_{-1}^{0} = ((2 \cdot 0) - (2 \cdot -1))[/tex]
This is how the result of an integral is calculated.

Btw, I made a mistake myself in my previous post!
I just edited it.
Note that your absolute value expressions are not quite right yet.
 
  • #5
I like Serena said:
Why would you want to do a multiplication here?

To write it out more, it is:
[tex](2x)|_{-1}^{0} = ((2 \cdot 0) - (2 \cdot -1))[/tex]
This is how the result of an integral is calculated.

Btw, I made a mistake myself in my previous post!
I just edited it.
Note that your absolute value expressions are not quite right yet.

oh! of course, silly me.

i don't understand why you get 2x-2 instead of 2-2x between 1 and 2?
 
  • #6
Shannabel said:
oh! of course, silly me.

i don't understand why you get 2x-2 instead of 2-2x between 1 and 2?

In your problem statement you say you have to integrate abs(f(x)-g(x))dx.
So you still need to take the absolute value of 2-2x between 1 and 2...
Which values does it take in that interval?
 
  • #7
I like Serena said:
In your problem statement you say you have to integrate abs(f(x)-g(x))dx.
So you still need to take the absolute value of 2-2x between 1 and 2...
Which values does it take in that interval?

abs(x-2) is negative and abs(x) is positive, no?
 
  • #8
Shannabel said:
abs(x-2) is negative and abs(x) is positive, no?

Hmmm, (x-2) is negative and (x) is positive.
Their absolute values are both positive. :wink:

But what is the sign of (abs(x-2) - abs(x))?
And consequently, what is the expression for abs(abs(x-2) - abs(x))?
 
  • #9
I like Serena said:
Hmmm, (x-2) is negative and (x) is positive.
Their absolute values are both positive. :wink:

But what is the sign of (abs(x-2) - abs(x))?
And consequently, what is the expression for abs(abs(x-2) - abs(x))?

it would all be negative..
so
-[(x-2)-(x)]
= -[2x+2]
= 2-2x

i'm confused!
 
  • #10
Shannabel said:
it would all be negative..
so
-[(x-2)-(x)]
= -[2x+2]
= 2-2x

i'm confused!

Hmmm, if I evaluate that, I get:
-[(x-2)-(x)] = -[-2] = 2 :confused:

I think you dropped a minus sign somewhere. Can you correct that?
 
  • #11
I like Serena said:
Hmmm, if I evaluate that, I get:
-[(x-2)-(x)] = -[-2] = 2 :confused:

I think you dropped a minus sign somewhere. Can you correct that?

yes, you're right!
but i can't find the mistake that led me to that mistake..?
 
  • #12
Shannabel said:
yes, you're right!
but i can't find the mistake that led me to that mistake..?

Well, you started by saying that (x-2) is negative for 1<x<2.
So its absolute value is -(x-2)...
 
  • #13
I like Serena said:
Well, you started by saying that (x-2) is negative for 1<x<2.
So its absolute value is -(x-2)...

but then i have -x+2 right?
and then because x is positive i end up with 2...
but you ended up with 2x-2?
 
  • #14
Shannabel said:
but then i have -x+2 right?
and then because x is positive i end up with 2...
but you ended up with 2x-2?

Let's take a step back.
You (should have) had: -[-(x-2)-(x)] = ...
What do you get if you work that out?
 
  • #15
I like Serena said:
Let's take a step back.
You (should have) had: -[-(x-2)-(x)] = ...
What do you get if you work that out?

can you explain why the whole term is negative?
i don't think i understand resolving absolute values nearly as well as i thought i did..
 
  • #16
Shannabel said:
can you explain why the whole term is negative?
i don't think i understand resolving absolute values nearly as well as i thought i did..

The thing to remember is that:
[tex]\textrm{abs}(x) = \left[ \begin{matrix}
(x), & \textrm{ if $x \ge 0$}\\
-(x), & \textrm{ if $x < 0$}
\end{matrix} \right.[/tex]

We have 1<x<2.

Let's start with abs(x-2)-abs(x)
Since (x-2) is negative, and (x) is positive, this is equal to [-(x-2)-(x)] = [2-2x]

Next step is abs(abs(x-2)-abs(x)).
This is equal to abs(2-2x), which we just derived.
Since 2-2x is negative, this is equal to -(2-2x).
 
  • #17
I like Serena said:
The thing to remember is that:
[tex]\textrm{abs}(x) = \left[ \begin{matrix}
(x), & \textrm{ if $x \ge 0$}\\
-(x), & \textrm{ if $x < 0$}
\end{matrix} \right.[/tex]

We have 1<x<2.

Let's start with abs(x-2)-abs(x)
Since (x-2) is negative, and (x) is positive, this is equal to [-(x-2)-(x)] = [2-2x]

Next step is abs(abs(x-2)-abs(x)).
This is equal to abs(2-2x), which we just derived.
Since 2-2x is negative, this is equal to -(2-2x).

i'm pretty sure i understand now :)
just one other thing.. i understand why i needed to resolve with x=0 and x=2 as boundaries, since they are both zeros.. but i don't understand why i needed to use x=1?
 
  • #18
Shannabel said:
i'm pretty sure i understand now :)
just one other thing.. i understand why i needed to resolve with x=0 and x=2 as boundaries, since they are both zeros.. but i don't understand why i needed to use x=1?

Errr... at x=0 and x=2 the complete expression is not zero.
However, the form of the expression does change, since part of the expression is an absolute value of which the argument changes sign.

So what was the expression again for 0<x<1?
And what was the expression for 1<x<2?

You should see that these are different expressions, so they have to be integrated separately.
 
  • #19
I like Serena said:
Errr... at x=0 and x=2 the complete expression is not zero.
However, the form of the expression does change, since part of the expression is an absolute value of which the argument changes sign.

So what was the expression again for 0<x<1?
And what was the expression for 1<x<2?

You should see that these are different expressions, so they have to be integrated separately.

yes, but how should i have known at the beginning that the expression changes sign at x=1?
it makes sense to me that if (x-2)=0, then x=2 is a critical point and x=0 is a critical point, but i don't see where i should have got the 1?
 
  • #20
Shannabel said:
yes, but how should i have known at the beginning that the expression changes sign at x=1?
it makes sense to me that if (x-2)=0, then x=2 is a critical point and x=0 is a critical point, but i don't see where i should have got the 1?

At the beginning you wouldn't know.
So you'd consider 0<x<2 as a first step and get the expression [abs(x-2)-abs(x)] = [2-2x].
But you still need to take the absolute value from this expression.
At what point does the expression [2-2x] change sign?
 
  • #21
I like Serena said:
At the beginning you wouldn't know.
So you'd consider 0<x<2 as a first step and get the expression [abs(x-2)-abs(x)] = [2-2x].
But you still need to take the absolute value from this expression.
At what point does the expression [2-2x] change sign?

i got it, thanks!: )
 
  • #22
Shannabel said:

Homework Statement


if f(x)=abs(x-2) and g(x)=abs(x), then solve the integral from -1 to 3 of abs(f(x)-g(x))dx

Homework Equations



The Attempt at a Solution


resolved absolute values:
when x<0, abs(x-2)-abs(x) = -x-2+x = 2   should be abs(x-2)-abs(x) = -(x-2)+x = 2

when 0<x<1, abs(x-2)-abs(x) = (-x+2)-x = 2-2x   These two could be written as one.
when 1<x<2, abs(x-2)-abs(x) = (-x+2)-x = 2-2x   These two could be written as one.  

when x>2, abs(x-2)-abs(x) = x-2-x = 2   should be abs(x-2)-abs(x) = x-2-x = 2
...

Here's the first part of your Original Post.

See corrections and/or comments in RED.
 
  • #23
I like Serena said:
The thing to remember is that:
[tex]\textrm{abs}(x) = \left[ \begin{matrix}
(x), & \textrm{ if $x \ge 0$}\\
-(x), & \textrm{ if $x < 0$}
\end{matrix} \right.[/tex]

We have 1<x<2.

Let's start with abs(x-2)-abs(x)
Since (x-2) is negative, and (x) is positive, this is equal to [-(x-2)-(x)] = [2-2x]

Next step is abs(abs(x-2)-abs(x)).
This is equal to abs(2-2x), which we just derived.
Since 2-2x is negative, this is equal to -(2-2x).

by this same logic, shouldn't i have
if x>2, abs(abs(x-2)-abs(x)) = -(abs(x-2-x)) = -(2)
since abs(x-2) and abs(x) are positive but abs(abs(x-2)-abs(x)) is negative?
i know it should be a positive 2 since that gets me to the right answer... but i don't see why?
 
  • #24
Shannabel said:
by this same logic, shouldn't i have
if x>2, abs(abs(x-2)-abs(x)) = -(abs(x-2-x)) = -(2)
since abs(x-2) and abs(x) are positive but abs(abs(x-2)-abs(x)) is negative?
i know it should be a positive 2 since that gets me to the right answer... but i don't see why?

Can you calculate (x-2-x) again?
 
  • #25
I like Serena said:
Can you calculate (x-2-x) again?

lol... thankyou :)
 

What is integration with absolute values?

Integration with absolute values is a mathematical process that involves finding the area under the curve of a function that contains absolute values. It is used to solve problems involving distance, speed, and acceleration.

Why is integration with absolute values important?

Integration with absolute values is important because it allows us to calculate the total distance traveled by an object, even if the object changes direction multiple times. This is useful in physics and engineering, where objects often change direction and have varying speeds.

How do you integrate with absolute values?

To integrate with absolute values, you must first identify the different parts of the function and split it into smaller sections where the absolute value changes direction. Then, you can use the properties of integration to solve each section separately and add them together to get the total area under the curve.

What are some common mistakes when integrating with absolute values?

One common mistake is forgetting to split the function into smaller sections where the absolute value changes direction. Another mistake is not properly applying the properties of integration to each section. It is important to be careful and pay close attention to the details when integrating with absolute values.

How is integration with absolute values used in real life?

Integration with absolute values is used in various fields such as physics, engineering, and economics. For example, it can be used to calculate the total distance traveled by a moving object, the total cost of a production process, or the total revenue from a sales curve. It is also used in data analysis and signal processing to find the area under a signal's curve.

Similar threads

  • Calculus and Beyond Homework Help
Replies
2
Views
543
  • Calculus and Beyond Homework Help
Replies
10
Views
441
  • Calculus and Beyond Homework Help
Replies
5
Views
193
  • Calculus and Beyond Homework Help
Replies
15
Views
786
  • Calculus and Beyond Homework Help
Replies
7
Views
934
  • Calculus and Beyond Homework Help
Replies
2
Views
364
  • Calculus and Beyond Homework Help
Replies
25
Views
344
  • Calculus and Beyond Homework Help
Replies
23
Views
949
  • Calculus and Beyond Homework Help
Replies
1
Views
128
  • Calculus and Beyond Homework Help
Replies
6
Views
852
Back
Top