Logarithmic functions

Illuminated analog VU meters and rows of control knobs on an audio mixing console.
Photo by Anna Pou on Pexels.

When we describe how much a quantity has changed, we often compare it with its starting value. A doubling is a 100% increase whether we start with a small quantity or a large one. For measurements that cover a wide range, it can be useful to build a scale around these relative changes. Sound level and acidity are two measurements that use this idea.

Logarithms let us turn multiplicative steps in a quantity into additive steps on a scale. We’ll see how this comes from reversing an exponential relationship, and how the differential of a logarithm describes a relative change. That connection will help us interpret measurements and differentiate expressions in which both the base and the exponent can vary.

By the end of this lesson, you should be able to:

  • Use relative change and inverse exponential reasoning to construct and interpret a logarithmic scale.
  • Differentiate logarithmic expressions and exponentials with other bases, and interpret relative rates of change.
  • Use logarithmic differentiation to find derivatives of products, quotients, and powers with changing exponents.

When we turn up a steady sound, we can compare the added intensity with the intensity already present. Adding the same amount to two sounds can produce very different relative changes. We’ll build a sound level scale that responds to those relative changes.

Sound intensity measures the energy carried each second through a unit of area. It’s measured in watts per square meter, written \( \text{W}/\text{m}^2 \). We’ll use \( I_0=10^{-12}\,\text{W}/\text{m}^2 \), approximately the threshold of human hearing, as our reference sound. Let \( x \) be the ratio of the sound’s intensity \( I \) to that reference. For example,

\[x=\frac{I}{I_0}=\frac{2\times10^{-12}\,\text{W}/\text{m}^2}{10^{-12}\,\text{W}/\text{m}^2}=2.\]

The units cancel, so \( x \) has no units. Here \( x=2 \) means twice the reference intensity; \( x=1 \) would mean the reference itself.

Suppose we turn up the sound so that \( x \) goes from \( 2 \) to \( 2.1 \). The increase is \( \Delta x= \) . To compare that increase with the starting intensity, divide by the starting ratio \( x=2 \). The relative increase is \(\displaystyle \frac{\Delta x}{x}=\frac{0.1}{2}= \)\(\displaystyle =\)\(\displaystyle \%\)\(\displaystyle \text.\)

Now suppose we start with a more intense sound and turn it up from \( x=20 \) to \( x=20.1 \). This time, the increase is \( \Delta x= \) . In this case, the relative increase is \(\displaystyle \frac{\Delta x}{x}=\frac{0.1}{20}= \)\(\displaystyle =\)\(\displaystyle \%\)\(\displaystyle \text.\) Even though we added the same amount, that difference makes up a fraction of the more intense sound, so the increase is less noticeable.

To describe how we actually perceive changes in sound, we’ll define a sound level \( L \) based on the relative increase in intensity. We'd like equal small percentage increases in intensity to give equal small increases in sound level, whether the starting sound is faint or intense.

For the simplest version of this scale, we’ll set the infinitesimal change in sound level equal to the relative change in intensity:

\[\dd{L}=\frac{\dd{x}}{x}.\]

Dividing both sides by \( \dd{x} \), the sound level must satisfy \( \displaystyle \frac{\dd{L}}{\dd{x}}= \) . We can demonstrate this by calculating a few sensitivities:

Intensity ratio \( x \) \( \displaystyle \frac12 \) \( 1 \) \( 2 \) \( 4 \)
Level’s sensitivity \( \displaystyle \dv{L}{x} \)

These slopes are , but they get as intensity increases. A curve following them should rise sharply at first and become .

We’ll set sound level zero at the reference intensity, so that \( L(1)=0 \). The red curve below follows the slope field through that point. Compare its direction at several intensity ratios with the nearby blue segments.

The required slopes depend on intensity ratio but not on the current sound level. Farther to the right, the blue segments and the red curve become flatter.

We know the slopes we want, but we still need a function that can describe the sound level. To find one, let's turn the relationship around and regard intensity ratio \( x \) as a function of sound level \( L \). Since \( \displaystyle \dv{L}{x}=\frac1x \), we also have

