How do I check if a function is bijective, if the formula contains multiple absolute values? I'd usually solve such problems by taking $x_1$ and $x_2$ that belong to the domain and then assuming $f(x_1)=f(x_2)$, trying to get $x_1=x_2$ out of that (to check if it's injective), and solving $f(x)=y$ for $x$ (to check if it's onto). But I got confused on this one, as it will have multiple cases. How does one solve this?
$$f : \left[\frac{1}{3},1\right] \rightarrow \mathbb{R}, \quad f(x)=\sqrt{9-|x-1|-|2x-1|}$$
 A: Hint:
It certainly is not onto, since $f$ is continuous, and thus the image of a bounded interval is a bounded interval.
As to injectivity, you can remove the absolute values from the expression of $f(x)$: as the pivot-values are $1$ and $\frac 12$, you get


*

*If $\frac 13\le x\le\frac 12$, we have 
$$f(x)=\sqrt{9-(1-x)-(1-2x)}=\color{red}{\sqrt{7+3x}}.$$
On this interval, $f(x)$ is increasing from … to …

*If $\frac 12\le x\le 1$, we have
$$f(x)=\sqrt{9-(1-x)-(2x-1)}=\color{red}{\sqrt{9-x}}. $$
On this interval, $fx)$ is decreasing from … to …
A: While the general definitions and approaches that you stated in your post are absolutely correct, in practice sometimes they work and sometimes they don't — if the function is too complicated. And if we try to apply the straightforward approach, but can't get anywhere, then we probably need to think of some indirect ways to approach the question.
Say, in this example, it's easy to show that the function is not onto all of $\mathbb{R}$. Since $f(x)=\sqrt{\text{something}}$, it immediately follows that $f(x)\ge0$ for any input $x$. We're not saying that all non-negative numbers are in the range; but all negative numbers definitely are not in the range, so this function is not onto.
Now, injectivity. Absolute values should raise some suspicion that maybe it isn't one-to-one. In that case, you don't need to do a general proof, but you only need to provide at least one counterexample of $x_1\neq x_2$ such that $f(x_1)=f(x_2)$. Let's think… First of all, since $x\le1$ in the given domain, the first absolute is irrelevant and we can open it up and simplify. Then observe that $|2x-1|$ switches its sign at $x=1/2$. Can you find two points $x_1\neq x_2$ in the domain such that $|2x_1-1|=|2x_2-1|$? That's all you need to make the values of the function equal.
A: This function $f : \left[\frac{1}{3},1\right] \rightarrow \mathbb{R}, \quad f(x)=\sqrt{9-|x-1|-|2x-1|}$ is not bijective. take $y=-1$
