Consider $X∼unif [0,1]$. Find a function $g: \mathbb{R} \longrightarrow \mathbb{R}$, such that g(X) has pdf $f(t) = \begin{cases} {t+1}, & \text{$-1 \leq t\leq 0$} \\ {1-t}, & \text{$0<t\leq 1$}\end{cases}$.
Can you help me, please? I do not know what I have to do.
Hint/Guide
Compute the cdf $F$ corresponding to $f$ (i.e. $F(x)=\int_{-\infty}^x f(t)\, dt)$ and use the fact that $F^{-1}(X)$ has the same distribution as $F$. So we can take $g=F^{-1}$.