# Motivation

One of the classic challenges with Cauchy random variables is that their moments are not finite, and I even recently learned that Cauchy principal values of even moments of Cauchy random variables are not finite either.

Of course among these moments are centered second moments that would have been the variance, which is one mathematical way of expressing a less precise notion of "dispersion" or "spread". I have tried to consider what other variance-like-thing we could define and compute for a Cauchy random variable, in this case based on replacing expectations with medians.

# Effort

Let's take a Cauchy random variable $$X \sim f(x;x_0, \gamma)$$ where $$\mathcal{M}[X]=x_0$$ is the median and $$\gamma$$ is a scale parameter. Consider the quantity

$$\mathcal{M}[(X - \mathcal{M}[X])^2]$$

to be the median of the square of the difference from the median of the random variable. This can be expanded to

$$\mathcal{M}[X^2 - 2X \mathcal{M}[X] + \mathcal{M}[X]^2]$$

using a distributive property. I am less certain about this next step, but my thinking is that the median should be equivariant to monotonic transformations. Assuming $$\mathcal{M}[X]$$ is a constant, I think we should have

$$\mathcal{M}[X^2] - \mathcal{M}[2X \mathcal{M}[X]] + \mathcal{M}[X]^2$$

$$\iff$$

$$\mathcal{M}[X^2] - 2\mathcal{M}[X]^2 + \mathcal{M}[X]^2$$

$$\iff$$

$$\mathcal{M}[X^2] - \mathcal{M}[X]^2$$

for which $$\mathcal{M}[X^2] \geq \mathcal{M}[X]^2$$ due to the convexity of squaring and the Jensen inequality for medians. We know we took a square at the beginning anyway, but it doesn't hurt to notice that $$\mathcal{M}[X]^2 \geq 0 \land \mathcal{M}[X^2] \geq \mathcal{M}[X]^2 \implies \mathcal{M}[X^2] - \mathcal{M}[X]^2 \geq 0.$$

Knowing that $$\mathcal{M}[X] = x_0$$, we can substitute to obtain

$$\mathcal{M}[X^2] - x_0^2$$

but it remains to determine $$\mathcal{M}[X^2]$$. If I had the distribution for $$X^2$$ I could compute the median from an integral definition. But I do not have the distribution of $$X^2$$. At first I looked to the distribution of the product of two random variables wiki page, but their general approach assumes that the product is between independent variables. I do not think I can readily assume that $$X$$ is independent from itself. I also check the relationships among probability distributions but again did not find any useful relations for squaring a Cauchy variable.

# Question

What is the median of the squared difference from the median of a Cauchy random variable?

## Monte Carlo

The following samples from a standard Cauchy distribution, and shifts its values up by 10 units. Then I computed the statistic as described in the question and plotted a histogram with 100 bins.

import matplotlib.pyplot as plt
import numpy as np

results = []
for i in range(10000):
x = np.random.standard_cauchy(size=10000) + 10
stat = np.median(np.power((x - np.median(x)),2))
results.append(stat)

plt.hist(results, bins=100)
plt.show()


The above result is consistent with the scale being invariant to translations.

Repeating the above Monte Carlo simulation but scaling the variable by three instead of shifting it by ten, I get the following histogram.

This is consistent with scaling the variable leading to a squaring of scale.

