How obtain the partial derivative of quadratic function $f(z)=\frac{1}{2} x^T(z)Q(z)x(z)$?

97 Views Asked by At

Consider $z\in \mathbb{R}$, $x(z):\mathbb{R} \to \mathbb{R}^{n\times 1}$ and $Q(z):\mathbb{R} \to \mathbb{R}^{n\times n}$ such that $Q(z)=Q^T(z)>0$. If we define the function $f(z):\mathbb{R} \to \mathbb{R}$ as $f(z)=\frac{1}{2}x^T(z)Q(z)x(z)$, thus, How obtain $\dfrac{\partial f(z)}{\partial z}$?

I know that $\dfrac{\partial f(z)}{\partial z}$ is one-dimensional, and if I derive in the traditional way, I obtain:

\begin{align} \dfrac{\partial f(z)}{\partial z} &= \left(\dfrac{\partial f(z)}{\partial x}\right)^T\dfrac{\partial x(z)}{\partial z}+ \left(\dfrac{\partial f(z)}{\partial Q}\right)^T\dfrac{\partial Q(z)}{\partial z}\\ &= \left(Q(z)x(z)\right)^T\dfrac{\partial x(z)}{\partial z}+ \left(\frac{1}{2}x(z)x^T(z)\right)^T\dfrac{\partial Q(z)}{\partial z} \end{align}

Of course I know that this solution is wrong, because the second term of right half site of previous equation is of dimension $\mathbb{R}^{n\times n}$

How could I get the $\dfrac{\partial f(z)}{\partial z}$ properly?

1

There are 1 best solutions below

1
On

I'm going to use Einstein's notation. We have that $$f=\frac{1}{2} x_iQ_{ij}x_j$$ So we have that $$f'=\frac{1}{2}\left({x'}_{i}Q_{ij}x_j+x_i{Q'}_{ij}x_j+x_iQ_{ij}{x'}_j\right)$$ Using the symmetry of $Q$, i.e. $Q_{ij}=Q_{ji}$, we get that $$f'=x_i Q_{ij} {x'}_j+\frac{1}{2} x_i {Q'}_{ij}x_j$$ i.e. $$f'=x^{t}Qx'+\frac{1}{2}x^{t}Q'x$$ Where $x'$ and $Q'$ are component-wise derivatives.