# Inverse transform method with piecewise pdf

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$$)

• It's a quadratic, so solving $u = 2x - \frac12 x^2 -1$ for $x$ should be easy (as is identifying which root is the correct one). Where do you strike difficulty? – Glen_b -Reinstate Monica Jan 30 at 4:44