1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Integration with absolute values

  1. Aug 11, 2011 #1
    1. The problem statement, all variables and given/known data
    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


    2. Relevant equations



    3. 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?
     
  2. jcsd
  3. Aug 11, 2011 #2

    I like Serena

    User Avatar
    Homework Helper

    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]

    As for these questions, can you redo calculating these, this time adding parentheses where they are appropriate?
     
    Last edited: Aug 11, 2011
  4. Aug 11, 2011 #3
    hi! :)

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

    I like Serena

    User Avatar
    Homework Helper

    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! :surprised
    I just edited it.
    Note that your absolute value expressions are not quite right yet.
     
  6. Aug 11, 2011 #5
    oh! of course, silly me.

    i don't understand why you get 2x-2 instead of 2-2x between 1 and 2?
     
  7. Aug 11, 2011 #6

    I like Serena

    User Avatar
    Homework Helper

    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?
     
  8. Aug 11, 2011 #7
    abs(x-2) is negative and abs(x) is positive, no?
     
  9. Aug 11, 2011 #8

    I like Serena

    User Avatar
    Homework Helper

    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))?
     
  10. Aug 11, 2011 #9
    it would all be negative..
    so
    -[(x-2)-(x)]
    = -[2x+2]
    = 2-2x

    i'm confused!
     
  11. Aug 11, 2011 #10

    I like Serena

    User Avatar
    Homework Helper

    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?
     
  12. Aug 11, 2011 #11
    yes, you're right!
    but i can't find the mistake that led me to that mistake..?
     
  13. Aug 11, 2011 #12

    I like Serena

    User Avatar
    Homework Helper

    Well, you started by saying that (x-2) is negative for 1<x<2.
    So its absolute value is -(x-2)......
     
  14. Aug 11, 2011 #13
    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?
     
  15. Aug 11, 2011 #14

    I like Serena

    User Avatar
    Homework Helper

    Let's take a step back.
    You (should have) had: -[-(x-2)-(x)] = ...
    What do you get if you work that out?
     
  16. Aug 11, 2011 #15
    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..
     
  17. Aug 11, 2011 #16

    I like Serena

    User Avatar
    Homework Helper

    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).
     
  18. Aug 11, 2011 #17
    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?
     
  19. Aug 11, 2011 #18

    I like Serena

    User Avatar
    Homework Helper

    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.
     
  20. Aug 11, 2011 #19
    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?
     
  21. Aug 11, 2011 #20

    I like Serena

    User Avatar
    Homework Helper

    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?
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Integration with absolute values
Loading...