Transforming random variables: the CDF method, the Jacobian, and the Cauchy distribution
How to find the density of a function of random variables with the CDF method and the change-of-variables formula, worked through for 1/X and X/Y, which both turn out to be Cauchy.
University lab From my coursework in the MSc in Statistics and Machine Learning at Linköping University, rewritten as a note to review later.
A lot of probability comes down to one question: if I know the distribution of (or of and together), what’s the distribution of some function of them? The first seminar of the probability theory course was full of these, and my handwritten solutions from that week show both standard methods, plus a couple of small slips worth fixing. Two results stand out because they’re surprising: if is Cauchy, so is ; and the ratio of two independent standard normals is Cauchy too.
Warm-up: marginals and independence from a joint density
If a joint density factorises as over a rectangular region, then and are independent and each marginal is just the normalised factor. The marginal is obtained by integrating the other variable out:
where the integral runs over all values where the density is positive.
For example, a density proportional to on , splits into a normal part and an exponential part. Integrating out leaves something proportional to , so ; integrating out leaves something proportional to , so is exponential with rate 3 and density . The trick is to recognise the kernel (the part that depends on the variable) and let the normalising constant take care of itself. Independence then makes expectations of products easy: , and second moments come from .
Method 1: through the CDF
To get the density of , write the CDF of as a probability about , then differentiate:
The care is all in turning "" into a set of values correctly.
Method 2: change of variables
If is strictly monotone and differentiable with inverse , then
where the absolute value of the derivative (the Jacobian, in one dimension) accounts for how stretches or squeezes intervals. If is monotone on separate pieces, you add one such term per piece.
Example: for a Cauchy
The standard Cauchy density is for all real . Let . Here and . The map is decreasing on and on separately, and each comes from exactly one , so
So is standard Cauchy again.
My handwritten version had two slips on the way to the right answer. First, I wrote . That’s only true when and are both positive. For , also holds for every negative , so the correct statement is . The derivative is the same, which is why the final answer still came out right, but the step itself was wrong. Second, I wrote where it should have been , which was just a copying slip. The change-of-variables route above avoids the first trap altogether, since it never needs the sign cases.
Example: the ratio of two standard normals
Let be independent and . Use the CDF method:
Multiplying through by flips the inequality when :
Since is symmetric around 0 and independent of , , and for , . So both pieces combine to
where and are the standard normal density and CDF. In my notes I wrote directly. That’s the right result, but it needs the symmetry argument above; for a non-symmetric it would be false.
My notes stopped at the double integral. To finish, differentiate under the integral with respect to :
The last integral is with . So is standard Cauchy.
Why the Cauchy is a troublemaker
The Cauchy has such heavy tails that : it has no mean and no variance. The law of large numbers doesn’t apply, and the average of Cauchy draws is itself standard Cauchy for every , so it never settles down. A quick simulation shows both results above and this behaviour:
set.seed(9)
n <- 1e5
x <- rcauchy(n)
ratio <- rnorm(n) / rnorm(n)
p <- c(0.1, 0.25, 0.5, 0.75, 0.9)
round(rbind(cauchy = qcauchy(p), # -3.08 -1.00 0.00 1.00 3.08
inv_x = quantile(1 / x, p), # about the same
ratio = quantile(ratio, p)), 2) # about the same
# Running means of Cauchy draws do not converge
round(sapply(c(1e2, 1e3, 1e4, 1e5), function(m) mean(x[1:m])), 2)
This is also a practical warning: ratios of noisy quantities whose denominators can be near zero can behave like Cauchy variables, with occasional huge values and unstable averages.
Key takeaways
- A joint density that factorises over a rectangle means independence; marginals come from integrating the other variable out.
- CDF method: write as a probability about , carefully, including sign cases, then differentiate.
- Change of variables: , summed over monotone pieces.
- for Cauchy , and for independent standard normals, are both standard Cauchy.
- The Cauchy has no mean; sample averages of Cauchy data don’t converge.
Resources
- 732A63 Probability Theory, Linköping University, seminar exercises (autumn 2020).
- Allan Gut, An Intermediate Course in Probability, 2nd ed., Springer, 2009, Chapter 1 (multivariate random variables and transformations).
- George Casella and Roger L. Berger, Statistical Inference, 2nd ed., Duxbury, 2002, Section 2.1 (distributions of functions of a random variable) and Section 4.3 (bivariate transformations).