1
$\begingroup$

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.

  • 0
    So, $A$is a matrix?2012-04-20
  • 0
    Sorry, i forgot to mention it, yes A is matrix.2012-04-20
  • 0
    I presume a symmetric positive definite matrix.2012-04-20

1 Answers 1

1

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}.$$

  • 0
    Wow, thanks for quick response, appreciate that :] One question though, what kl means exactly?2012-04-20
  • 0
    @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$.2012-04-20
  • 0
    Thanks again. I have more questions to ask if i may: 1.) why is f (in the first expression) in denominator? (is it because of sqrt?) 2.) will the derivative be different if x,y are vectors? (i suppose not)2012-04-20
  • 0
    3.) if the distance is squared: $\|x-y\|^2_A$, the final derivative would be same but *2?2012-04-20
  • 0
    @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)$).2012-04-20