# GL(s,R)

## July 7, 2012

### The Usual Way Is Just Fine, Man.

Filed under: Tricks of the Trade — Adam Glesser @ 11:29 pm
Tags: ,

(with Professor Glesser)

As I mentioned in this much-maligned post, “my all-time favorite differentiation technique is logarithmic differentiation.” In that post, I give examples of two types of problems where the technique proves useful. The second type—where a variable function is raised to a variable power—is handled with the SPEC rule (essentially the sum of the power rule and exponential rule, with the chain rule used as per normal). Here is the example I gave of a function of the first type.
$y = \sqrt[3]{\dfrac{(3x-2)^2\sqrt{2x^3+1}}{x^4(x-1)}}$
Typically, I show the students how to use logarithmic differentiation in order to compute the derivative of this type of function (see the post linked to above for the full derivation). However, this is not how I compute it myself!

# Story Time

Like most everybody who takes calculus, I learned the quotient rule for differentiation:

$\left(\dfrac{f}{g}\right)' = \dfrac{g \cdot f' - f \cdot g'}{g^2}$

Or, in song form (sung to the tune of Old McDonald):

Low d-high less high d-low
E-I-E-I-O
And on the bottom, the square of low
E-I-E-I-O
[Note that when sung incorrectly as High d-low less low d-high, the rhyme will not work!]

At some point, I was given an exercise to show that
$\left(\dfrac{f}{g}\right)' = \dfrac{f}{g}\left(\dfrac{f}{f'} - \dfrac{g}{g'}\right).$
If you start from this reformulation, it is a simple matter of algebra to get to the usual formulation of the quotient rule. However, a couple of things caught my eye. First, the reformulation seemed much easier to remember: copy the function and then write down the derivative of each function over the function and subtract them; the order is the “natural” one where the numerator comes first.

## Story Within A Story Time

Actually, there is a reasonably nice way to remember the order of the quotient rule, at least if you understand the meaning of the derivative. Assume that both the numerator and denominator are positive functions. If the derivative of the numerator is increasing, then the numerator and the quotient are getting bigger faster, so the derivative of the quotient should also be getting bigger, i.e., $f'$ should have a positive sign in front of it. Similarly, if the derivative of the denominator is increasing, then the denominator is getting bigger faster, which means the quotient is getting smaller faster, and so the derivative of the quotient is decreasing, i.e., $g'$ should have a negative sign in front of it.

Secondly, the appearance of the original function in the answer screams: LOGARITHMIC DIFFERENTIATION. Let’s see why.

If $y = \dfrac{f}{g}$, then $\ln(y) = \ln\left(\dfrac{f}{g}\right) = \ln(f) - \ln(g)$. Differentiating both sides using the chain rule yields
$\dfrac{y'}{y} = \dfrac{f'}{f} - \dfrac{g'}{g},$
and so the result follows by multiplying both sides by $y$. This is one of my favorite exercises to give first year calculus students—before and after teaching them logarithmic differentiation*.

*Don’t you think that giving out the same problem at different times during the course is an underutilized tactic?

Being a good math nerd, I had to take this further. What if the numerator and denominator are, themselves, a product of functions? Assume that $f = f_1 \cdot f_2 \cdots f_m$ and that $g = g_1 \cdot g_2 \cdots g_n$. Setting $y = \dfrac{f}{g}$, taking the natural logarithm of both sides, and applying log rules, we get:

$\ln(y) =\ln(f_1) + \ln(f_2) + \cdots + \ln(f_m) -\ln(g_1) - \ln(g_2) - \cdots - \ln(g_n).$

Differentiating (using the chain rule, as usual) gives:

$\dfrac{y'}{y} = \dfrac{f'_1}{f_1} + \dfrac{f'_2}{f_2} + \cdots + \dfrac{f'_m}{f_m} - \dfrac{g'_1}{g_1} - \dfrac{g'_2}{g_2} - \cdots - \dfrac{g'_n}{g_n}.$

Multiplying both sides by $y$ now gives us the formula:

$y' = \dfrac{f}{g}\left(\dfrac{f'_1}{f_1} + \dfrac{f'_2}{f_2} + \cdots + \dfrac{f'_m}{f_m} - \dfrac{g'_1}{g_1} - \dfrac{g'_2}{g_2} - \cdots -\dfrac{g'_n}{g_n}\right).$

An immediate example of using this is as follows. Differentiate $y = \dfrac{\sin(x)e^x}{(x+2)\ln(x)}$. The usual way would involve the quotient rule mixed with two applications of the product rule. The alternative is to simply rewrite the function, and to work term by term giving:

$y' = \dfrac{\sin(x)e^x}{(x+2)\ln(x)}\left(\dfrac{\cos(x)}{\sin(x)} + \dfrac{e^x}{e^x} - \dfrac{1}{x+2} - \dfrac{1/x}{\ln(x)}\right),$

which immediately reveals some rather easy simplifications.

But we haven’t used all of the log rules yet! We haven’t used the exponential law. So, let’s assume that each of our $f_i's$ and $g_j's$ has an exponent, call them $a_i$ and $b_j$, respectively. In this case, using logarithmic differentiation, we get:

$\ln(y) = a_1\ln(f_1) + \cdots + a_m\ln(f_m) - b_1\ln(g_1) - \cdots - b_n\ln(g_n)$.

Differentiating, we get almost the same formula as above, but with some extra coefficients:

$y' = \dfrac{f}{g}\left(a_1\dfrac{f'_1}{f_1} + \cdots + a_m\dfrac{f'_m}{f_m} - b_1\dfrac{g'_1}{g_1} - \cdots - b_n\dfrac{g'_n}{g_n} \right).$

Look back to the example near the top of the post. If we rewrite it with exponents instead of roots, we get:

$y = \dfrac{(3x-2)^{2/3}(2x^3 + 1)^{1/6}}{x^{4/3}(x-1)^{1/3}}$.

Taking the derivative is now completely straight-forward.

$y' = \dfrac{(3x-2)^{2/3}(2x^3 + 1)^{1/6}}{x^{4/3}(x-1)^{1/3}}\left(\dfrac{2}{3}\cdot\dfrac{3}{3x-2} + \dfrac{1}{6}\cdot\dfrac{6x^2}{2x^3+1} - \dfrac{4}{3}\cdot\dfrac{1}{x} - \dfrac{1}{3}\cdot \dfrac{1}{x-1}\right).$

Again, there is some simplifying to be done.

An easier problem is one without a denominator! Let $y = \tan(2x)x^{3/4}(3x-1)^3$. Normally, one would use the product rule here, but why don’t we try our formula. It gives:

$y' = \tan(2x)x^{3/4}(3x-1)^3\left(\dfrac{2\sec^2(2x)}{\tan(2x)} + \dfrac{3}{4}\cdot \dfrac{1}{x} + 3\dfrac{3}{3x-1}\right).$

That was pretty painless, while the product rule becomes more tedious as the number of factors in the product increases.

Oh, and if you can’t imagine this being appropriate to teach to students, no less an authority than Richard Feynman encouraged his students to differentiate this way. At the very least, his support gives me the confidence to let you in on my little secret.

Blog at WordPress.com.