I am having trouble using the inverse transform method with the generalized inverse
$$F^{-1}(u) = \inf \{x : F(x) \geq u\}$$
In this case, I have a piecewise pdf
$$f(x) = \begin{cases}x, & 0 \leq x \leq 1 \\ 2 - x, & 1 < x \leq 2 \end{cases}$$
which gives the cdf
$$F(x) = \begin{cases}\frac{x^2}{2}, & 0 \leq x \leq 1 \\ 2x - \frac{x^2}{2} - 1, & 1 < x \leq 2\end{cases}$$
My problem is obtaining the inverse. (especially for the part $1 < x \leq 2$)