\(\displaystyle \frac{\dd{x}}{\dd{L}}=\)\(\displaystyle .\)

This is the proportional-growth equation from Section 4.2, with sound level taking the place of time! When \( L=0 \), the intensity ratio is . The function that satisfies this equation and starting value is \( x(L)= \) .

To find the sound level from a given intensity ratio, we need to solve for the exponent that produces that ratio. This is what the familiar natural logarithm does:

\[L(x)=\ln x.\]

We can compare intensity ratios with their sound levels in a table. Use a calculator and round the sound levels to two decimal places.

Intensity ratio \( x \) Sound level \( L(x)=\ln x \)
\( 1 \)
\( 10 \)
\( 100 \)
\( 1000 \)

Notice that every time the intensity ratio is multiplied by \( 10 \), the corresponding sound levels increase by . Multiplicative steps in intensity become added steps in sound level: each multiplication by \( 10 \) adds \( \ln10 \), about \( 2.30 \), to the sound level. Its curve rises more slowly as intensity increases because the same added intensity is a smaller fraction of what’s already there. This is why we use logarithmic scales in practice: they turn multiplicative changes in a quantity into additive changes in its reading.

The natural logarithm

Sometimes we want to undo what a function does. If we square \( 3 \), we get \( 9 \); taking the square root brings us back to \( 3 \). More generally, squaring and taking the square root undo each other (as long as we start with a nonnegative number):

\[\sqrt{x^2}=x,\qquad (\sqrt{x})^2=x,\qquad x\ge0.\]

We call functions that undo each other inverse functions. A logarithm undoes an exponential in the same way. For example, the expression \( \ln10 \) asks: “\( \ee \) to what power is \( 10 \)?” Since \( \ee^{2.3026}\approx 10 \), we have \( \ln 10\approx 2.3026 \).

In the Explore activity, we used this reversal to turn \( x=\ee^L \) into a formula for the sound level \( L \).

The exponential function has every positive value exactly once as an output, so the natural logarithm is unique for each positive input. In particular, \( \ln1=0 \) since \( \ee^0=1 \), and \( \ln\ee=1 \) since \( \ee^1=\ee \). Inputs between \( 0 \) and \( 1 \) have negative logarithms, since we need negative exponents to produce them.

We can see this reversal on the graphs. Drag the red point or move the intensity-ratio slider to compare an intensity ratio with its sound level. The matching points exchange their horizontal and vertical coordinates.

Blue gives intensity ratio from sound level; red gives sound level from intensity ratio. The dashed line shows where the two coordinates are equal. The slider p is the intensity ratio.

Explore suggested that the logarithm’s derivative is the reciprocal of its input. We can verify this using the inverse relationship and the exponential derivative.

In differential form, the logarithm rule becomes

\[\begin{aligned}\dd{(\ln x)}&=\frac1x\dd{x}\\&=\frac{\dd{x}}{x},\qquad x>0.\end{aligned}\]

We divide \( \dd{x} \) by \( x \) to compare the change with the intensity already present. This fraction is the relative infinitesimal change in intensity, the infinitesimal version of \( \displaystyle \frac{\Delta x}{x} \) from Explore. For our sound level scale, \( \displaystyle \dd{L}=\frac{\dd{x}}x \), so this relative change in intensity gives the change in sound level.

The same rule applies to any positive quantity \( y \):

\[\dd{(\ln y)}=\frac{\dd{y}}{y}.\]

