Tutorials › Statistical Theory I - Probability and Distribution Theory › Logarithmic and Exponential Transformations

One-to-One Transformations · Tutorial 405 of 994

Logarithmic and Exponential Transformations

Use monotonicity and change of variables to derive log and exponential distributions, with careful attention to density formulas, domains, and support.

Intermediate 10 min read

What You'll Learn

  • Derive the CDFs of log X and exp X from the CDF of X
  • Obtain the corresponding density formulas and identify where they apply
  • Distinguish values occurring almost surely from the topological support
  • Transform a uniform variable by taking its logarithm
  • Transform an exponential variable by exponentiation
  • Derive the lognormal density and moments from a normal variable

Why Logarithms and Exponentials Matter

A logarithm changes a positive measurement to a scale on the entire real line; an exponential maps a real-valued measurement to positive values. These transformations appear in models of growth, skewed measurements, and multiplicative variation. To find the resulting distribution, the key is to track how inequalities and intervals change under the transformation.

The transformations \(x\mapsto\log x\) on \((0,\infty)\) and \(x\mapsto e^x\) on \(\mathbb{R}\) are strictly increasing inverses. Their monotonicity gives direct CDF formulas, while their derivatives determine the density scaling. The formulas below apply whether or not the transformed variable has a density; a density formula requires an absolutely continuous input distribution.

Definition: If \(X>0\) with probability one, the logarithmic transformation is \(Y=\log X\). For any real-valued \(X\), the exponential transformation is \(W=e^X\). A random variable is positive almost surely when \(P(X>0)=1\). This statement does not by itself specify the topological support of its distribution.

CDF Formulas From Monotonicity

Let \(F_X(x)=P(X\le x)\) be the CDF of \(X\). Since the logarithm is increasing on the positive half-line, \(\log X\le y\) is equivalent to \(X\le e^y\). Since the exponential is increasing on all of \(\mathbb{R}\), \(e^X\le w\), for \(w>0\), is equivalent to \(X\le\log w\). These equivalences give the distributions without any assumption that \(X\) is continuous.

Theorem: If \(P(X>0)=1\) and \(Y=\log X\), then for every \(y\in\mathbb{R}\), $$ F_Y(y)=F_X(e^y). $$ If \(X\) is any real-valued random variable and \(W=e^X\), then $$ F_W(w)= \begin{cases} 0, & w\le 0,\\ F_X(\log w), & w>0. \end{cases} $$ These CDF identities hold for discrete, continuous, and mixed distributions.

For the first identity, the events \(\{\log X\le y\}\) and \(\{X\le e^y\}\) are equal whenever \(X>0\); that condition holds with probability one. Taking probabilities proves the formula. For the second identity, \(e^X>0\) for every finite real \(X\), so \(P(W\le w)=0\) when \(w\le0\). When \(w>0\), the two events \(\{e^X\le w\}\) and \(\{X\le\log w\}\) are equal. Taking probabilities gives the stated result. \(\square\)

Density Formulas and Their Derivation

Suppose first that \(X\) has density \(f_X\) and \(P(X>0)=1\). For \(Y=\log X\), the CDF identity can be differentiated: \(F_Y(y)=F_X(e^y)\), so the chain rule gives \(f_Y(y)=e^y f_X(e^y)\) almost everywhere. For \(W=e^X\), differentiating \(F_W(w)=F_X(\log w)\) for \(w>0\) gives \(f_W(w)=f_X(\log w)/w\) almost everywhere. The factor \(1/w\) is the derivative of \(\log w\), and cannot be omitted.

Theorem: If \(X\) is absolutely continuous with density \(f_X\) and \(P(X>0)=1\), then \(Y=\log X\) has density $$ f_Y(y)=e^y f_X(e^y),\qquad y\in\mathbb{R}. $$ If \(X\) is absolutely continuous on \(\mathbb{R}\), then \(W=e^X\) has density $$ f_W(w)= \begin{cases} \dfrac{f_X(\log w)}{w}, & w>0,\\[6pt] 0, & w\le 0. \end{cases} $$ The densities are understood up to changes on sets of Lebesgue measure zero.