• Medians always exist. Proof: the distribution function rises from $0$ in its limit at $-\infty$ to $1$ in its limit at $+\infty.$ Thus, at some finite value (or values) it must pass from being less than $1/2$ to greater than $1/2.$ Such values are, by definition, medians. Note that the median of the squared difference is easily related to the median of the absolute difference. You can find that as an arctangent of a suitable angle ;-).
– whuber
Commented Mar 31, 2022 at 2:33
• @whuber I might have been overly conservative. Is it always the case that a product of two random variables have a CDF? I guess so since the product of two variables is a measurable function. Thanks for pointing that out. Commented Mar 31, 2022 at 2:36
• @Dave I carefully couched my description in a way that would apply to any CDF. In your case, it jumps from below $1/2$ to above $1/2$ exactly at $2/3,$ which is one of the possible medians. (The set of possible medians is the interval $[1/3,2/3].$) The point is not to quibble over conventions for selecting among multiple possible medians, but only to prove that a median exists.
– whuber
Commented Mar 31, 2022 at 2:44
• The product is a composition. If we take $X:\Omega\to\mathbb R$ and $Y:\Omega\to\mathbb R$ to be measurable, we may consider this pair to be a single function from $\Omega$ to $\mathbb R\times \mathbb R$ (this is assured by the categorical definition of Cartesian product). The product is a measurable function from $\mathbb R \times \mathbb R$ to $\mathbb R.$ (That's elementary to prove.) Thus, $XY$ is a random variable whenever $X$ and $Y$ are random variables.
– whuber
Commented Mar 31, 2022 at 2:58
• Sorry to ask this, but how and why did this question arise? Is it just a pure mathematics question or is there a practical application? Sorry, personal curiousity. Commented Mar 31, 2022 at 3:44

Suppose $$F$$ is the distribution function of a random variable $$X$$ with median $$m.$$

By definition, a median is any number for which $$F(m)\ge 1/2$$ and $$F(x) \le 1/2$$ for all $$x \lt m.$$

For any non-negative number $$y,$$ let

$$G(y) = F(m+y) - F(m-y) = \Pr(X \in (m-y, m+y]).$$

Clearly (by the probability axioms) $$G(0)=0$$ and $$G$$ is a nondecreasing function rising to a limiting value of $$1.$$ Consequently there is at least one $$y$$ for which $$G(y) \ge 1/2$$ and $$G(x)\le 1/2$$ for all $$x \lt y.$$

$$y^2$$ is a median of $$(X-m)^2.$$

Proof: $$\Pr((X-m)^2 \le y^2) = \Pr(|X-m| \le y) = \Pr(X \in [m-y, m+y] = G(y) \ge 1/2.$$

At the same time, if $$0 \le y-\epsilon \lt y,$$

\begin{aligned} \Pr((X-m)^2 \le (y-\epsilon)^2) &= \Pr(X \in [m-y+\epsilon, m+y-\epsilon]) \\ &\le \Pr(X \in (m-y + \epsilon/2, m+y-\epsilon/2])\\ &= G(y-\epsilon/2) \lt 1/2. \end{aligned}

Thus the definition of median is satisfied, QED.

Application:

Let $$X$$ have a Cauchy distribution. This means it has a density function

$$f_X(x) = \frac{1}{\pi}\frac{1}{1+x^2}.$$

Thus

$$\frac{1}{2} = G(y) = \frac{1}{\pi}\int_{-y}^y \frac{\mathrm{d}x}{1+x^2} = \frac{2}{\pi}\arctan(y)$$

has unique solution $$y = 1.$$ Consequently the median squared deviation from the median is $$1^2 = 1.$$

### Remarks on shifting and scaling

When you shift and scale the random variable $$X,$$ creating the new variable $$Z=\mu + \sigma X,$$ you are really just changing the units of measurement. Accordingly, the median $$m$$ becomes $$\mu + \sigma m$$ and all squared differences relative to $$m$$ are multiplied by $$\sigma^2.$$ This is why you found, when setting $$\sigma=3,$$ that the median squared difference from the median is $$3^2\times 1 = 9;$$ and when setting $$\mu=10,$$ you found the median squared difference remained $$1.$$

### Terminology

$$y$$ is called the Median Absolute Deviation from the Median, or MAD. It is a standard robust measure of dispersion.

• In addition to your remarks on shifting and scaling, the Cauchy distribution is also stable so such a transformed variable will itself be a Cauchy variable. Commented Mar 31, 2022 at 3:54
• Stability is a completely different concept. Shifting and scaling a single distribution creates a location-scale family of distributions. A stable family is closed, modulo shifting and scaling, under linear combinations of the underlying random variables.
– whuber
Commented Mar 31, 2022 at 4:14
• $Y = aX$ is a linear combination with a single term, which pertains to both scaling a random variable and the (linear) stability of the distribution. I felt it was worth mentioning this closure. Commented Mar 31, 2022 at 4:22
• The concepts remain fundamentally unrelated. Stability concerns all the distributions of the form $a_1X_1+a_2X_2 +\cdots + a_n X_n$ for constant $a_i$ and iid $X_i,$ up to scale and location, not just the case $n=1.$ What the idea of stability ultimately comes down to is whether $X_1+X_2$ (for iid variables) has the same distribution up to a possible change of scale and location.
– whuber
Commented Mar 31, 2022 at 16:17