Can the covariance matrix in Mahalanobis distance definition be zero?

The statistical distance or Mahalanobis distance between two points $x = (x_1,\dots,x_p)'$ and $y = (y_1,\dots,y_p)'$ in the $p$-dimensional space $\mathbb R^p$ is defined as $$d(x, y) = \sqrt{ (x-y)' Q^{-1} (x-y)}$$ Where $Q$ is the covariance matrix that represents the measurement uncertainty of both variables $x$ and $y$.

My question is can $Q = 0$ i.e. the measures have no uncertainty? Which leads to the fact the distance is undefined? However if $Q$ is identity then the distance will reduce to the normal Euclidean distance $\|x-y\|_2$?

• $Q$ is a $p\times p$ matrix, you need to elaborate on what $Q=0$ means exactly. Are the terms on the diagonal zero? What about the terms off the diagonal? Sep 18 '12 at 0:45
• I mean all elements are zeros both diagonal and off the diagonal. Sep 18 '12 at 15:53
• If that's the case, $Q^{-1}$ does not exist. There are some restrictions on what a covariance matrix can look like. For example, it needs to be positive-semidefinite and symmetric. The first is key here. Sep 18 '12 at 17:03
• @Dimitriy: But note that $Q = 0$ is positive semidefinite and symmetric! Note also that if $Q$ were zero along the diagonal, then automatically all off-diagonal elements would also have to be zero. :-) Sep 18 '12 at 17:45
• @cardinal Holy cats! Mea culpa. I should not attempt linear algebra pre-coffee. Sep 18 '12 at 18:14

If $Q=(q_{ij})$ "were zero", that is if $q_{ij}=0$ for every $i,j$, then, clearly, $\det(Q)=0$. Hence, the inverse $Q^{-1}$ doesn't exist, but the Malahanobis distance is defined in terms of $Q^{-1}$.

• But one can in some cases define a generalized Malahabonis distance using the Moore-Penrose generalized inverse. Aug 5 '17 at 16:39

Well, if $Q=0$ then, specifically, its diagonal is zero, so all variances are zero! That would imply that all your observations (with probability 1) should be equal, and you do not need any distance measure.

I think you need to explain us the applied context, why are you interested in the case $Q=0$?

• Well, you suppose that the civariance matric $Q$ you use is the covariance matrix of the distribution of your data! Then, use that $\text{Var}(X)=0$ means that the probability of $X$ being equal to its expectation is 1. (Try to prove that!!) Then, if your model is correct, all your obs must be equal! If they bare not, then your model is wrong. Sep 18 '12 at 0:36
• I am intersted inthe case Q = 0 (I mean all elements are zeros) because I had a question on that definition I have posted as this:1. If the uncertainties associated with measurements is zero (i.e. there is no uncertainity), the distance is sort of undefined 2. To generalize the statistical distance we say it reduces to the normal Euclidaen distance is Q = identity BUT if it is identity, does that mean there is no uncertainty associated with the estimates What should be added to the difention to make generalized and defined. Sep 18 '12 at 16:52
• Shall I mention that $Q\geq 0$ i.e. positive semi definte so that the inverse exists and Q = 0 does is not allowed! Sep 18 '12 at 16:53
• I am not sure what you mean by "uncertain", the model behind the Mahalanobis distance suppose the measurements are exact, that is, no uncertainty (you did measure exactly that property of tht individual), Sep 19 '12 at 16:53
• (continuing) but they have a distribution in the population of individuals. uncertainty and variability is not the same, which do you mean? Another point: you might use the Moore-Penrose generalized inverse in the Mahalanobis distance, but when $Q=0$, that is also zero so gives distance zero. Bit if $Q$ merely have reduced rank, but nonzero, this gives the usual Mahalanobis distance in the subspace where the operator is acting! If all your data lives in that subspace, that is fine. If the data have components outside that subspace, this component is effectively zeroed. Sep 19 '12 at 16:53