Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

What is the integral of |x| ?

  1. Aug 10, 2011 #1
    The question is in the title.

    This is not a homework question, just curiousity on my part.
     
  2. jcsd
  3. Aug 10, 2011 #2

    HallsofIvy

    User Avatar
    Staff Emeritus
    Science Advisor

    If x< 0, then |x|= -x and its integral is [itex]-x^2/2+ C[/itex]

    If [itex]x\ge 0[/itex], then |x| x and its integral is [itex]x^2/2+ C[/itex]
     
    Last edited: Aug 10, 2011
  4. Aug 10, 2011 #3

    disregardthat

    User Avatar
    Science Advisor

    or |x|x/2 + C
     
  5. Aug 10, 2011 #4
    How? I thought the whole purpose of the absolute value stemmed back to distances along a number line, therefore you couldn't get a negative value out of the absolute value of a number or a function?
     
  6. Aug 10, 2011 #5
    If x<0, then -x>0.
     
  7. Aug 10, 2011 #6
  8. Aug 10, 2011 #7
    [tex]\int|x| dx = \frac{1}{2}x|x| + c[/tex]If you write |x| as √(x2) and use integration by parts, you can find the integral.
     
  9. Aug 10, 2011 #8
    I know HallsofIvy figured it out because calculations were shown, but did the rest of you look it up?

    HallsofIvy, can you combine your 2 solutions into a single solution to get wiki answer?

    I know wiki mentions integration by parts, but did anyone use a simpler way to get the answer? It doesn't have to be rigorous, it just has to work. Don't worry about rigor, just functionality.:smile:

    What is the integral of |x^3| ?

    What is the integral of |x^n| for odd n?

    EDIT* There is nothing wrong (IMHO) with looking up the answer, but there is nothing wrong with working it out for yourself.:biggrin:
     
  10. Aug 10, 2011 #9
    I never knew wikipedia showed how to integrate it; just noticed it right now. I personally did it once because I wanted to derive it myself, and for higher odd powers of x such as |x3| and there is a pattern.[tex]\int|x^3|dx = \frac{1}{4}x^3|x| + c, \int|x^5|dx = \frac{1}{6}x^5|x| + c, \text{etc.}[/tex]So in general,[tex]\int|x^n|dx = \frac{1}{n + 1}x^n|x| + c \text{ for odd n}[/tex]
     
  11. Aug 10, 2011 #10
    Oh, this is interesting. Is there any difference to the answer if you represent it as |x^n|x/(n+1) + c for odd n ?

    Well done in deriving it for yourself.

    :smile:
     
  12. Aug 10, 2011 #11

    Mute

    User Avatar
    Homework Helper

    When you have an absolute value, you just split it into cases:

    If [itex]x > 0,~|x^n| = x^n[/itex], so the integral is [itex]x^{n+1}/(n+1)[/itex].

    If [itex]x < 0,~|x^n| = - x^n[/itex], so the integral is [itex]-x^{n+1}/(n+1)[/itex].

    (for n odd, of course)
    This can be written as a single results using the "sign function", [itex]\mbox{sgn}(x)[/itex], which returns the sign of x. Hence, the integral may be written

    [tex]\mbox{sgn}(x) \frac{x^{n+1}}{n+1}.[/tex]

    For x not zero, the sign function is equivalent to |x|/x or x/|x| (as is hopefully obvious after thinking about it for a second), so you can insert the first form there to get the results people have been throwing around.

    Note that since the sign function to an even power is always 1, you can always insert sign functions of even powers to shift around the exponents, so you can write the integral as

    [tex]\frac{|x|^ax^b}{n+1},[/tex]
    where a + b = n+1, and a and b are odd numbers.
     
  13. Aug 10, 2011 #12
    No difference; it's the same way as how I have it. I should also add positive to the restriction on n: for positive odd n.
     
  14. Aug 10, 2011 #13
    Of course, right you are. I haven't explored what happens when n is negative. It is interesting to me that the integrals we are considering, |x^n|, for positive odd n, to get the answer you just write it down, multiply by x, divide by the total number of factors of x and add a 'c'. Integration by parts is not necessary. It makes me wonder if there are other functions out there that work simply like this, besides the normal x^n without absolute value symbol.

    What is the integral of |x^3 + x| ?
     
    Last edited: Aug 11, 2011
  15. Aug 11, 2011 #14
    I thought this would be difficult and involve integration by parts, but it turned out quite simple actually:
    |x3 + x| = |x(x2 + 1)| = |x||x2 + 1| = |x|(x2 + 1) = |x|x2 + |x| = |x3| + |x|, using the facts that x2 + 1 = |x2 + 1| and x2 = |x2| since the former in each case is never negative, and |ab| = |a||b|, so
    ∫|x3 + x| dx = ∫|x3| dx + ∫|x| dx
    Once you integrate those, you can combine them and make the result look more condensed.

    If you had |x3 - x|, that would be a different story!
     
    Last edited: Aug 11, 2011
  16. Aug 11, 2011 #15
    It's very nice how you turned this problem into something we have a shortcut for already!

    So the integral of |x^3 + x| is |x^3|x/4 + |x|x/2 + C

    I like your algebra manipulation of absolute value so let me use it too. Disregard the C for now...

    (|x^3| + 2|x|)x/4 common denominator 4 and factor out x...now work inside the parenthesis...

    |x|(|x^2| + 2)x/4 for the same reasons you gave above...

    |x^2| + 2 = |x^2 + 2|

    |x||x^2 + 2| = |x^3 + 2x|

    |x^3 + 2x|x/4 again for same reasoning as you above... now 1/4 = 1/|4| so you can insert 1/4 into the parenthesis without fear, so you get finally...

    |x^3/4 + x/2|x + C

    Now if you compare this answer to the question...what is integral of |x^3 + x|, you write it down, divide x^3 by 4 inside absolute value (n + 1 for n = 3), divide x by 2 inside absolute value (n + 1 for n = 1), multiply the whole thing by x and add C

    Putting it all together...

    integral of |x^3 + x| = |x^3/4 + x/2|x + C

    I think the shortcut is obvious now in this case and should work for any integral of |ax^3 + bx| where both a,b are non negative.

    I'm still working on integral of |x^3 - x| and trying to make it co-operate with the shortcut, any ideas?:smile:
     
  17. Aug 11, 2011 #16

    disregardthat

    User Avatar
    Science Advisor

    Split the integral as such:

    [tex]\int^t_{1} |x||x^2-1| dx = \int^t_{1} |x|(x^2-1) dx[/tex] for t >= 1,

    [tex]\int^t_{-1} |x||x^2-1| dx = \int^t_{-1} |x|(x^2-1) dx[/tex] for t <= -1

    [tex]\int^t_{0} |x||x^2-1| dx = \int^t_{0} |x|(1-x^2) dx[/tex] for -1 < t < 1

    These three integrals are solved by the method above. For each domain, scale by a constant to get an answer on the form F(x) + C, but it is not necessary.
     
  18. Aug 11, 2011 #17
    Thank you. This is all very nice and important but right now i'm working on my own calculations using pencil and notebook. My PS3 browser does not decode LaTeX so its very hard sometimes to decode it using my brain. Can you solve all 3 integrals above and combine them into a single expression that gives the correct area of |x^3 - x| between the curve and the x-axis from x= -5 to x= 3 for example?

    Let me give an simple example. The integral of x from x= -5 to x= 5 gives zero. I'm interested in the integral as AREA between 2 curves.

    When you take the absolute value of a function it has 2 important graphical effects for my interests concerning area.

    1) Portions below the x-axis are reflected by symmetry to portions above the x-axis with area unchanged.

    2) Portions above the x-axis remain unchanged

    This can be helpful when you have a function with portions below the x-axis. If one is interested in AREA then you don't have to find roots, split up the integral, use symmetry, etc. Just integrate it's absolute value. If you can find the integral then a single expression will give you the right answer for the area.

    Now, I realise integrating |f(x)| is harder than integrating f(x) unless shortcuts can be found and we have shown in previous post's that at least some shortcuts exist. The question interesting to me is can the shortcuts be extended to include more general cases. Any ideas?:smile:

    This can be helpful, for example, if you are writing a computer program designed to calculate areas. If the program recognises a particular expression as lending itself to the shortcut, then it doesn't have to do integration by parts or some other more exotic method.

    Or consider it as a contest between bohrok, who knows the shortcut, and someone who doesn't know the shortcut. The question is find integral of |x^n| for positive odd n. Bohrok gets the answer in 1523 milliseconds, the other person not nearly as fast
     
    Last edited: Aug 11, 2011
  19. Aug 11, 2011 #18
  20. Aug 11, 2011 #19
    OH...MY...GOD you have no idea how much i want to thank you for that link. For months i've been hearing about wolfram alpha but i thought it was a computer program like Maple or Mathematica. I didn't know it was on the net, and my PS3 browser decodes it!!!!!

    If i was in your neighborhood right now, i'd buy you a beer, i'd buy you 2 beers!.:smile:

    As far as integral of |x^3 - x| my shortcuts are not working unless i made a mistake.

    As for integral of |x^3| wolfram gave answer involving sgn(x) but you and i both know we don't need that. Haaaaaaaa.... Haaaa!

    Humanity strikes back against the machines.:smile:
     
  21. Aug 12, 2011 #20
    According to wolframalpha...sqrt(abs(x)) has the same graph as abs(sqrt(x)) but that can't be right since domains are different

    The first one has domain all real x

    The second one has domain all rea NON-NEGATIVE x

    What is going on here?

    http://www.wolframalpha.com/input/?...,abs(x^(1/2))&asynchronous=false&equal=Submit

    In the input interpretation it makes the correct interpretation but in the plots it doesn't.
     
    Last edited: Aug 12, 2011
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: What is the integral of |x| ?
Loading...