Let f(x) = |x−3| +|x−5|
Then f(x) = 2x - 8 if x ≥ 5
= 8 - 2x if x ≤ 3
True
|x−3| = x-3 if x > 3
= 3 - x if x < 3
|x−5| = x-5 if x>5
= 5 - x if x< 5
So, we have to split the function f at the point 3 and 5. There will be three elements.
So for x<3 f(x) = 3-x + 5-x = 8-2x
For x>5 f(x) = x-3+x-5 = 2x-8