Finding the Integral of |x|: Break it Up and See What Happens

  • Thread starter agentredlum
  • Start date
  • Tags
    Integral
In summary: 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| dxOnce you integrate those
  • #1
agentredlum
484
0
The question is in the title.

This is not a homework question, just curiosity on my part.
 
Physics news on Phys.org
  • #2
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 by a moderator:
  • #3
or |x|x/2 + C
 
  • #4
HallsofIvy said:
If x< 0, then |x|= -x
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?
 
  • #5
If x<0, then -x>0.
 
  • #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.
 
  • #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:
 
  • #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]
 
  • #10
Bohrok said:
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]

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:
 
  • #11
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.
 
  • #12
agentredlum said:
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 ?

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.
 
  • #13
Bohrok said:
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.

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:
  • #14
agentredlum said:
What is the integral of |x^3 + x| ?

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:
  • #15
Bohrok said:
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!

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:
 
  • #16
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.
 
  • #17
disregardthat said:
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.

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 realize 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:
  • #19
Bohrok said:
I've been trying to work it out, but so far it hasn't turned out very good. However, Wolframalpha was able to integrate it (but the steps aren't much help) and it looks correct comparing the graph of the integral with its derivative. I probably need to sleep on it...

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:
 
  • #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:
  • #21
agentredlum said:
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.

Sometimes WA gives results like that which don't make sense. I've tried getting graphs of functions where I tried to limit the domain to nonnegative numbers by using the square root but it would use negatives too...

I've still had no luck in finding ∫|x3 - x| dx. I think it's great that WA found the integral in a "closed form" in the link I gave without breaking it up into different cases with different intervals, but it doesn't show the steps. Not even a time out, just "step-by-step results unavailable." It just seems impossible since the integral doesn't look very similar to |x3 - x|, yet differentiating it and then a lot of simplifying gives you |x3 - x| back.
 
  • #22
If you follow the method of breaking the integral up into the three parts as shown you will get an antiderivative F(x) = f(x) + 1/2 when x >= 1, -f(x) when -1<x<1, and f(x)-1/2 when x <= -1, where f(x) = |x|x(x^2-2)/4.
 
  • #23
agentredlum said:
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
Maybe it decided to consider them as complex functions, in which case they are (identical) functions whose domain is the entire complex plane.
 
  • #24
Bohrok said:
I've still had no luck in finding ∫|x3 - x| dx. I think it's great that WA found the integral in a "closed form" in the link I gave without breaking it up into different cases with different intervals, but it doesn't show the steps. Not even a time out, just "step-by-step results unavailable." It just seems impossible since the integral doesn't look very similar to |x3 - x|, yet differentiating it and then a lot of simplifying gives you |x3 - x| back.

The trick is that sgn(A) = |A|/A for A≠0.

[itex]\displaystyle\int|x^3-x|\;\mathrm{d}x=\mathrm{sgn}(x^3-x)\int x^3-x\;\mathrm{d}x=\mathrm{sgn}(x^3-x).[\tfrac14x^4-\tfrac12x^2][/itex]
[itex]\displaystyle =\frac{x^2(x^2-2)}{4}\cdot\frac{|x^3-x|}{x^3-x}=\frac{x(x^2-2)}{4}\cdot\frac{\sqrt{x^2(x^2-1)^2}}{x^2-1}[/itex]
 
  • #25
Bohrok said:
Sometimes WA gives results like that which don't make sense. I've tried getting graphs of functions where I tried to limit the domain to nonnegative numbers by using the square root but it would use negatives too...

I've still had no luck in finding ?|x3 - x| dx. I think it's great that WA found the integral in a "closed form" in the link I gave without breaking it up into different cases with different intervals, but it doesn't show the steps. Not even a time out, just "step-by-step results unavailable." It just seems impossible since the integral doesn't look very similar to |x3 - x|, yet differentiating it and then a lot of simplifying gives you |x3 - x| back.

Look at the radical in the answer, it simplifies by definition to |x^3-x|

http://www.wolframalpha.com/input/?i=integrate+sqrt((x^3-x)^2)&asynchronous=false&equal=Submit

It was pretty clever of you the way you used parenthesis to trick WA into giving an answer easier to work with. :smile:

So there is still hope that a pattern may be found.:smile:
 
Last edited:
  • #26
asw said:
The trick is that sgn(A) = |A|/A for A≠0.

[itex]\displaystyle\int|x^3-x|\;\mathrm{d}x=\mathrm{sgn}(x^3-x)\int x^3-x\;\mathrm{d}x[/itex]
While I can't remember if you're actually allowed to factor out piecewise constant functions like that, I do know that if you are, you have to be very careful to choose a piecewise constant of integration so the result is continuous.

[itex]=\mathrm{sgn}(x^3-x).[\tfrac14x^4-\tfrac12x^2][/itex]
And this is not; it has jump discontinuities at 1 and -1.
 
  • #27
Yes, obviously you can factor out constants provided you pay attention to the joins. Wolfram Alpha doesn't help out with step-functions in these situations (or even warn). The step is ½ at x=-1 and another ½ at x=1.
 
  • #28
disregardthat said:
If you follow the method of breaking the integral up into the three parts as shown you will get an antiderivative F(x) = f(x) + 1/2 when x >= 1, -f(x) when -1<x<1, and f(x)-1/2 when x <= -1, where f(x) = |x|x(x^2-2)/4.

I'll have to take a look at it later; don't know why I just skimmed over it the first time...

asw said:
The trick is that sgn(A) = |A|/A for A≠0.

[itex]\displaystyle\int|x^3-x|\;\mathrm{d}x=\mathrm{sgn}(x^3-x)\int x^3-x\;\mathrm{d}x=\mathrm{sgn}(x^3-x).[\tfrac14x^4-\tfrac12x^2][/itex]
[itex]\displaystyle =\frac{x^2(x^2-2)}{4}\cdot\frac{|x^3-x|}{x^3-x}=\frac{x(x^2-2)}{4}\cdot\frac{\sqrt{x^2(x^2-1)^2}}{x^2-1}[/itex]

That's great! Even if it's not mathematically sound, that was a very interesting method for finding the integral.
 

1. What is the definition of an integral?

The integral is a mathematical concept that represents the area under a curve in a graph. It is used to find the total value of a function over a given interval.

2. What is the absolute value function?

The absolute value function, denoted as |x|, is a mathematical function that returns the positive value of a number. It essentially ignores the negative sign of a number and returns the positive equivalent.

3. What is the difference between definite and indefinite integrals?

A definite integral has specific limits of integration, meaning that it calculates the area under a curve between two specific points. An indefinite integral, on the other hand, does not have specific limits and instead returns a general solution as a function of x.

4. How do you find the integral of |x|?

The integral of |x| can be found by breaking it into two separate integrals and using the properties of absolute value. The integral of |x| from 0 to infinity is equal to the integral of x from 0 to infinity minus the integral of -x from 0 to infinity. After solving each integral individually, you can combine them to get the final answer.

5. What is the significance of the integral of |x|?

The integral of |x| is significant because it represents the total value of the function |x| over a given interval. In other words, it gives us the area under the curve of |x|, which can be useful in various applications in physics, engineering, and economics.

Similar threads

Replies
8
Views
164
Replies
21
Views
809
Replies
31
Views
913
Replies
14
Views
719
  • Calculus
Replies
5
Views
2K
Replies
3
Views
966
Replies
4
Views
1K
Replies
5
Views
1K
Replies
1
Views
3K
Replies
4
Views
2K
Back
Top