Step 1: Analyze the first piece of the function:
\[
f(x) = 1 - x \quad \text{for} \quad x \in [-1, 1]
\]
When \( x = -1 \), \( f(x) = 1 - (-1) = 2 \)
When \( x = 1 \), \( f(x) = 1 - 1 = 0 \)
So for this part:
\[
f(x) \in [0, 2]
\]
Step 2: Analyze the second piece of the function:
\[
f(x) = x - 1 \quad \text{for} \quad x \in (1, 2]
\]
When \( x = 1^+ \), \( f(x) \to 0^+ \), when \( x = 2 \), \( f(x) = 2 - 1 = 1 \)
So this part also gives:
\[
f(x) \in (0, 1]
\]
Step 3: Combine both intervals:
From the first part: \( f(x) \in [0, 2] \)
From the second part: \( f(x) \in (0, 1] \)
The union of these is:
\[
B = [0, 2]
\]
Since the function is a surjection onto \( B \), all values in \( [0, 2] \) must be covered. We’ve shown that’s true.