Let $X$ be a continous RV with pdf $f(x) = \frac{1}{2} e^{-|x|} $ for $x \in \mathbb{R}$. Find the $p^{\textrm{th}}$ quantile of $X$.
Attempt:
First, I get rid of absolute value by writing
$$ f(x) = \begin{cases} \frac{1}{2} e^{-x}, \; \; \; \; x \geq 0 \\ \frac{1}{2} e^{x}, \; \; \; \; x < 0 \end{cases}$$
I wanna find value $\alpha$ so that
$$ F(\alpha) = P(X \leq \alpha) = p $$
So, we have
$$ \int\limits_{-\infty}^0 \frac{1}{2} e^x dx+ \int\limits_0^{\alpha} \frac{1}{2} e^{-x} dx = p \implies\frac{1}{2} + \frac{1}{2}(-e^{-\alpha}+1) = p \implies 2 - e^{-\alpha} = 2p$$
which can solve for $\alpha $ which gives $2 - 2p = - e^{-\alpha} \implies ln(2p-2) = - \alpha $
Thus,
$$ \alpha = - \ln (2p-2) $$
but, my answer in my notebook gives
$$ \alpha = \begin{cases} \ln (2p ) , \; \; \; 0 < p \leq 1/2 \\ - \ln[2(1-p)], \; \; \; 1/2<p<1 \end{cases} $$
My question is, why do we need to break this case in two?
First, your expression for $p$ is assuming that $p\geq \frac12$. If $p<\frac12$, you have a single integral over $(-\infty,\alpha)$ since in that case $\alpha < 0$ and the integrand is defined by the first "piece" of the piecewise-defined PDF.
Second, if $2-e^{-\alpha}=2p$, then $2-2p=e^{-\alpha}$ (not $-e^{-\alpha}$), so $\alpha = -\log(2-2p)$.