Here is a direct verification that also checks normalization. For the logarithm, let \(A\) be any Borel subset of \(\mathbb{R}\). Since \(x=e^y\) is a differentiable, increasing bijection from \(\mathbb{R}\) to \((0,\infty)\), the one-dimensional change-of-variables formula gives $$ P(Y\in A)=\int_{\{x>0:\,\log x\in A\}} f_X(x)\,dx =\int_A f_X(e^y)e^y\,dy. $$ Thus \(e^y f_X(e^y)\) is a density for \(Y\); taking \(A=\mathbb{R}\) shows its integral is one. For the exponential, take a Borel set \(B\subset(0,\infty)\) and substitute \(w=e^x\), so \(x=\log w\) and \(dx=dw/w\): $$ P(W\in B)=\int_{\{x:\,e^x\in B\}}f_X(x)\,dx =\int_B f_X(\log w)\frac{1}{w}\,dw. $$ There is no probability outside \((0,\infty)\), so extending the density by zero to \(w\le0\) completes the verification. \(\square\)

If \(X>0\) almost surely, then \(W=e^X>1\) almost surely. In that case its density is zero on \((-\infty,1]\), except that density values at individual points are immaterial. This almost-sure statement is distinct from a claim about topological support. The topological support is the set of points every open neighborhood of which has positive probability. For example, if \(X\) is exponential, values of \(e^X\) approach 1 with positive probability in every neighborhood to the right, and the topological support is \([1,\infty)\).

Worked Example: Taking the Logarithm of a Uniform Variable

Let \(X\sim\operatorname{Uniform}(1,4)\), with density \(f_X(x)=1/3\) for \(1<x<4\) and zero otherwise. Set \(Y=\log X\). The CDF formula gives \(F_Y(y)=F_X(e^y)\). If \(y\le0\), then \(e^y\le1\), so \(F_Y(y)=0\). If \(0<y<\log4\), then \(1<e^y<4\), and \(F_Y(y)=(e^y-1)/3\). If \(y\ge\log4\), then \(F_Y(y)=1\). Therefore, $$ F_Y(y)= \begin{cases} 0, & y\le0,\\ \dfrac{e^y-1}{3}, & 0<y<\log4,\\ 1, & y\ge\log4. \end{cases} $$

Differentiating on the interval where the CDF changes gives \(f_Y(y)=e^y/3\) for \(0<y<\log4\), and zero outside that interval. Check the total probability: $$ \int_0^{\log4}\frac{e^y}{3}\,dy =\frac{e^{\log4}-e^0}{3} =\frac{4-1}{3} =1. $$ The values of \(Y\) lie in \((0,\log4)\) almost surely; its density is positive throughout that interval.

Worked Example: Exponentiating an Exponential Variable

Let \(X\sim\operatorname{Exponential}(2)\), using the rate parameterization \(f_X(x)=2e^{-2x}\) for \(x>0\). Define \(W=e^X\). For \(w\le1\), \(F_W(w)=0\), because \(X>0\) almost surely. For \(w>1\), the CDF identity gives $$ F_W(w)=P(X\le\log w)=1-e^{-2\log w}=1-w^{-2}. $$

Differentiating for \(w>1\) gives \(f_W(w)=2w^{-3}\), and the density is zero for \(w\le1\). Its integral is $$ \int_1^\infty 2w^{-3}\,dw =\left[-w^{-2}\right]_1^\infty =1. $$ Thus \(W>1\) almost surely and has no atom at 1. Nevertheless, every neighborhood of 1 contains an interval \((1,1+\varepsilon)\) with positive probability, since \(P(1<W<1+\varepsilon)=1-(1+\varepsilon)^{-2}>0\). Its topological support is therefore \([1,\infty)\), not \((1,\infty)\).

The Lognormal Distribution

Exponentiating a normal random variable produces the lognormal distribution. Specifically, if \(Z\sim N(\mu,\sigma^2)\), where \(\sigma^2>0\), and \(Y=e^Z\), then \(\log Y=Z\) and \(Y\) is lognormal with parameters \(\mu\) and \(\sigma^2\). The parameter \(\mu\) is the mean of \(\log Y\), not the mean of \(Y\); similarly, \(\sigma^2\) is the variance of \(\log Y\).

Theorem: If \(Z\sim N(\mu,\sigma^2)\) with \(\sigma^2>0\) and \(Y=e^Z\), then $$ f_Y(y)=\frac{1}{y\sigma\sqrt{2\pi}} \exp\!\left(-\frac{(\log y-\mu)^2}{2\sigma^2}\right), \qquad y>0, $$ and \(f_Y(y)=0\) for \(y\le0\). Also, for any real \(r\), $$ E[Y^r]=\exp\!\left(r\mu+\frac{r^2\sigma^2}{2}\right). $$

