Considering a distance d(x,y) = $d_A(x,y)$ defined in form: $\|x-y\|_A = \sqrt{(x-y)^TA(x-y)}$ where A is matrix (positive semi-definite).

Let $f=\|x-y\|_A$, so i want to calculate $\dfrac{\partial f}{\partial A}$

Idea is to minimize function by gradient method so partial derivation is needed. What would be the answer? Thanks.

-
So, $A$is a matrix? – Raskolnikov Apr 20 '12 at 11:08
Sorry, i forgot to mention it, yes A is matrix. – mko Apr 20 '12 at 11:11
I presume a symmetric positive definite matrix. – Fabian Apr 20 '12 at 11:15

We have employing the chain rule ($z=x-y$) $$\frac{\partial f}{\partial A_{kl}}= \frac{1}{2f} \frac{\partial}{\partial A_{kl}} z^T A z.$$
We find the remaining derivative, by expanding $z^T A z$ in components and using $\partial_{A_{kl}} A_{mn} = \delta_{km} \delta_{ln}$: $$\frac{\partial}{\partial A_{kl}} z^T A z = \frac{\partial}{\partial A_{kl}} \sum_{mn} z_m A_{mn} z_n = z_k z_l.$$
Putting everything together, we have obtained $$\frac{\partial f}{\partial A_{kl}}= \frac{(x_k-y_k) (x_l-y_l)}{2 f}.$$
@mko: $kl$ refers to the two indices of the matrix; e.g., if you take the partial derivative with respect to the entry $A_{12}$ (first row, second column) then $k=1$ and $l=2$. – Fabian Apr 20 '12 at 13:49
3.) if the distance is squared: $\|x-y\|^2_A$, the final derivative would be same but *2? – mko Apr 20 '12 at 14:17
@mko: yes, the $f$ is in the denominator because of the $\sqrt {}$. If you take the derivate of $f^2$ then you obtain the final result without the denominator (that is $(x_k-y_k)(x_l -y_l)$). – Fabian Apr 20 '12 at 14:20