Introduction and Trace Tricks

The pdf of a multivariate gaussian is as follows:

, where

is the covariance matrix, which can be expressed in vector notation as

. I might make the derivation of this formula its own post at some point, but it is in Strang’s intro to linear algebra text so I will hold off. Instead, this post derives the entropy of the multivariate gaussian, which is equal to:

Part of the reason why I do this is because the second part of the derivation involves a “trace trick” that I want to remember how to use for the future. The key to the “trace trick” is to recognize that a matrix (slash set of multiplied matrices) is 1x1, and that the value of any such matrix is, by definition, equal to its trace. This then allows you to invoke the quasi-commutative property of the trace:

to push around the matrices however you desire until they become something tidy/useful. The whole thing feels rather devious to me, personally.

Derivation

Setup

Beginning with the definition of entropy

substituting in the probability function for the multivariate gaussian in only its second occurence in the formula,

We will now consider these two terms separately.

First term

First, we concern ourselves with the first ln term:

since all the terms other than form a constant,

and because is a PDF, it integrates to 1. Thus, this component of the equation is

Second term (Trace Trick Coming!)

Now we consider the second ln term

because is a 1 x N matrix, is a N x N matrix, and is a N x 1 matrix, the matrix product is a 1 x 1 matrix. Further, because the trace of any 1 x 1 matrix , we can conclude that the 1 x 1 matrix .

As such, our term becomes

, which, by the quasi-commutativity property of the trace function, ,

. Because is a scalar and the natural logarithm and exponentials may cancel, the properties of the trace function allow us to push the and the integral inside of the trace, so

But, $\int p(x)(x-\mu)(x-\mu)^{T}dx=\Sigma$ is just the definition of the covariance matrix! As such,

Recombining the terms

Bringing the above terms back together, we have

as desired.