The normal density is \(f_Z(z)=\frac{1}{\sigma\sqrt{2\pi}}\exp(-\frac{(z-\mu)^2}{2\sigma^2})\). Substituting \(z=\log y\) into the exponential density formula and including its factor \(1/y\) proves the displayed density. To verify the moment formula, write the expectation as an integral and complete the square: $$ E[e^{rZ}] =\frac{1}{\sigma\sqrt{2\pi}}\int_{-\infty}^{\infty} \exp\!\left(rz-\frac{(z-\mu)^2}{2\sigma^2}\right)dz =\exp\!\left(r\mu+\frac{r^2\sigma^2}{2}\right) \frac{1}{\sigma\sqrt{2\pi}}\int_{-\infty}^{\infty} \exp\!\left(-\frac{(z-\mu-r\sigma^2)^2}{2\sigma^2}\right)dz. $$ The last integral, including its prefactor, is one because it is a normal density integrated over the real line. This proves the moment formula. Taking \(r=1\) gives the mean; using \(r=2\) and subtracting the squared mean gives \(\operatorname{Var}(Y)=e^{2\mu+\sigma^2}(e^{\sigma^2}-1)\).

Worked Example: A Lognormal Variable From a Normal Model

Let \(Z\sim N(1,4)\), so its mean is \(1\), its variance is \(4\), and its standard deviation is \(2\). Set \(Y=e^Z\). The density formula gives $$ f_Y(y)=\frac{1}{2y\sqrt{2\pi}} \exp\!\left(-\frac{(\log y-1)^2}{8}\right),\qquad y>0. $$ It is zero for \(y\le0\). In particular, \(Y>0\) almost surely, and its density is positive at every \(y>0\).

The moment formula gives $$ E[Y]=\exp\!\left(1+\frac{4}{2}\right)=e^3, \qquad E[Y^2]=\exp\!\left(2+\frac{4(4)}{2}\right)=e^{10}. $$ Therefore, $$ \operatorname{Var}(Y)=E[Y^2]-(E[Y])^2 =e^{10}-e^6=e^6(e^4-1). $$ Although \(Y\) is positive almost surely and has density zero at nonpositive values, its topological support is \([0,\infty)\): every neighborhood of zero contains positive values on which the density is positive and hence has positive probability.

Common Mistakes and Why the Details Matter

  • Dropping the derivative factor. The exponential density is not just \(f_X(\log w)\); it is \(f_X(\log w)/w\). The factor comes from \(d(\log w)/dw=1/w\), and is necessary for the density to integrate to one.
  • Using the logarithm outside its domain. The real-valued \(\log X\) requires \(X>0\) almost surely. If \(X\) can be nonpositive with positive probability, this transformation is not defined as a real random variable on that event.
  • Confusing almost-sure values with topological support. A lognormal variable is positive almost surely, but its topological support includes zero. An exponentiated exponential variable is greater than 1 almost surely, but its topological support includes 1.
  • Interchanging the lognormal parameters with the transformed moments. If \(\log Y\sim N(\mu,\sigma^2)\), then \(E[Y]=e^{\mu+\sigma^2/2}\), not \(\mu\). The normal parameters describe the logarithm.

These transformations preserve the full distributional information: \(X=e^{\log X}\) for positive \(X\), and \(X=\log(e^X)\) for real \(X\). The CDF method is useful even when no density exists; the density method adds the derivative adjustment when absolute continuity is available. Keeping the domain, the inverse transformation, and the derivative factor explicit prevents most errors.

Check Your Understanding

Try these questions by applying the CDF identities first, then the density formula when appropriate.

  1. If \(X>0\) almost surely, express \(F_{\log X}(y)\) in terms of \(F_X\). Which monotonicity fact justifies the formula?
  2. If \(X\) has density \(f_X\) on \((0,\infty)\), what is the density of \(e^X\), and on what values is it zero?
  3. Suppose \(X\sim\operatorname{Exponential}(1)\). Derive the CDF of \(e^X\), and explain why its topological support contains 1.
  4. If \(\log Y\sim N(\mu,\sigma^2)\), state \(E[Y]\) and \(\operatorname{Var}(Y)\). Which parameters describe \(\log Y\)?
  5. Explain why “\(Y>0\) almost surely” does not imply that the topological support of \(Y\) excludes zero.