Skip to content
All library documents

Differentiating a Quadratic Portfolio Term with a Symmetric Matrix

Article Quant Q&A · Author: user2034

Summary

The question asks why differentiating a quadratic expression, one-half times a vector transposed, multiplied by a symmetric matrix and the vector, produces a linear gradient term. The answer explains the role of the one-half factor: differentiating a scalar square introduces a factor of two, which cancels it. For a symmetric matrix, the gradient of the quadratic form is twice the matrix times the vector, so the prefactor leaves the matrix-vector product. The separate linear term contributes its coefficient vector to the gradient.

The response recommends checking the identity by expanding a small two-by-two example and points readers toward scalar-by-vector derivative identities. It gives an intuitive explanation rather than a full component-by-component derivation. Its formula is stated for a symmetric matrix; with a general nonsymmetric matrix, the quadratic-form gradient involves the sum of the matrix and its transpose. The prompt calls the matrix a correlation matrix, which is ordinarily symmetric, so the stated condition is appropriate.

Key ideas

  • The factor of one-half cancels the factor of two produced by differentiating a quadratic form with a symmetric matrix.
  • The gradient of the quadratic term is the matrix multiplied by the vector, after applying the one-half prefactor.
  • The gradient of a linear vector term is its coefficient vector.
  • Expanding a small matrix example can make the transpose and derivative rules easier to verify.
  • For a nonsymmetric matrix, the quadratic-form gradient requires both the matrix and its transpose.

Tags

Full text
# Desperate for help with simple derivative


# Desperate for help with simple derivative












Can someone help explain how differentiating the following with respect to $x$:

$$ \frac{1}{2} \alpha \mathbf{x}^T \Sigma \mathbf{x} + (\mathbf{\mu} - R\mathbf{1})\mathbf{x} $$

Yields the following:

$$ \alpha \Sigma \mathbf{x} + (\mathbf{\mu} - R\mathbf{1}) $$

Where $\Sigma$ is a correlation matrix.

I'm rusty with my linear algebra so the derivate of these transpose matrices isn't making any sense to me. A detailed explanation would be very much appreciated. What happens to the 1/2, and that whole first term in general?

## Answer by jaamor (score 1, accepted)

https://quant.stackexchange.com/a/16759

Could you please be more specific with your question and post the text here? This will be more helpful for other people visiting the site.

Now as far as to where the 1/2 went, usually people put 1/2 in front of the second order term because this will simplify to 1 after the derivation:

$$ \frac{\partial x^2}{\partial x} = 2x $$ vs $$ \frac{1}{2} \cdot \frac{\partial x^2}{\partial x} = x $$

To understand what are the mechanics behind the derivation in your question, I suggest creating your own 2x2 matrices and going through the calculations.

In your case $\Sigma$ is symmetric, in which case:

$$ \frac{\partial \mathbf{x}^T \mathbf{A} \mathbf{x}}{\partial x} = 2\mathbf{A}\mathbf{x} $$ vs

To learn more, go HERE and take a look at the scalar-by-vector identities.

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.