Derivative of Hadamard Product of two vectors

derivativeshadamard-productvectors

How can I compute the following derivative?
$$\frac{\partial(K u \circ T u)}{\partial u}$$
$K$ and $T$ are constant matrices, $u$ is an unknown vector. and $\circ$ is Hadamard product.

my solution:
$$\frac{\partial(K_{ij} u_j \circ T_{mn} u_n)}{\partial u_p} = K_{ij}\frac{\partial(u_j)}{\partial u_p}\circ T_{mn} u_n+K_{ij} u_j \circ T_{mn} \frac{\partial u_n}{\partial u_p} = K_{ij}\delta_{jp} \circ T_{mn} u_n+K_{ij} u_j \circ T_{mn} \delta_{np}=K_{ip} (\sum_n T_{mn} u_n)+T_{mp} (\sum_j K_{ij} u_j).$$
therefore it can be written as follow $$\frac{\partial(K u \circ T u)}{\partial u} = K^T(Tu)+T^T(Ku).$$
where $\square^T$ is the transpose of the matrix.

Best Answer

The Hadamard product of two vectors is like a scalar product but without summing over the index. So in your "my solution" the index m should be i (but there is no sum over i). The last expression in that calculation is then correct.

You cannot rewrite this in your very last expression since there is no sum over i. If you take the directional derivative, i.e. the derivative in the direction of some vector $h$ then you may rewrite it avoiding the index notation: $$ \frac{\partial(K u \circ Tu)}{\partial u} . h = Kh \circ Tu + Ku \circ Th$$

Related Question