I'd like to compute the partial derivative of $\frac{x^T r}{\sqrt{x^T S x}}$ with respect to $x_i$, or in another word just with respect to vector $x$. Here $x$ is an $n$ by $1$ vector, $r$ is an $n$ by $1$ constant vector and $S$ is an $n$ by $n$ constant matrix.
[EDIT] I used to use $\Sigma$ rather than $S$ in this problem but I realized it was an awful notation choice. To remove ambiguity I'm using $S$ now.
The denominator $\sqrt{x^T S x}$ is just quite annoying to process. I have gone through https://en.wikipedia.org/wiki/Matrix_calculus, but I haven't found a rule similar to the quotient rule of reguluar calculus $(\frac{u}{v})^{'} = \frac{u'v - v'u}{v^2}$. So I am not sure if I could just use a similar rule to get the square root in the denominator out of the way.
As comment suggested I'm showing my work of doing component-wise partial derivative. Let's say we are differentiating against $x_1$. then (here ' means derivative against $x_1$, not transpose of matrix).
\begin{equation} \label{eq1} \begin{split} (\frac{u}{v})^{'} & = \frac{u'v - v'u}{v^2} \\ & = \frac{ r_1 \sqrt{ x^T S X} - (\sqrt{ x^T S X})' x^T r }{ x^T S x} \end{split} \end{equation}
Here the complicated part is $(\sqrt{ x^T S X})'$, my tedious computation shows it should be $\frac{(S x)_i}{\sqrt{x^T S x}}$ and it becomes hairy.
$f(x) = (x^T r) (x^T \Sigma x)^{-1/2}$
$\begin{equation} \begin{split} \nabla f &= (x^T \Sigma x)^{-1/2} \nabla (x^T r) + (x^T r) \nabla (x^T \Sigma x)^{-1/2} \\ &= (x^T \Sigma x)^{-1/2} r + (x^T r) (-\frac{1}{2}) (x^T \Sigma x)^{-3/2} (2 \Sigma x) \\ &= \dfrac{ (x^T \Sigma x) r - (x^T r) \Sigma x}{(x^T \Sigma x)^{3/2}} \\ \end{split} \end{equation}$