Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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.

share|improve this question
    
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

1 Answer 1

up vote 1 down vote accepted

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

share|improve this answer
    
Wow, thanks for quick response, appreciate that :] One question though, what kl means exactly? –  mko Apr 20 '12 at 11:42
    
@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
    
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) –  mko Apr 20 '12 at 14:10
    
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.