How do you evaluate #int abs(x-1)dx# for [0, 5]?

1 Answer
Oct 22, 2015

#int_{0}^{5}|x-1|\ dx=17/2=8.5#

Explanation:

Note that #|x-1|=x-1# when #x geq 1# and #|x-1|=1-x# when #x<1#.

Therefore,

#int_{0}^{5} |x-1|\ dx=int_{0}^{1}(1-x)\ dx+ int_{1}^{5}(x-1)\ dx#

#=[x-x^2/2]_{0}^{1}# +

#[x^2/2-x]_{1}^{5}#

#=1-1/2+((25/2-5)-(1/2-1))#

#=1/2+15/2+1/2=17/2=8.5#.

This answer can also be found graphically by plotting the function #y=|x-1|# and adding up areas of appropriate triangles. The picture below helps us see that the integral equals #1/2 * 1 * 1+1/2 * 4 * 4=1/2+8=17/2=8.5#.

graph{|x-1| [-1.926, 8.074, -0.84, 4.16]}