TITLE: Distribution of Functions of Random Variables
QUESTION [5 upvotes]: In general, how would one find the distribution of $f(X)$ where $X$ is a random variable? Or consider the inverse problem of finding the distribution of $X$ given the distribution of $f(X)$. For example, what is the distribution of $\max(X_1, X_2, X_3)$ if $X_1, X_2$ and $X_3$ have the same distribution? Likewise, if one is given the distribution of $ Y = \log X$, then the distribution of $X$ is deduced by looking at $\text{exp}(Y)$?

REPLY [12 votes]: Let me take the risk of mitigating Qiaochu's healthy skepticism and mention that a wand I find often quite useful to wave is explained on this page. There, I argue that: The simplest and surest way to compute the distribution density or probability of a random variable is often to compute the means of functions of this random variable.
For example, the fact that $Y=\log X$ is normal $N(2,4)$ is equivalent to the fact that, for every bounded measurable function $g$,
$$
\mathrm E(g(Y))=\int g(y) f_Y(y)\mathrm{d}y,
$$
for a density $f_Y$ everybody knows and whose precise form will not interest us. Likewise, the fact that the distribution $X$ has density $f_X$ is equivalent to the fact that, for every bounded measurable function $g$,
$$
\mathrm E(g(X))=\int g(x) f_X(x)\mathrm{d}x.
$$
Hence our task is simply to pass from one formula to the other. But this is easy since $g(X)=g(\mathrm{e}^Y)$ is also a function of $Y$. As such,
$$
\mathrm E(g(X))=\int g(\mathrm{e}^y) f_Y(y)\mathrm{d}y,
$$
and our task is to solve for $f_X$ the equations
$$
\int g(x) f_X(x)\mathrm{d}x=\int g(\mathrm{e}^y) f_Y(y)\mathrm{d}y,
$$
We have no choice for our next step but to use the change of variable $x\leftarrow \mathrm{e}^y$. That is, $y\leftarrow \log x$ and $\mathrm{d}y=x^{-1}\mathrm{d}x$, which yields
$$
\int g(\mathrm{e}^y) f_Y(y)\mathrm{d}y=\int g(x) f_Y(\log x)x^{-1}\mathrm{d}x.
$$
By identification, $f_X(x)=f_Y(\log x)x^{-1}$.
In a nutshell the idea is that the very notations of integration help us to get the result and that during the proof we have no choice but to use the right path. We leave as an exercise the computation of the density of each random variable $Z=\varphi(Y)$, for some regular enough function $\varphi$.
Note that maxima and minima of independent random variables should be dealt with by a specific, different, method, explained on this page.