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: ,

Tricks of the Trade

(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.

July 6, 2012

In Defense of Shrtcts

Filed under: Tricks of the Trade — Adam Glesser @ 10:41 pm
Tags: ,

Several times, I have written about handy shortcuts that bypass some of the tedium of calculation.The frequency with which readers derided these tricks or mnemonics surprised me. For instance, my post on a shortcut for logarithmic differentiation ended up being the topic of a Facebook debate on sound pedagogy. One of the participants claimed that he would never teach the SPEC rule since he would rather the students know how to use logarithmic differentiation. It seemed to me that this is equivalent to not teaching the power rule because you would rather the students know how to evaluate limits and to utilize the binomial theorem.

Let’s face it, anyone who disagrees with using shortcuts or mnemonics probably should add, “at least in addition to the shortcuts and mnemonics that are already in common use.” Our entire system of notation is designed (sometimes poorly) to make the meaning easier to remember and computations easier to perform, e.g., decimal notation versus Roman numerals. There is nothing wrong with observing that a long computation reveals a pattern or an invariant that allows for a more direct route to the answer; this is a process embraced by mathematicians (I’d love to know what percentage of math papers simply improve on the proof of a known result).

Am I wrong or is there a misconception that teaching a shortcut implies not teaching the reason behind the shortcut? When I was in ninth grade, I did a project on mental arithmetic. The teacher gave back my draft with a comment asking for justifications of the tricks I was using. I learned so much about algebra trying to complete that assignment, perhaps more than I would learn in an entire high school algebra course. Make learning the inner-workings a priority, and the shortcuts arise naturally.

The June 2012 issue of the Notices of the AMS contains a provocative article by Frank Quinn. Amongst other things, he stresses that work on an abstract and symbolic level is important. Of course, there are lots of ways of incorporating abstraction into a class. Wouldn’t it be doubly beneficial if the result of that work was a faster way to perform a calculation?

Blog at WordPress.com.