If \( y=f(x) \), then \( \dd{y}=f'(x)\dd{x} \). Dividing by \( y=f(x) \) gives

\[\frac{\dd{y}}{y}=\frac{f'(x)}{f(x)}\dd{x}.\]

For a positive input \( u \), we have \( \displaystyle \dd{(\ln u)}=\frac{\dd{u}}{u} \). If \( u=f(x) \), substitute \( \dd{u}=f'(x)\dd{x} \) to get \( \displaystyle \dd{(\ln f(x))}=\frac{f'(x)}{f(x)}\dd{x} \). Dividing by \( \dd{x} \) gives the Chain Rule formula for the derivative.

To find a relative rate, we divide how fast a quantity is changing by its current amount. For a function \( f \), this gives \( \displaystyle \frac{f'(x)}{f(x)} \), called its relative rate of change, wherever \( f(x)\ne0 \). When the input is time, multiplying this ratio by \( 100 \) gives the instantaneous percentage change per unit time.

Log properties

The familiar algebraic properties of logarithms help us work with products, quotients, powers, and other bases.

For instance, multiplying an input by a positive factor \( r \) adds \( \ln r \) to its logarithm. This explains why equal intensity factors in Explore gave equal sound level steps.

We can work with other bases by expressing them in terms of \( \ee \) and the natural logarithm. For example, \( 2=\ee^{\ln2} \), so \( 2^x=\ee^{x\ln2} \). Differentiating introduces the constant input factor \( \ln2 \). The same reasoning works for any positive base.

We can write these rules with differentials as well:

\[\begin{aligned}\dd{(b^x)}&=b^x\ln b\dd{x},\\\dd{(\log_bx)}&=\frac{\dd{x}}{x\ln b}.\end{aligned}\]

The base and input conditions are the same as in the derivative rules above.

For bases above \( 1 \), \( \ln b \) is positive and both functions increase. For bases between \( 0 \) and \( 1 \), it’s negative and both functions decrease.

Perceived brightness

The connection between logarithms and relative change gives us another way to model perception.

Logarithmic differentiation

Sometimes taking a logarithm makes a derivative easier to find. Log properties turn products into sums and bring exponents down as factors, leaving expressions we can differentiate with familiar rules.

For a positive quantity \( y \), we have \( \displaystyle \dd{(\ln y)}=\frac{\dd{y}}{y} \). We first find how \( \ln y \) changes, then multiply by \( y \) to find \( \dd{y} \). This method is called logarithmic differentiation.

Taking a logarithm let us separate the changing exponent from the changing base. The same strategy can simplify products and quotients: find the differential of the simpler logarithmic expression, then multiply by the original function to recover its differential.

Work where the functions are defined. For logarithmic differentiation, use positive inputs.

  1. Find each derivative.

    1. \( \displaystyle \dv{x}\ln(${a}x+${b})= \) .

      Solution

      Divide the input derivative by the input itself. The derivative is \( \displaystyle \frac{${a}}{${a}x+${b}} \).

    2. \( \displaystyle \dv{x}\ln(x^2+${c})= \) .

      Solution

      The input derivative is \( \displaystyle 2x \), so the Chain Rule gives \( \displaystyle \frac{2x}{x^2+${c}} \).

    3. \( \displaystyle \dv{x}\bigl(${log_product_factor}\ln x\bigr)= \) .

      Solution

      Differentiate both factors with the Product Rule:

      \[\begin{aligned}\dv{x}\bigl(${log_product_factor}\ln x\bigr)&=${coefficient_prefix}\bigl(\ln x+x\frac1x\bigr)\\&=${coefficient_prefix}(\ln x+1).\end{aligned}\]

    4. \( \displaystyle \dv{x}\log_{${b}}x= \) .

      Solution

      Change of base divides \( \displaystyle \ln x \) by the constant \( \displaystyle \ln ${b} \). The derivative is \( \displaystyle \frac1{x\ln ${b}} \).

    5. \( \displaystyle \dv{x}${b}^x= \) .

      Solution

      The constant-base rule gives \( \displaystyle ${b}^x\ln ${b} \).

    6. \( \displaystyle \dv{x}${b}^{${exponent}}= \) .

      Solution

      We use the constant-base rule, then multiply by the derivative of the exponent, \( \displaystyle ${k} \). This gives \( \displaystyle ${coefficient_prefix}(\ln ${b})${b}^{${exponent}} \).

    7. \( \displaystyle \dv{x}\bigl(${log_sine}\bigr)= \) .

      Solution

      The derivative of \( \displaystyle \ln(\sin x) \) is \( \displaystyle \frac{\cos x}{\sin x} \). Multiplying by \( \displaystyle ${a} \) gives \( \displaystyle ${log_sine_derivative} \), or \( \displaystyle ${coefficient_prefix}\cot x \).

  2. Doubling a sound’s frequency raises its pitch by one octave; halving the frequency lowers it by one octave. The pitch of a tone with frequency \( f>0 \) hertz, measured in octaves above a reference tone of \( 440 \) hertz, is

    \[P(f)=\log_2\left(\frac f{440}\right).\]

    A negative value means the tone is below the reference pitch. A tone initially has frequency \( ${frequency} \) hertz.

    1. Its pitch relative to the reference is octaves. Find the differential \( \dd{P} \) in terms of \( f \) and \( \dd{f} \).

      Solution

      The frequency ratio is \( \displaystyle \frac{${frequency}}{440}=2^{${p}} \), so the pitch relative to the reference is \( ${p} \) octaves. Taking \( \displaystyle u=\frac f{440} \) gives \( \displaystyle \dd{u}=\frac{\dd{f}}{440} \). Hence

      \[\begin{aligned}\dd{P}&=\frac1{\ln2}\frac{\dd{u}}u\\&=\frac1{\ln2}\frac{\frac{\dd{f}}{440}}{\frac f{440}}\\&=\frac1{\ln2}\frac{\dd{f}}f.\end{aligned}\]

    2. The frequency ${verb} by \( ${r}\% \). Using your differential, the estimated pitch change is octaves. The exact change is octaves. Give both to three decimal places and interpret their signs.

      Solution

      The signed relative frequency change is \( \displaystyle \frac{\Delta f}f=${relative} \), so

      \[\begin{aligned}\Delta P&\approx\frac1{\ln2}(${relative})\\&\approx${fixed(estimate,3)}.\end{aligned}\]

      The new frequency is \( ${1+relative}f \). Using the logarithm quotient property, the exact change is

      \[\begin{aligned}\Delta P&=\log_2\left(\frac{${1+relative}f}{f}\right)\\&=\log_2(${1+relative})\\&\approx${fixed(exact,3)}.\end{aligned}\]

      Both changes are ${"positive" if s > 0 else "negative"}: the tone becomes ${"higher" if s > 0 else "lower"} in pitch. They are close because the relative frequency change is small.

    3. Would the same percentage frequency change give a different pitch change for a tone with a different starting frequency? Explain.

      Solution

      It gives the same pitch change in octaves. The estimate depends on \( \displaystyle \frac{\Delta f}f \), and the exact change depends on the frequency factor \( ${1+relative} \). Neither calculation depends on the starting frequency.

  3. For a dilute solution, model its pH by \( P(C)=-\log_{10}C \), where \( C \) is the numerical value of the hydrogen ion concentration in moles per liter. Initially, \( C=10^{-${p}} \).

    1. The initial pH is . Find \( \dd{P} \) in terms of \( C \) and \( \dd{C} \).

      Solution

      The initial pH is \( \displaystyle -\log_{10}(10^{-${p}})=${p} \). The differential is \( \displaystyle \dd{P}=-\frac1{\ln10}\frac{\dd{C}}C \).

    2. The concentration ${verb} by \( ${r}\% \). The differential estimates a pH change of . The exact pH change is . Give both to four decimal places. Explain what the sign tells you.

      Solution

      Using \( \displaystyle \frac{\Delta C}{C}=${relative} \), we obtain

      \[\begin{aligned}\Delta P&\approx-\frac{${relative}}{\ln10}\\&\approx${fixed(estimate,4)}.\end{aligned}\]

      The exact change comes from the concentration factor:

      \[\begin{aligned}\Delta P&=-\log_{10}(${1+relative})\\&\approx${fixed(exact,4)}.\end{aligned}\]

      The change is ${"negative" if s > 0 else "positive"}. As the hydrogen ion concentration ${verb}, the pH ${"decreases" if s > 0 else "increases"}.

    3. What happens to the pH whenever the concentration is multiplied by ten?

      Solution

      It decreases by one, because \( \displaystyle -\log_{10}(10C)=-1-\log_{10}C \). The multiplying factor determines this change, whatever the initial concentration.

  4. A radioactive sample initially contains \( 100 \) milligrams of an isotope with a half-life of \( 7 \) days: after each interval of \( 7 \) days, half the isotope present at the start of that interval remains. Its remaining mass after \( t \) days is modeled by

    \[M(t)=100\left(\frac12\right)^{t/7},\qquad t\geq0.\]

    1. Explain how this formula gives the initial mass and halves the remaining mass every \( 7 \) days.

      Solution

      At \( t=0 \), the exponential factor is \( 1 \), so the mass is \( 100 \) milligrams. Increasing \( t \) by \( 7 \) increases the exponent by \( 1 \), multiplying the remaining mass by \( \frac12 \).

    2. We can write the model in the form \( M(t)=M_0\ee^{kt} \), where \( M_0=100 \) is the initial mass. Using \( \frac12=\ee^{\ln(1/2)} \), the constant is \( k= \) .

      Solution

      Replacing the base and using the power-of-a-power property gives

      \[\begin{aligned}M(t)&=100\left(\ee^{\ln(1/2)}\right)^{t/7}\\&=100\ee^{\frac{\ln(1/2)}7t}\\&=100\ee^{-\frac{\ln2}{7}t}.\end{aligned}\]

      Since \( \ln(1/2)=-\ln2 \), this is the same decay model in the form \( M(t)=M_0\ee^{kt} \), with \( \displaystyle k=-\frac{\ln2}{7} \).

    3. At \( t=7 \) days, the instantaneous rate of change of the remaining mass is milligrams per day, to three decimal places. Interpret this value in the context of the sample.

      Solution

      The Chain Rule multiplies the exponential by the constant \( \displaystyle -\frac{\ln2}{7} \):

      \[\begin{aligned}\dd{M}&=-\frac{\ln2}{7}\,100\ee^{-\frac{\ln2}{7}t}\,\dd{t}\\&=-\frac{\ln2}{7}M\,\dd{t}.\end{aligned}\]

      Dividing by \( \dd{t} \) gives \( \displaystyle \frac{\dd{M}}{\dd{t}}=-\frac{\ln2}{7}M \). At \( t=7 \), one half-life has elapsed, so \( M(7)=50 \) milligrams. Therefore,

      \[\begin{aligned}\eval{\frac{\dd{M}}{\dd{t}}}_{t=7}&=-\frac{\ln2}{7}(50)\\&\approx-4.951.\end{aligned}\]

      At day 7, the remaining mass is decreasing at approximately \( 4.951 \) milligrams per day. This is the rate at that moment; as less isotope remains, the rate of loss becomes smaller.

  5. An exhaustive scheduling algorithm assigns \( ${c}n \) tasks to \( n \) computers. Each task can go to any computer, and each computer can receive several tasks.

    1. Explain why there are \( n^{${c}n} \) possible assignments.

      Solution

      Each of the \( \displaystyle ${c}n \) tasks has \( \displaystyle n \) choices. Multiplying those independent choices gives \( \displaystyle n^{${c}n} \) assignments. Checking every assignment means examining that many possibilities.

    2. Use the continuous extension \( N(x)=x^{${c}x} \) to find \( \displaystyle \frac{\dd{N}}{\dd{x}}= \) . What does \( \displaystyle \frac1N\frac{\dd{N}}{\dd{x}} \) tell us about its growth?

      Solution

      Taking the logarithm brings the changing exponent down into a product:

      \[\begin{aligned}\ln N&=${c}x\ln x,\\\frac{\dd{N}}N&=${c}(\ln x+1)\dd{x},\\\dd{N}&=${c}x^{${c}x}(\ln x+1)\dd{x},\\\frac{\dd{N}}{\dd{x}}&=${c}x^{${c}x}(\ln x+1).\end{aligned}\]

      The ratio \( \displaystyle \frac1N\frac{\dd{N}}{\dd{x}}=${c}(\ln x+1) \) is the relative rate of change per unit increase in \( \displaystyle x \). For \( \displaystyle x\ge1 \), it grows as the number of computers grows. Actual computer counts are whole numbers; this extension lets us study the shape of the workload between those counts.

  6. Let \( \displaystyle y=\frac{x^{${r}}\ee^x}{x+${c}} \). Use logarithmic differentiation to find \( \frac{\dd{y}}{\dd{x}}= \) .

    Solution

    Taking logs separates the product and quotient:

    \[\begin{aligned}\ln y&=${r}\ln x+x-\ln(x+${c}),\\\frac{\dd{y}}y&=\left(\frac{${r}}x+1-\frac1{x+${c}}\right)\dd{x},\\\dd{y}&=\frac{x^{${r}}\ee^x}{x+${c}}\left(\frac{${r}}x+1-\frac1{x+${c}}\right)\dd{x},\\\frac{\dd{y}}{\dd{x}}&=\frac{x^{${r}}\ee^x}{x+${c}}\left(\frac{${r}}x+1-\frac1{x+${c}}\right).\end{aligned}\]

    Multiplying by the original function gives its differential. We then divide by \( \displaystyle \dd{x} \) to obtain the requested derivative.

  7. Let \( y=f(x)=x^3+x \). The function \( f \) increases through all real output values, so its inverse is defined for every real input. The same pair of values can be written as \( y=f(x) \) or \( x=f^{-1}(y) \).

    1. Since \( f(1)=2 \), \( f^{-1}(2)= \) .

      Solution

      The inverse reverses the input and output: \( f \) takes \( 1 \) to \( 2 \), so \( f^{-1} \) takes \( 2 \) back to \( 1 \).

    2. At \( x=1 \), the original slope is \( \displaystyle \eval{\frac{\dd{y}}{\dd{x}}}_{x=1}= \) . Use this to find the inverse slope at the matching value \( y=2 \): \( \displaystyle \eval{\frac{\dd{x}}{\dd{y}}}_{y=2}= \) .

      Solution

      Differentiating the original function gives \( \displaystyle \dd{y}=(3x^2+1)\dd{x} \). At the pair \( (x,y)=(1,2) \), the original slope is \( \displaystyle \frac{\dd{y}}{\dd{x}}=3(1)^2+1=4 \), so \( \dd{y}=4\dd{x} \). Reversing this ratio gives

      \[\eval{\frac{\dd{x}}{\dd{y}}}_{y=2}=\frac1{4}.\]

      This is the slope of the inverse at input \( y=2 \). It is the reciprocal of the original slope at \( x=1 \).

    3. More generally, suppose \( f \) has a derivative and is strictly increasing or strictly decreasing on the interval used. Starting with \( \dd{y}=f'(x)\dd{x} \), express \( \displaystyle \frac{\dd{x}}{\dd{y}} \) in terms of \( y \) and \( f^{-1}(y) \). What condition is needed on the original slope?

      Solution

      Where \( f'(x)\ne0 \), rearranging the differential relationship gives

      \[\frac{\dd{x}}{\dd{y}}=\frac1{f'(x)}.\]

      Since \( x=f^{-1}(y) \), we can express this using the inverse’s input \( y \):

      \[\frac{\dd{x}}{\dd{y}}=\frac1{f'\left(f^{-1}(y)\right)}.\]

      The denominator is the original slope at the matching value of \( x \). That slope must be nonzero for its reciprocal to give a finite inverse slope.

  8. Use logarithmic differentiation to show that the Power Rule \( \displaystyle \frac{\dd{y}}{\dd{x}}=rx^{r-1} \) holds for \( y=x^r \), for every real constant \( r \) and \( x>0 \).

    Hint

    Start with \( \ln y=r\ln x \). Find \( \displaystyle \frac{\dd{y}}y \), then multiply by \( y \).

    Solution

    Since \( \displaystyle x>0 \), the output \( \displaystyle y=x^r \) is positive as well. The logarithm power property gives

    \[\begin{aligned}\ln y&=r\ln x,\\\frac{\dd{y}}y&=r\frac{\dd{x}}x.\end{aligned}\]

    Multiplying by \( \displaystyle y=x^r \) recovers the differential:

    \[\begin{aligned}\dd{y}&=rx^r\frac{\dd{x}}x\\&=rx^{r-1}\dd{x}.\end{aligned}\]

    Dividing by \( \displaystyle \dd{x} \) gives \( \displaystyle \frac{\dd{y}}{\dd{x}}=rx^{r-1} \). This argument applies to any real exponent, including irrational exponents.