# How would calculate `int_(-2)^4` (maxim{|x-1|,2})?

You need to use the maximum function definition, such that:

`maximum {|x-1|,2} = f(x) = {(2, |x-1|<=2),(|x-1|, |x-1|>2):}`

You need to solve the absolute value inequality `|x-1|<=2` , such that:

`|x-1|<=2 => -2<= x - 1 <= 2 => -2 + 1 <= x - 1 + 1 <= 2 + 1`

`-1 <= x <= 3 => x in [-1;3]`

`f(x) = {(2, x in [-1;3]),(|x-1|, x in (-oo,-1)U(3,oo)):}`

You need to use the additivity convention of the definite integrals, such that:

`int_(-2)^4 f(x)dx = int_(-2)^(-1) (1 - x)dx + int_(-1)^3 2dx + int_3^4 (x - 1)dx`

`int_(-2)^4 f(x)dx = -(1-x)^2/2|_(-2)^(-1) + 2x|_(-1)^3 + (x-1)^/2|_3^4`

Using the fundamental theorem of calculus, yields:

`int_(-2)^4 f(x)dx = ((1 + 1)^2/2 - (1+2)^2/2) + 2(3 + 1) + (3^2/2 - 2^2/2)`

`int_(-2)^4 f(x)dx = -5/2 + 8 + 5/2`

`int_(-2)^4 f(x)dx = 8`

Hence, evaluating the given definite integral, using the definition of maximum function and the additivity convention of definite integrals, yields ` int_(-2)^4 f(x)dx = 8.`