Find pdf of given random variable I have the following question. I would like to get some feedback regarding my approach.

Let $U$ be random variable such that $U\sim \text{Unif}\left((0,1)\right)$. Define the following r.v:
  $$Z_1=\begin{cases}\ln(2U),& 0<U\le \frac{1}{2}\\ -\ln(2(1-U)),& \frac{1}{2}<U<1\end{cases} \quad , \quad Z_2=\sqrt{-2\ln(1-U)}$$ Derive the PDFs of $Z_1,Z_2$.

My try:
First compute the CDFs of $Z_1,Z_2$ and then derive the results in order to get the PDFs.

For $Z_1$ we split into cases:


*

*For $0<U\le \dfrac{1}{2}$ (of course $Z_1\le 0$): $$F_{Z_1}(z)=P\left(Z_1\le z\right)=P\left(\ln(2U)\le z\right)=P\left(2U\le \exp(z)\right)=P\left(U\le \frac{1}{2}\exp(z)\right)$$

*For $\dfrac{1}{2}<U<1$ (of course $Z_1>0$): \begin{align*}F_{Z_1}(z)&=P(Z_1\le z)=P\left(-\ln(2(1-U))\le z\right)\\&=P\left(\frac{1}{2(1-U)}\le\exp(z)\right)=P\left(U\le 1-\frac{1}{2}\exp(z)\right)\end{align*}


Thus, $F_{Z_1}(z_1)=\begin{cases} \dfrac{1}{2}\exp(z),&z\le 0 \\ 1-\dfrac{1}{2}\exp(-z),&z>0\end{cases}\implies \boxed{f_{Z_1}(z_1)=\begin{cases}\dfrac{1}{2}\exp(z),&z\le 0 \\ \dfrac{1}{2}\exp(-z),&z>0\end{cases}}$

For $Z_2$ we first notice that $Z_2>0$, i.e $\forall z_2\le 0: f_{Z_2}(z_2)=0$. Now, \begin{align}F_{Z_2}(z)&=P(Z_2\le z)=P\left(\sqrt{-2\ln(1-U)}\le z\right)=P\left(-2\ln(1-U)\le z^2\right) \\ &=P\left(-\ln(1-U)\le \frac{z^2}{2}\right)=P\left(\frac{1}{1-U}\le\exp\left(\frac{z^2}{2}\right)\right)=P\left(U\le 1-\exp\left(-\frac{z^2}{2}\right)\right)\end{align}Thus $F_{Z_2}(z_2)=\begin{cases}0,&z_2\le 0 \\ 1-\exp\left(-\dfrac{z_2^2}{2}\right),&z_2>0\end{cases}\implies\boxed{f_{Z_2}(z_2)=\begin{cases}0,&z_2\le 0\\ z_2\exp\left(-\dfrac{z_2^2}{2}\right),&z_2>0\end{cases}}$

Thank you.
 A: Your results are correct, it would have been better if you had included the restriction on $U$ directly in your probability formula. 
For example , in your first line , taking $z=1, $$ P\left(U\le \frac{1}{2}\exp(z)\right)=1$ , while in your context it is actually $0.5$ because of your restriction on $U$.
On my side, let $z \in \mathbb{R}$,
$$P(Z_1 \leq z)=P(Z_1 \leq z, U \in]0,\frac{1}{2}])+P(Z_1 \leq z, U \in]\frac{1}{2},1[)$$
$$=P(log(2U) \leq z, U \in]0,\frac{1}{2}])+P(-log(2(1-U)) \leq z, U \in]\frac{1}{2},1[)$$
$$=P(U \leq \frac{e^z}{2}, U \in]0,\frac{1}{2}])+P(U \leq 1-\frac{e^{-z}}{2}, U \in]\frac{1}{2},1[)$$
We have that $\frac{e^z}{2} >0$, therefore
$$P(U \leq \frac{e^z}{2}, U \in]0,\frac{1}{2}])=P(U \leq min(\frac{1}{2},\frac{e^z}{2}))=min(\frac{1}{2},\frac{e^z}{2})$$
$1>1-\frac{e^{-z}}{2}>\frac{1}{2}$ when $z>0$, and $1-\frac{e^{-z}}{2}<\frac{1}{2}$ when $z<0$, therefore 
$$P(U \leq 1-\frac{e^{-z}}{2}, U \in]\frac{1}{2},1[)=P(\frac{1}{2}<U \leq 1-\frac{e^{-z}}{2})1_{\{z>0\}}=\frac{1}{2}(1-e^{-z})1_{\{z>0\}}$$
Thus,
$$F_{Z_1}(z)=min(\frac{1}{2},\frac{e^z}{2})+\frac{1}{2}(1-e^{-z})1_{\{z>0\}}$$
which is what you have.
