Inverse of a Piecewise Function

inverseinverse functionpiecewise-continuity

This question may be insanely simple, but I'm unsure.

Let's say we have the following function:
$$ f(x) = \begin{cases} x & 0 \leq x < 1 \\ x-1 & 1 \leq x < 2 \\ 0 & \text{otherwise} \end{cases}$$

The CDF (integral) is obviously
$$ F(x) = \begin{cases} \frac{1}{2}x^2 & 0 \leq x < 1 \\ \frac{1}{2}x^2-x+1 & 1 \leq x < 2 \\ 0 & \text{otherwise} \end{cases} $$

How would I calculate the Inverse CDF from this?

(Note: The +1 is required to make it add to 1 and not suddenly become negative. I don't know if that matters for the Inverse CDF.)

Best Answer

First, the CDF you calculated is wrong. The correct integral function is the following

$$ F_X(x) = \begin{cases} 0 & x <0 \\ \frac{1}{2}x^2 & 0 \leq x < 1 \\ \frac{1}{2}x^2-x+1 & 1 \leq x < 2 \\ 1& x \geq 2 \end{cases} $$

To invert it (say to find the quantile function) it is only a matter of inverting the 2nd degree expression in the desired interval.

  • Example 1: Find the median:

$F_X(x)=0.5 \rightarrow x=1$

  • Example 2: Find the 3rd quartile:

$F_X(x)=0.75 \rightarrow x\approx 1.71$

Related Question