(ii) Prove that f is onto. For each y∈R, write down an x with f(x)=y and substitute it back to check.
(iii) Hence state what kind of function f is, and write down f−1.
Writing f without the modulus sign
The modulus is defined piecewise, ∣x∣=x for x≥0 and ∣x∣=−x for x<0. Substituting this into f(x)=x∣x∣ gives
f(x)={x2,−x2,x≥0x<0
The value x=0 belongs to the first case, and it gives f(0)=02=0, which agrees with 0⋅∣0∣=0. So the two cases together define f on all of R, with no gap and no clash.
Two sign facts will be used repeatedly, so record them now.
If x≥0, then f(x)=x2≥0.
If x<0, then x=0, so x2>0 and therefore f(x)=−x2<0.
In short: f takes non-negative values on the first branch and strictly negative values on the second.
(i) f is one-one
Let x1,x2∈R with f(x1)=f(x2). There are three cases to settle, according to which branch each input falls in.
Case 1: both x1≥0 and x2≥0. Then f(x1)=x12 and f(x2)=x22, so
x12=x22
Both x1 and x2 are non-negative, so taking the non-negative square root of each side gives x1=x12=x22=x2. (Equivalently, x12−x22=(x1−x2)(x1+x2)=0; if x1+x2=0 then two non-negative numbers sum to zero, forcing x1=x2=0, and otherwise x1−x2=0.) So x1=x2.
Case 2: both x1<0 and x2<0. Then f(x1)=−x12 and f(x2)=−x22, so
−x12=−x22⟹x12=x22
Now both x1 and x2 are negative, so −x1>0 and −x2>0, and (−x1)2=x12=x22=(−x2)2. Taking non-negative square roots, −x1=−x2, and hence x1=x2.
Case 3: one input is non-negative and the other is negative. Say x1≥0 and x2<0. By the sign facts recorded above,
f(x1)=x12≥0andf(x2)=−x22<0
A number that is ≥0 cannot equal a number that is <0, so f(x1)=f(x2). This contradicts our assumption f(x1)=f(x2), so this case cannot occur at all. Exchanging the names x1 and x2 disposes of the remaining mixed case in the same way.
Cases 1 and 2 give x1=x2 and Case 3 never arises, so f(x1)=f(x2) forces x1=x2. Hence f is one-one.
Note where the modulus is doing the work. The function x↦x2 on all of R is not one-one, because −1 and 1 share the image 1. Multiplying by ∣x∣ rather than by x keeps the sign of the input, so the two halves of the real line are sent to opposite halves instead of being folded on top of each other: f(−1)=−1 while f(1)=1.
(ii) f is onto
Let y∈R be arbitrary. We exhibit an x with f(x)=y, again in two cases.
Case y≥0. Take
x=y
This is a real number because y≥0, and y≥0, so x falls in the first branch of f. Substituting back,
f(x)=x2=(y)2=y
Case y<0. Then −y>0, so −y is a real number and −y>0. Take
x=−−y
Since −y>0, we get x<0, so x falls in the second branch of f. Substituting back,
f(x)=−x2=−(−−y)2=−(−y)2=−(−y)=y
In both cases a real x with f(x)=y has been produced explicitly, so every element of the codomain R is an image. Hence f is onto.
A couple of numerical checks on those formulas: for y=9 we get x=9=3 and f(3)=3⋅∣3∣=9; for y=−9 we get x=−9=−3 and f(−3)=−3⋅∣−3∣=−3⋅3=−9.
(iii) What f is, and its inverse
Being both one-one and onto, f is a bijection from R to R, and therefore invertible.
The inverse is read straight off part (ii): the x constructed there is precisely f−1(y). So
f−1(y)={y,−−y,y≥0y<0
The two branches agree at y=0, where the first gives 0=0. Written in one line, f−1(y) is the square root of ∣y∣ carrying the sign of y.
Finally, a check that f−1 really is the inverse, both ways round.
For x≥0: f(x)=x2≥0, so the first branch of f−1 applies and f−1(f(x))=x2=x, using x≥0.
For x<0: f(x)=−x2<0, so the second branch applies and f−1(f(x))=−−(−x2)=−x2=−(−x)=x, using x2=∣x∣=−x for negative x.
For y≥0: f−1(y)=y≥0, so f(f−1(y))=(y)2=y.
For y<0: f−1(y)=−−y<0, so f(f−1(y))=−(−−y)2=−(−y)=y.
So f−1∘f and f∘f−1 are both the identity on R, confirming the answer.