# Derivative of a quadratic form with respect to a scalar

How would I take a derivative of a quadratic form with respect to a scalar, i.e. $$\frac{dx(t)^T\mathbf{Y}x(t)}{dt}$$ I have already tried splitting the quadratic form into its elements, and also applied the product rule, but it did not help. Any help is appreciated.

• If you understand the product rule, it should not be too hard to see that it is $x'(t)^TYx(t)+x(t)^TYx'(t)$. – Captain Lama May 8 at 15:43

The hint of CaptainLama is correct.

An alternative way is by expanding the form and observing what square terms

$$a\,x_0(t)^2\to 2a\,x_0(t)x_0'(t)$$

and double product terms

$$2b\,x_0(t)x_1(t)\to 2b\,x_0(t)'x_1(t)+2b\,x_0(t)x_1'(t)$$

become.

This should convince you that the derivative is the bilinear form

$$2x'(t)^TYx(t).$$

Since derivative, transposition and dot multiplication are linear operations, you can apply product rule: $$\frac d{dt}(x^\intercal Yx) = \frac{dx^\intercal}{dt}Yx+x^\intercal\frac{Y^\intercal}{dt}x + x^\intercal Y\frac{dx}{dt}.$$

Since $$dY/dt=0$$, we can remove the second term. And since the first term is scalar, we can replace it with its transpose:

$$\frac{dx^\intercal}{dt}Yx + x^\intercal Y\frac{dx}{dt} = \left(\frac{dx^\intercal}{dt}Yx\right)^\intercal + x^\intercal Y\frac{dx}{dt} = x^\intercal Y^\intercal\left(\frac{dx^\intercal}{dt}\right)^\intercal + \frac{dx^\intercal}{dt}Yx = x^\intercal(Y+Y^\intercal)\frac{dx}{dt}$$