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.

This is fairly simple, but my matrix calculus is not that strong. Given two functions, $f:\mathbb{R}^N\to\mathbb{R}$, $g:\mathbb{R}^N\to\mathbb{R}$, and $x\in\mathbb{R}^N$, how do I compute the following derivative $$\frac{\partial }{\partial x}\left(\frac{f(x)}{g(x)}\right)$$

In the scalar case ($N=1$) the derivative of the ratio is just obtained by the basic product rule $$\frac{\partial }{\partial x}\left(\frac{f(x)}{g(x)}\right) = \frac{f'(x)}{g(x)} - \frac{f(x)g'(x)}{g^2(x)}$$ But if I try to generalize this to the multivariate case, the derivative terms are no longer scalars, they become vectors of dimension $N\times 1$. Does the above idea of applying the product rule generalize to the multivariate case? I realize there needs to be some transpose operators somewhere in there but I'm not sure where.

Also, how would I write out the second derivative in the multivariate case? $$\frac{\partial^2 }{\partial x^2}\left(\frac{f(x)}{g(x)}\right)$$

(any good references on matrix calculus to help me with this stuff is appreciated!)

Thank you!

share|improve this question
1  
The ratio rule holds as you have written. It is just that $f'$ and $g'$ have to be replaced with the corresponding gradients. –  Fabian Jan 1 '13 at 22:58

1 Answer 1

up vote 1 down vote accepted

You just need a little bit of the chain rule and the product rule.

The vector derivative still obeys the product rule:

$$\nabla \frac{f}{g} = \frac{1}{g} \nabla f + f \nabla \frac{1}{g}$$

The key is doing the derivative of $1/g$. We can set $\tau = 1/g$ and see that $d\tau/dg = -1/g^2$. The key then is to use the chain rule to get

$$\nabla \tau = \frac{d\tau}{dg} \nabla g$$

As has been said, this essentially reproduces the single-variable result. The Laplacian can be attacked in a similar way. The keys to this approach are just to use the product rule, along with the chain rule to turn division into multiplication.

share|improve this answer
    
Thanks for the help. Just to make sure I am computing the second derivative correctly, does someone mind checking the work below? So, we know that $$\nabla\frac{f}{g} = \frac{1}{g}\nabla f + f\nabla \frac{1}{g} = \frac{1}{g}\nabla f - \frac{f}{g^2}\nabla g$$. This is an $N$-dimensional vector. Now the second derivative is given by, $$\nabla^2 \frac{f}{g} = \frac{1}{g}\nabla^2 f - \frac{1}{g^2}\nabla g\nabla f - \frac{f}{g^2}\nabla^2 g - \frac{1}{g^2}\nabla f\nabla g + \frac{2f}{g^3}\nabla g\nabla g$$ But what does $\nabla f\nabla g$ mean, both are col. vectors? Need a transpose? –  Erik Miehling Jan 4 '13 at 3:21
1  
Yes, terms that are $\nabla g \nabla f$ should be written as $\nabla g \cdot \nabla f$, which means that, interpreted as matrix operations, it would be $(\nabla g)^\dagger \nabla f$. –  Muphrid Jan 4 '13 at 3:34
    
Thanks! But should the tranpose operator be on the $\nabla f$ term instead of the $\nabla g$ term, since we know $\nabla^2 \frac{f}{g}$ should be a matrix? (assuming both are column vectors) –  Erik Miehling Jan 4 '13 at 3:40
    
It kind of depends what you mean by $\nabla^2$. In vector calculus, $\nabla^2$ is a scalar differential operator--in that it takes scalar fields to scalar fields. What you want could be written in index notation as $H_{ij} = (e_i \cdot \nabla)(e_j \cdot \nabla) f/g$, where the indices $i,j$ denote the corresponding entry in the matrix $H$. $e_i, e_j$ are basis vectors. –  Muphrid Jan 4 '13 at 4:31

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.