OK, let’s take a closer look at the absolute expressions. The key values of x are x=-1 and x=2.

So we look at x≤-1, -1≤x≤2, and x≥2. For each of these domains, we can see how the function behaves.

x≤-1: if we put x=-1 into the first absolute we get -3 and |-3| is 3=2-x=-(x-2). The second absolute is zero. When x=-2, say, the first absolute evaluates to -4 and |-4|=4=2-x, and the second absolute evaluates to 1=-(x+1).

So f(x≤-1)=3(2-x)+(x+1)=6-3x+x+1=7-2x.

What we learned from this is that (2-x) replaces |x-2| and -(x+1) replaces |x+1|, because both expressions would be negative, so both needed to be negated. Remember that negating a negative quantity makes it positive.

Consider -1≤x≤2: f(x)=3(2-x)-(x+1)=6-3x-x-1=5-4x. This time we only negate x-2.

Finally, x≥2: f(x)=3(x-2)-(x+1)=3x-6-x-1=2x-7. Neither needs to be negated.

You now have enough information to write the piecewise definition of f(x):

For x≤-1 f(x)=7-2x, for -1≤x≤2 f(x)=5-4x, for x≥2 f(x)=2x-7. f(x) is continuous, so the pieces overlap at x=-1 and x=2 when f(x)=9 and -3 respectively.