# Distribution of the Mahalanobis distance between two samples from a Gaussian distribution

Let $\mathbf{X}=(X_1,\dots,X_p)\sim\mathcal{N}(\mu,\Sigma)$ be a Gaussian random vector. We all know that

$$d^2(\mathbf{X},\mu) = (\mathbf{X}-\mu)^T\Sigma^{-1}(\mathbf{X}-\mu)$$

has a $\chi^2_p-$distribution. We also know how the distribution changes when we don't know $\mu$ and $\Sigma$, but we have sample estimates $\bar{\mathbf{X}}$ and $S$. I wonder what is the distribution of this other quantity: if $\mathbf{X_1}$ and $\mathbf{X_2}$ are two independent draws from $\mathcal{N}(\mu,\Sigma)$, then how is

$$d^2(\mathbf{X_1},\mathbf{X_2}) = (\mathbf{X_1}-\mathbf{X_2})^T\Sigma^{-1}(\mathbf{X_1}-\mathbf{X_2})$$

distributed? Is it $\chi^2_{2p}-$distributed?

Finally, if $D=\{\mathbf{X_1},\dots,\mathbf{X_n}\}$ is a random sample of size $n$ from $\mathcal{N}(\mu,\Sigma)$, and $\mathbf{X_i}$ and $\mathbf{X_j}$ are observations in the sample $D$, how is

$$d^2(\mathbf{X_i},\mathbf{X_j}) = (\mathbf{X_i}-\mathbf{X_j})^TS^{-1}(\mathbf{X_i}-\mathbf{X_j})$$

distributed ($S$ is obviously the sample covariance matrix)?

• en.wikipedia.org/wiki/Wishart_distribution – whuber Nov 24 '17 at 13:29
• @whuber I'm maybe being dense, but the Wishart is a random matrix distribution, right? My quantity $d^2$ is a scalar - it's a dot product. Maybe the row-vector notation I used is confusing. I'm switching to a column-vector notation which is pheraps more common? – DeltaIV Nov 24 '17 at 14:31
• I'm sorry; my reference was too obscure. Look at en.wikipedia.org/wiki/Hotelling%27s_T-squared_distribution (which also clarifies the relevance of the first reference). – whuber Nov 24 '17 at 14:39
• @whuber ok - just to be clear, you're not talking about the the two-sample Hotelling T-statistics, right?. The two sample statistics is the distribution of the difference between the sample means from two samples, while I'm looking at the difference between two observations. You're talking about the more general Hotelling $T^2(p,m)$ distribution with dimensionality parameter $p$ and $m$ degrees of freedom: the one described in the "Definition" section of the Wikipedia link. Right? – DeltaIV Nov 24 '17 at 16:38
• And $S$ has the Wishart distribution - now I get the reason for your first reference. – DeltaIV Nov 24 '17 at 16:39