Suppose I have a random variable $X$ where $X$ follows an exponential distribution of the following form:

$$f_X(x) = \frac{1}{\lambda}e^{-\frac{x}{\lambda}}$$.

I want to find the value of $\lambda$ such that $Pr(X<10^{-8}) \geq 0.95$ and $Pr(X>6\times10^{-6}) \geq 0.001$.

So I have the following two inequalities to solve:

\begin{align} 1-\exp\left(-\frac{10^{-8}}{\lambda}\right)&\geq 0.95\\ \exp\left(-\frac{6\times10^{-6}}{\lambda}\right)&\geq 0.001 \end{align}

Solving the inequalities I have the following: \begin{align} \lambda & \geq \frac{-10^{-8}}{\ln(0.05)}\approx 3.338082e-09\\ \lambda & \leq \frac{-6\times 10^{-6}}{\ln(0.001)}\approx 8.68589e-07 \end{align}

So I would need to choose a value of $\lambda$ such that $3.338082e-09\leq\lambda\leq8.68589e-07$, correct?

However, when I try to verify this solution via simulation, I don't seem to get the right conclusion, i.e., assume I let $\lambda = 8.68589e-08$ then I have the following solution using R

> lambda >= (-10^-8) / log(.05)
[1] TRUE
> lambda <= -(6*10^-6) / log(0.001)
[1] TRUE

So I am between those two values (so far so good). Now, I'll simulate a large number of random samples from the exponential with the value of $\lambda=8.68589e-08$ to check that I get the right probabilities:

> x <- rexp(10000000, 1/lambda)
> sum(x < 10^-8)/length(x)
[1] 0.1085921
> sum(x > 6*10^(-6))/length(x)
[1] 0

And so from my simulation, I have that $Pr(X<10^{-8}) = 0.1085921$ and $Pr(X>6\times10^{-6}) = 0$

which is not what I want. Is my math/logic incorrect somewhere?

Also, here is a histogram of the random samples overlaid with the true exponential density in red. The two blue dashed line correspond to $6\times10^{-6}$ and $10^{-8}$

enter image description here


1 Answer 1


$$\begin{array}{}\exp\left(-\frac{a}{\lambda}\right)&\geq& b &\\ -\frac{a}{\lambda}&\geq& \log(b) && \text{logarithm}\\ -{a}&\geq& \log(b)\lambda && \text{multiply with $\lambda$}\\ -\frac{a}{\log (b)}&\leq& \lambda && \text{multiply with $\frac{1}{\log(b)}$}\\ &&&& \text{ NOTE! inquality changes} \\&&&& \text{ because this is a negative number }\\ \lambda &\geq& -\frac{a}{\log (b)} && \text{reverse left with right}\\ \end{array}$$

You get a different inequality. Probably your derivation went wrong when you made a multiplication or division with $\log(b)$ which is a negative number.

  • $\begingroup$ Does this mean that both bounds flip, i.e., $3.338082e-09\geq\lambda$ and $\lambda \geq 8.68589e-07$? In that case no value of $\lambda$ exists for what I need? $\endgroup$
    – John Smith
    Commented Apr 30, 2022 at 20:54
  • 1
    $\begingroup$ @JohnSmith yes both bounds flip, so there is no solution. $\endgroup$ Commented Apr 30, 2022 at 20:55
  • $\begingroup$ You can also reason this intuitively. Your $\lambda$ is the mean of the distribution. A higher mean results in more probability in the upper part above 6x10e-6. A lower mean results in more probability in the lower part below 10e-8. $\endgroup$ Commented Apr 30, 2022 at 20:57
  • $\begingroup$ Thank you so much! That makes a lot of sense! $\endgroup$
    – John Smith
    Commented Apr 30, 2022 at 20:57
  • $\begingroup$ Well intuitively I would have thought it would have worked because I want to have high probability being less than 10e-8 and low probability of being above 6x10e-6 although the second probability would not be non-zero $\endgroup$
    – John Smith
    Commented Apr 30, 2022 at 21:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.