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.

how would I calculate the derivative of the following. I want to know the derivative so that I can maximise it.

$$ \frac{x^TAx}{x^TBx} $$

Both the matricies A and B are symmetric. I know the derivative of $\frac{d}{dx}x^TAx = 2Ax$. Haven't been very successful applying the quotient rule to the above though. Appreciate the help. Thanks!

EDIT: In response to "What goes wrong when applying the chain rule". We know that: $$ \frac{d}{dx}\frac{u}{v} = \frac{vu' - uv'}{v^2} $$ Which would give me: $$ \frac{2x^TBxAx - 2x^TAxBx}{x^TBx^2} \, or \, \frac{2Axx^TBx - 2Bxx^TAx}{(x^TBx)^2} $$

In the first case the dimensions don't agree. In the second they do, but I don't want to assume that it's correct just because the dimensions agree. If it is correct then please do let me know!

share|improve this question
1  
What goes wrong when you try to apply the chain rule? –  Owen Biesel Oct 13 '12 at 4:47
1  
See edit. Thanks –  foges Oct 13 '12 at 4:57
add comment

1 Answer 1

up vote 3 down vote accepted

Both expressions are correct, up to some missing parentheses, in the following sense: For each $i$, we have $\frac{\partial}{\partial x_i}(x^TAx) = 2(Ax)_i$ and $\frac{\partial}{\partial x_i}(x^TBx) = 2(Bx)_i$, so the quotient rule tells us that

$$\frac{\partial}{\partial x_i}\frac{x^TAx}{x^TBx} = \frac{2(Ax)_i(x^TBx) - 2(Bx)_i(x^TAx)}{(x^TBx)^2}.$$

This may be written, if you interpret $d/dx$ as gradient, as

$$\frac{d}{dx}\frac{x^TAx}{x^TBx} = \frac{2Ax(x^TBx) - 2Bx(x^TAx)}{(x^TBx)^2} = \frac{2Axx^TBx - 2Bxx^TAx}{(x^TBx)^2},$$ so your second expression is correct.

Since $(x^TAx)$ and $(x^TBx)$ are just numbers, if left inside their parentheses they can multiply a vector or matrix from either side. Hence the first expression is also correct if you are sure to leave in the parentheses:

$$\frac{d}{dx}\frac{x^TAx}{x^TBx} = \frac{2(x^TBx)Ax - 2(x^TAx)Bx}{(x^TBx)^2}.$$

share|improve this answer
1  
Ok great, thanks. That makes sense :) –  foges Oct 13 '12 at 5:27
add comment

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.