# Mahalanobis distance - understanding the formula [duplicate]

I've read quite a few explanations on this topic, liking this one the most: https://mccormickml.com/2014/07/22/mahalanobis-distance/

But there is still one thing I don't understand.

I understand that the inverse of the covariance would deal with transformation of the (x-mu) to the standard gaussian. What I don't get is how is x^T infected by it?

To me, it seems that the we then take the dot product of elements 2 and 3 of the product, we transform only the (x-mu), and the first vector (x-mu)_transposed stays the same. So in the end we would get the dot product between the original vector and the transformed one.

## marked as duplicate by whuber♦ distributions StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Oct 4 at 13:12

$$(x-\mu)^\top S^{-1} (x-\mu) = (S^{-1/2} (x -\mu))^\top S^{-1/2} (x-\mu)$$
Then you can see that both $$x$$ and $$x^\top$$ are transformed in the same way.