In our bridging course (and indeed in Maths 1M and Maths 1A and several other courses) there is a section on differentiating logarithmic functions. One of the classic questions that we ask in such a section is to differentiate the log of some horrifying function, with the intention that the students use the log laws to simplify the original function first and *then* differentiate. There is something about this particular type of question has long bothered me and I only just figured out how to resolve my issue with it. I’m so excited I need to share it somewhere!

Below is pictured one of these questions:

There are a couple of approaches to answering this question, and often as teachers we ask students to do both of them and notice that the answer comes out the same.

The first approach is to differentiate naively using the chain rule:

There is absolutely nothing wrong with this approach and it is correct in absolutely every way. The only issue is the tendency of most students (and me too) of doing the quotient rule wrong, but that’s not a problem with the maths, per se.

The second approach is to use the log laws to simplify the original function and then differentiate. The working goes something like this:

As you can see, it’s much easier not to make a mistake, and still gives the same answer.

But there is something seriously wrong with the working above. Can you spot what it is? Let me tell you: ln[x/(x+1)] is defined for all values of x for which x/(x+1) is positive, and many of these values of x are negative. For example if x=-2, x/(x+1) = (-2)/(-1) = 2, and ln(2) is just fine. However, ln(x) – ln(x+1) is only defined for values of x where both x and x+1 are positive, which expressly rules out the value of x=-2! So our working only applies to some of the x’s for which the original function is defined!

For years this particular problem bothered me but I didn’t know what to do about it. I decided I would refrain from mentioning my issue to the students, but planned in my head what I would say if a student brought it up: “well, if you do the working it will always come out to the same answer as the formal chain-rule approach, even though there’s this issue, so it’s ok to do it.” This is of course a terrible cop-out! Luckily no student actually ever asked, yet the problem nagged at me every time a student did their assignment for this topic.

Then suddenly while planning a revision seminar for Maths 1A the answer came to me. I reasoned this way: *The reason why there is an issue is because the value of x/(x+1) is sometimes positive even though x is negative… the value of x/(x+1) is positive… positive… you make things positive by doing absolute values… of course! Absolute values is the key!*

If x/(x+1) is positive then it’s equal to its own absolute value! That is, if x/(x+1) is positive, then x/(x+1) = |x/(x+1)|. And ln has this neat little property that the derivative of ln|x| is 1/x regardless of whether x is positive or negative. Differentiation wipes out the absolute value signs, which means that if I put absolute value signs in they will vanish when I do the derivative. So here’s my revised working for the “simplify the log” version of the solution. It’s not tecnically shorter than the naive approach any more, but it is at least correct now:

Of course I’m not just excited about finally being able to scratch this annoying little itch! I am excited because I have learned something fundamentally true about functions involving logs. And it’s this: for all values of x for which ln(x) is defined, ln(x) = ln|x|. Not to say that ln(x) and ln|x| are the same function (considering the second one is defined for negative x while the first isn’t). No, it’s just that ln(x) and ln|x| *are* the same function if x>0. I knew this already because I have drawn the graphs any number of times, but its implications for doing the above problems did not appear to me until just now.

So in short, for all values of x for which ln(f(x)) is defined, ln(f(x)) = ln(|f(x)|), which is a great place to start your working when you need to differentiate it.