# Distribution of $-\log X$ if $X$ is uniform.

For $X$ and $Y$ random variables; $X$ follows the uniform distribution.

(1): if $Y=-\log X$

(2): then it can be shown that $-\log X$ is distributed as $\exp(1)$ {i.e. exponential with mean 1}.

Why is this so? Intuitively statement (2) make sense to me. But i'd like a mathematical proof.

-Probably wrong working:

(1) seems to imply $\exp(-Y) = X$ (which is like saying $X$ is exponentially distributed, which is a contradiction, since its actually uniform!); or is it incorrect for me to do this since $X$ and $Y$ are random variables?

Ultimately how do I prove (2)?

Thanks

• (2) is correct if $X$ is uniformly distributed on $[0,1]$ but for a general uniform distribution on $[a,b]$, the distribution of $-\log X$ is not exponential with mean $1$. Sep 20, 2012 at 12:20

The trick to resolve this kind of problems is to calculate the distribution of $Y$: $F(y) = P(Y<y)$. In this case, we have $F(y)=P(\log X<y)=P(X<e^y) =\int_0^{e^y}dt$. Now if you make the change of variable $t=e^u$, you are able to transform this expression into something of the form $F(y) = \int_{-\infty}^y f(u)du$, and then $f$ will be the density you are looking for.

• yup thank you :), for my Question it came down to: F(Y<=y)= 1 - e^(-y). Differentiating I got f(y)= e^(-y) as desired. Sep 20, 2012 at 9:36
• @student101 yes that's true but in this case you got a nice expression of $F(y)$ because $X$ as a very simple distribution you can easily integrate, while I was providing you with the general methodology.
– S4M
Sep 20, 2012 at 9:42
• right duly noted. I believe the general 'method of transformation' of random variables applies for non uniform functions... Sep 20, 2012 at 10:14

To begin with, $Y = -\ln(X)$ only works when $[a,b] \subset \mathbb{R}_{>0}$. So, let

$$X \sim \mathcal{U}[a,b] \quad\text{where}\quad [a,b] \subset \mathbb{R}_{>0}.$$

then $Y$ is log-uniformly distributed, in symbols

$$Y \sim \mathcal{LU}[\alpha,\beta] \quad\text{with}\quad \alpha = -\exp(a) \ \text{and} \ \beta = -\exp(b).$$

This can be derived by applying the transformation rule to the probability density function (PDF) of $X$, given by $$f_\mathcal{U}(x \mid a,b) = \begin{cases} \dfrac{1}{b - a}, & a \leq x \leq b \\ 0, & \text{else} \end{cases}.$$ Suppose $\alpha = -\exp(a)$ and $\beta = -\exp(b)$. The PDF of $Y = -\ln(X)$ is then $$\begin{eqnarray} f_\mathcal{U}(-\ln(x) \mid a,b) \cdot \left| \dfrac{\mathrm{d} (-\ln(x))}{\mathrm{d}x} \right| &=& \begin{cases} \dfrac{1}{(b - a) \cdot x}, & a \leq -\ln(x) \leq b \\ 0, & \text{else} \end{cases} \\ &=& \begin{cases} \dfrac{1}{(b - a) \cdot x}, & -\exp(a) \leq x \leq -\exp(b) \\ 0, & \text{else} \end{cases} \\ &=& \begin{cases} \dfrac{1}{(\ln(-\beta) - \ln(-\alpha)) \cdot x}, & \alpha \leq x \leq \beta \\ 0, & \text{else} \end{cases} \\ &=& \begin{cases} \dfrac{1}{\ln\left( \dfrac{-\beta}{-\alpha} \right) \cdot x}, & \alpha \leq x \leq \beta \\ 0, & \text{else} \end{cases} \\ &=& \begin{cases} \dfrac{1}{(\ln(\beta) - \ln(\alpha)) \cdot x}, & \alpha \leq x \leq \beta \\ 0, & \text{else} \end{cases} \\ &=& f_\mathcal{LU}(x \mid \alpha,\beta). \end{eqnarray}$$ The result is the PDF of the log-uniformly distributed variable $Y \sim \mathcal{LU}[\alpha,\beta]$.

• Why are you solving this for $X$ uniform on $[a,b]$ for some $0<a<b$ while the question is also (and probably uniquely) about $X$ uniform on $(0,1)$?
– Did
Oct 24, 2015 at 22:10
• Hello @Did, neither in the title nor in the text did the author confine the interval only to $(0,1)$. Oct 24, 2015 at 22:26
• Actually they did, twice, once when they said that "X follows the uniform distribution" and once when they said that "it can be shown that −logX is distributed as exp(1)".
– Did
Oct 24, 2015 at 22:32
• @Did: What? Do we talk at cross purposes? The uniform distribution is defined on $[a,b]$ for $a,b \in \mathbb{R}$. See here: en.wikipedia.org/wiki/Uniform_distribution_(continuous). But if you want to confine it, even though there is no mention in the text, you may of course set $a = 0$ and $b = 1$. Oct 24, 2015 at 22:39
• @BjörnFriedrich When they refer to THE uniform distribution, it is Unif(0,1). If they refer to AN uniform distribution, it is Unif(a,b) for a,b as reals. Sep 13, 2020 at 13:06

reiterate @S4M's answer but with $$Y = -\log(X)$$, rather than $$Y = \log(X)$$, according to OP's post:

$$P(Y\exp(-y)).$$

Given that $$X$$ is uniformly distributed between $$[0,1]$$,

$$P(Y\exp(-y)) = F(1 -\exp(-y)),$$

which is the CDF of exponential distribution, with $$\lambda=1$$.

• Are you using F for P?
– Did
Oct 24, 2015 at 22:11