# Determining p-th Quantile From Probability Density Function

I'm not sure how to derive the $p$-th quantile. I know that it is point which divides the distribution of $X$ into two parts, but I'm not sure what I'm supposed to do here.

If the random variable $X$ has probability density function $f(x) = \lambda e^{-\lambda x}$ for $x > 0$. ($\lambda > 0$), determine the $p$-th quantile $x_p$ in terms of $\lambda$ and $p$.

-

To be technical, a $p$-th quantile is any point $x_p$ such that $P(X \le x_p)=p$. There may be more than one such $x_p$, but in our case there is only one.

So for our random variable with exponential distribution, we want to find $x_p$ such that $$\int_0^{x_p} \lambda e^{-\lambda x}\,dx=p.$$ Integrate. We get $1-e^{-\lambda x_p}$. Set this equal to $p$, and solve for $x_p$. The equation $1-e^{-\lambda x_p}=p$ can be rewritten as $$e^{-\lambda x_p}=1-p.$$ Take the natural logarithm of both sides, and solve for $x_p$. We get $$x_p=\frac{-\ln(1-p)}{\lambda}.$$

For a more general random variable $X$, we want to solve the equation $F_X(x_p)=p$, where $F_X$ is the cumulative distribution function of $X$. It may not be possible to solve this equation by "exact" methods, but usually we can at least get a good numerical approximation.

-
Calculate the cumulative distribution function $$F_X(\alpha) = \int_0^{\alpha} \lambda e^{-\lambda x} \mathrm dx$$ for $\alpha > 0$. The $p$-th quantile is $x_p$ where $x_p$ is the solution to $$F_X(x_p) = \frac{p}{100}$$ if $p$ is stated as a percentage.