# Thread: Differentiate with respect to vector

1. ## Differentiate with respect to vector

I have this problem:

$L=\frac{\mathbf{a}^T\mathbf{w}\mathbf{w}^T\mathbf{ a}}{\mathbf{w}^T(\mathbf{B}\mathbf{w}+\mathbf{C}\m athbf{w})}$

Here, $\mathbf{a}$ is a known d-by-1 vector, $\mathbf{w}$ is a d-by-1 vector to be identified, both $\mathbf{B}$ and $\mathbf{C}$ are known d-by-d matrix.

And I want to find the maximum value of L by taking the first order derivative with respect to $\mathbf{w}$.

Can anyone teach me how to take the first order derivative of this scalar with respect to a vector here?

Thanks a lot!!

2. Note that both the denominator and the numerator are of the form of w'Aw, where w' is the transpose of w. Let f(w) = w'Aw, calcuate the differential like this:
Let t be a real number and x be a vector, then
f(w+tx) = (w'+tx')A(w+tx) = f(w) + tw'(A+A')x + o(t)
Thus the linear map df(x) = w'(A+A')x is the differental of f at the point w.

For your case, L = f(w)/g(w), where f(w) = w'(a*a')w, g(w) = w'(B+C)w
dL(x) = [df(x)g(w) - f(w)dg(x)] / [g(w)]^2
let dL = 0, we get df(x)g(w) = f(w)dg(x) for any vector x.
Solve this you'll get the answer.