How to we represent the derivative of a n-D gaussian function defined by $g(\mathbf{x}) = \dfrac{1}{\sqrt{2 \pi \left|\Sigma\right|} } \exp^{-\dfrac{1}{2}({\mathbf{x}-\boldsymbol\mu}) ^\top \Sigma ({\mathbf{x}-\boldsymbol\mu})}$
$\Sigma$ is the covariance matrix of $\mathbf{x}$. Can i write this in the below way $g(\mathbf{x}) = \dfrac{1}{\sqrt{2 \pi \left|\Sigma\right|} } \exp^{-\dfrac{1}{2} \Sigma ({\mathbf{x}-\boldsymbol\mu}) ^2}$

Then the derivative itself becomes $\dfrac{\partial g}{\partial \mathbf{x}} = - \Sigma (\mathbf{x}-\boldsymbol\mu) \, g(\mathbf{x})$

Therefore, the derivative is always a polynomial times the gaussian itself. Are the notations right?

  • $\begingroup$ You can't generally commute in matrix multiplication, which is what you do when you swap the covariance matrix and the $(\mathbf{x}-\boldsymbol{\mu})^T$. $\endgroup$
    – rajb245
    Commented Jan 7, 2014 at 18:20
  • $\begingroup$ Replaced every \sum by \Sigma. $\endgroup$
    – Did
    Commented Jan 7, 2014 at 18:57
  • $\begingroup$ If $\Sigma$ is the covariance then the expression for $g$ should be $g(x) = \frac{1}{\sqrt{2\pi|\Sigma|}}\exp\left( -\frac{1}{2}(x-\mu)^\top\Sigma^{-1}(x-\mu)\right)$. You are missing the matrix inverse. $\endgroup$
    – Peder
    Commented Jan 7, 2014 at 19:12

1 Answer 1


By definition, the differential of $g$ at $x$ is the unique linear application $L_x:\mathbb R^n\to\mathbb R$ such that the function $h\mapsto g(x+h)$ is best approximated by the affine function $h\mapsto g(x)+L_x(h)$ when $h\to0$. Here, one can check that, for every $h$ in $\mathbb R^n$, $$L_x(h)=-g(x)(x-\mu)^T\Sigma h,$$ that is, $L_x(h)=V_x^Th$ where $$V_x=-g(x)\Sigma(x-\mu).$$ (This uses the fact that every covariance matrix is symmetric, thus $\Sigma=\Sigma^T$.) One often identifies the differential $L_x$ with the vector $V_x$, called the gradient of $g$ at $x$.

Can i write this in the below way $g(\mathbf{x}) = \dfrac{1}{\sqrt{2 \pi \left|\boldsymbol\sum\right|} } \exp^{-\dfrac{1}{2} \boldsymbol\sum ({\mathbf{x}-\boldsymbol\mu}) ^2}$

No, actually the RHS does not even make sense since $\Sigma(x-\mu)^2$ does not exist. Recall that $\Sigma$ is an $n\times n$ matrix and $x-\mu$ an $n\times1$ vector hence the only way to produce a real number, that is, a $1\times1$ matrix, multiplying them is to consider $(x-\mu)^T\Sigma(x-\mu)$.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .