integrating a function with absolute value

228 Views Asked by At

i don't know precisely how to deal with it, i just thought i could use the signum function but it's my first time dealing with it so i don't know if it is fine and especcially how to proceed further, anyway this is what i tried: $$ \int_{-2}^{1} ||x+1|-1| \,dx = \int_{-2}^{1} |(x+1)sgn(x+1)-1| $$ $$=\int_{-2}^{1} [(x+1)sgn(x+1)-1) sgn[( (x+1)sgn(x+1)-1]$$ $$=\int_{-2}^{1} [(x+1)sgn(x+1) ]sgn[( (x+1)sgn(x+1)-1] -\int_{-2}^{1} sgn[ (x+1)sgn(x+1)-1]$$$$= \int_{-2}^{1} [(x+1)sgn(x+1) ]sgn[( (x+1)sgn(x+1)-1] -[xsgn[ (x+1)sgn(x+1)-1]^1_{-2} ] $$

i don't know how to proceed, do i need for example to substitute something for then integrating by parts? Anyway thanks for the responses and sorry for the bad English and the bad brackets

3

There are 3 best solutions below

0
On

There is no need to use the sign function, you just have to reason about the sign of the integrand. First of all, split the integral: $$ \int_{-2}^1 ||x+1|-1| dx=\int_{-2}^{-1} ||x+1|-1| dx+\int_{-1}^1 ||x+1|-1| dx$$ Consider the second integral and note that if $x\in [-1,1]$, then $|x+1|=x+1$. So you have: $$\int_{-1}^1 ||x+1|-1| dx=\int_{-1}^1 |x| dx=-\int_{-1}^0xdx+\int_0^1xdx=1 $$ Now, as we've done before, note that if $x\in[-2,-1]$, you have $|x+1|=-x-1$: $$\int_{-2}^{-1} ||x+1|-1| dx=\int_{-2}^{-1} |-x-2| dx=\int_{-2}^{-1} (x+2) dx=\frac{1}{2} $$ Finally you have: $$ \int_{-2}^1 ||x+1|-1| dx=\frac{3}{2}$$

0
On

enter image description here

Just graph the function, the integral is $3$ times the area of triangle $ABC$, by using the fact that an integral represents the algebraic area between x-axis and the function's curve.

Also using the fact that absolute value of linear functions is piecewise linear.

0
On

If we define the absolute value function as

$$ |x| = \begin{cases} x, & \text{if }x \ge 0 \\ -x, & \text{if }x < 0 \end{cases} $$

then we can use this formulation repeatedly to write out the integrand piecewise and also know where to break up the bounds.

Let $f(x) = ||x+1|-1|$. Then

$$ f(x) = \begin{cases} |x+1|-1, & \text{if }|x+1| -1 \ge 0 \\ 1-|x+1|, & \text{if }|x+1| -1 < 0 \end{cases} $$

Consider the second of these branches. $ |x + 1| - 1 < 0 $ can be simplified as $ -2 < x < 0 $. Therefore, the condition on the first branch splits into two:

$$ f(x) = \begin{cases} |x+1|-1, & \text{if }x \ge 0 \\ 1-|x+1|, & \text{if }-2 < x < 0 \\ |x+1|-1, & \text{if }x \le -2 \end{cases} $$

Finally, remove the last set of absolute value bars. $|x+1| = x + 1 $ if $x\ge -1$ and $-(x+1)$ if $x<-1$. For the outer branches, $x$ is already at least $0$ or less than $-2$, so we can simply swap out $|x+1|$ with the appropriately signed expression. And since the change occurs at $x=-1$, we can split up the middle branch appropriately as well, yielding

$$ f(x) = \begin{cases} x, & \text{if }x \ge 0 \\ -x, & \text{if }-1 \le x < 0 \\ x+2, & \text{if }-2 < x < -1 \\ -x-2, & \text{if }x \le -2 \end{cases} $$

From here, the integration should be simple enough.

(The seemingly random use of strict and non-strict inequalities simply comes from the straight application of the initial definition of $|x|$. They can be cleaned up and made to look more consistent however you like, if that's preferable :). Of course, they have no impact on the value of your integral.)