23  Derivatives of assembled functions (optional)

Chapter 19 used the rules associated with evanescent \(h\), that is, \(\lim_{h\rightarrow 0}\), to confirm our claims about the derivatives of many of the pattern-book functions. We will call these rules h-theory for short. This chapter will use h-theory to find algebraic rules to calculate the derivatives of linear combinations of functions, products of functions, and composition of functions. Remarkably, we can figure out these rules without specifying which functions are being combined. So the rules can be written in terms of abstractions: \(f()\), \(g()\), and \(h()\). Later, we will apply those rules to specific functions, to show how the rules are used in practical work.

So much math notation!

As you scroll through this chapter, you will likely be struck by the large amount of mathematical notation. Many people are put off by so much notation. I want to remind you not to worry.

The topic in this chapter is traditional for Calculus courses. That doesn’t mean that it is important for using Calculus. It was essential back in the days before computers learned to do algebra; people had to perform the operations then. And it may give some readers a deeper appreciation of the relationship between functions and their derivatives.

23.1 Using the rules

When you encounter a function that you want to differentiate, you first have to examine the function to decide which rule you want to apply. In the following, we will to use the names \(f()\) and \(g()\), but in practice the functions will often be basic modeling functions, for instance \(e^{kx}\) or \(\sin\left(\frac{2\pi}{P}t\right)\), etc.

Step 1: Identify f() and g()

We will write the rules in terms of two function names, \(f()\) and \(g()\), which can stand for any functions whatsoever. It is rare to see the product or the composition written explicitly as \(f(x)g(x)\) of \(f(g(x))\). Instead, you are given something like \(e^x \ln(x)\). The first step in differentiating the product or composition is to identify what are \(f()\) and \(g()\) individually.

In general, \(f()\) and \(g()\) might be complicated functions, themselves involving linear combinations, products, and composition. But to get started, we will practice with cases where they are simple, pattern-book functions.

Step 2: Find f’() and g’()

For differentiating either products or compositions, you will need to identify both \(f()\) and \(g()\) (the first step) and then compute the derivatives \(\partial_x f()\) and \(\partial_x g()\). That is, you will write down four functions.

Step 3: Apply the relevant rule

Recall from Chapter 9 that will will be working with three important forms for creating new functions out of existing functions:

  1. Linear combinations, e.g. \(a f(x) + bg(x)\)
  2. Products of functions, e.g. \(f(x) g(x)\)
  3. Compositions of functions, e.g. \(f\left(g(x)\right)\)

23.2 Differentiating linear combinations

Linear combination is one of the ways in which we make new functions from existing functions. As you recall, linear combination involves scaling functions and then adding the scaled functions as in \(a f(x) + b g(x)\): a linear combination of \(f(x)\) and \(g(x)\). We can easily use \(h\)-theory to show what is the result of differentiating a linear combination of functions. First, let’s figure out what is \(\partial_x\, a f(x)\), Going back to writing \(\partial_x\) in terms of a slope function: \[\partial_x\, a\,f(x) = \frac{a\, f(x + h) - a\,f(x)}{h}\\ \ \\ = a \frac{f(x+h) - f(x)}{h} = a\, \partial_x f(x)\] In other words, if we know the derivative \(\partial_x\, f(x)\), we can easily find the derivative of \(a\, f()\). Notice that even though \(h\) was used in the derivation, it appears nowhere in the result \(\partial_x\, b\,f(x) = b\, \partial_x\, f(x)\). The \(h\) is solvent to get the paint on the wall and evaporates once its job is done.

Now consider the derivative of the sum of two functions, \(f(x)\) and \(g(x)\): \[\begin{eqnarray} \partial_x\, \left(f(x) + g(x)\right) & =\frac{\left(f(x + h) + g(x + h)\right) - \left(f(x) + g(x)\right)}{h} \\ \ \\ &= \frac{\left(f(x+h) -f(x)\right) + \left(g(x+h) - g(x)\right)}{h}\\ \ \\ &= \frac{\left(f(x+h) -f(x)\right)}{h} + \frac{\left(g(x+h) - g(x)\right)}{h}\\ \ \\ &= \partial_x\, f(x) + \partial_x\, g(x) \end{eqnarray}\]

Because of how \(\partial_x\) can be “passed through” a linear combination, mathematicians say that differentiation is a linear operator. Consider this new fact about differentiation as a down payment on what will eventually become a complete theory telling us how to differentiate a product of two functions or the composition of two functions. We will lay out the \(h\)-theory based algebra of this in the next two sections.

We can summarize the h-theory result for linear combinations this way:

The derivative of a linear combination is the linear combination of the derivatives.

That is:

\[\partial_x \left({\large\strut} \color{orange}{a} \color{black}{f(x)} + \color{orange}{b} \color{black}{g(x)}\right) = \color{orange}{a} {\color{brown}{f'(x)}} + \color{orange}{b} \color{brown}{g'(x)}\] as well as

\[\partial_x \left({\large\strut} \color{orange}{a}\, \color{black}{f(x)} + \color{orange}{b}\, \color{black}{g(x)} + \color{orange}{c}\, \color{black}{h(x)} + \cdots\right) = \color{orange}{a}\, {\color{brown}{f'(x)}} + \color{orange}{b}\, {\color{brown}{g'(x)}} + \color{orange}{c}\, {\color{brown}{h'(x)}} + \cdots\]

Tip 23.1: Derivatives of polynomials are polynomials

The derivative of a polynomial is a polynomial of a lower order. We can demonstrate this:

Consider the polynomial \[h(x) = \color{orange}{a}\color{brown}{x^0} + \color{orange}{b} \color{brown}{x^1} + \color{orange}{c} \color{brown}{x^2}\] The derivative is \[\partial_x h(x) = \color{orange}{a}\,\color{brown}{0}\, + \color{orange}{b}\,\color{brown}{1} + \color{orange}{c}\, \color{brown}{2 x} = \color{orange}{b} + \color{brown}{2}\,\color{orange}{c}\,\color{brown}{x}\ .\]

23.3 Product rule for multiplied functions

The question at hand is how to compute the derivative \(\partial_x f(x) g(x)\). Of course, you can always use numerical differentiation. But let’s look at the problem from the point of view of symbolic differentiation. And since \(f(x)\) and \(g(x)\) are just pronoun functions, we will assume you are starting out already knowing the derivatives \(\partial_x f(x)\) and \(\partial_x g(x)\).

This situation arises particularly when \(f(x)\) and \(g(x)\) are pattern-book functions for which you already have memorized \(\partial_x f(x)\) and \(\partial_x g(x)\) or are basic modeling functions whose derivatives you will memorize in Section @ref(basic-derivs).

The purpose of this section is to derive the formula for \(\partial_x f(x) g(x)\) in terms of \(f(x)\), \(g(x)\), \(\partial_x f(x)\) and \(\partial_x g(x)\). This formula is called the product rule. The point of showing a derivation of the product rule is to let you see how the logic of evanescent \(h\) plays a role. In practice, everyone simply memorizes the rule, which has a beautiful, symmetric form:

\[\text{Product rule:}\ \ \ \ \partial_x \left(\strut f(x)g(x)\right) = \left(\strut \partial_x f(x)\right)\, g(x) + f(x)\, \left(\strut\partial_x g(x)\right)\] and is even prettier in Lagrange notation (where \(\partial_x f(x)\) is written \(f'\)): \[ \left(\strut f g\right)' = f' g + g' f\]

As with all derivatives, the product rule is based on slope function (Section 18.3). Symbolic derivatives also invoke evanescent \(h\) (Chapter 19). \[F'(x) \equiv \lim_{h\rightarrow 0} \frac{F(x+h) - F(x)}{h}\]

We also need two other statements about \(h\) and functions:

  1. The derivative \(F'(x)\) is the slope of of \(F()\) at input \(x\). Taking a step of size \(h\) from \(x\) will induce a change of output of \(h F'(x)\), so \[F(x+h) = F(x) + h F'(x)\ .\]

  2. Any result of the form \(h F(x)\), where \(F(x)\) is finite, gives 0. More precisely, \(\lim_{h\rightarrow 0} h F(x) = 0\).

As before, we will put the standard \(\lim_{h\rightarrow 0}\) disclaimer against dividing by \(h\) until there are no such divisions at all, at which point we can safely use the equality \(h = 0\).

Suppose the function \(F(x) \equiv f(x) g(x)\), a product of the two functions \(f(x)\) and \(g(x)\).

\[F'(x) = \partial_x \left(\strut f(x) g(x) \right) \equiv \lim_{h\rightarrow 0}\frac{f(x+h) g(x+h) - f(x) g(x)}{h}\] We will replace \(g(x + h)\) with its equivalent \(g(x) + h g'(x)\) giving

\[= \lim_{h\rightarrow 0} \frac{f(x+h) \left(\strut g(x) + h g'(x) \right) - f(x) g(x)}{h} \] \(g(x)\) appears in both terms in the numerator, once multiplied by \(f(x+h)\) and once by \(f(x)\). Collecting those terms give:

\[=\lim_{h\rightarrow 0}\frac{\left(\strut f(x+ h) - f(x)\right) g(x) + \left(\strut f(x+h) h\, g'(x)\right)}{h}\] This has two bracketed terms added together over a common denominator. Let’s split them into separate terms:

\[=\lim_{h\rightarrow 0}\underbrace{\left(\strut \frac{f(x+h) - f(x)}{h}\right)}_{f'(x)} g(x) + \lim_{h\rightarrow 0}\frac{\left(\strut f(x) + h f'(x)\right)h\,g'(x)}{h}\]

Notice that the second term has an \(h\) both in the numerator and the denominator. \(h\)-theory tells us that \(\lim_{h\rightarrow 0} h/h = 1\).

The first term is \(g(x)\) multiplied by the familiar form for the derivative of \(f(x)\) \[= f'(x) g(x) + \lim_{h\rightarrow 0}\frac{f(x) h g'(x)}{h} + \lim_{h\rightarrow 0}\frac{h f'(x) h g'(x)}{h}\] In each of the last two terms there is an \(h/h\) involved. This is safely set to 1, since the \(\lim_{h\rightarrow 0}\) implies that \(h\) will not be exactly zero. There remain no divisions by \(h\) so we can drop the \(\lim_{h\rightarrow 0}\) in favor of \(h=0\): \[= f'(x) g(x) + f(x) g'(x) + \cancel{h f'(x) g'(x)}\]

\[=f'(x) g(x) + g'(x) f(x)\]

The last step relies on statement (2) above.

Some people find it easier to read the rule in Lagrange shorthand, where \(f\) and \(g\) stand for \(f(x)\) and \(g(x)\) respectivly, and \(f'\) (“f-prime”) and \(g'\) (“g-prime”) stand for \(\partial f()\) and \(\partial g()\).

\[\text{Lagrange shorthand:}\ \ \partial(\color{magenta}f \times \color{brown}g) = (\color{magenta}f \times \color{brown}g)' = \color{magenta}{f'}\color{brown}g + \color{brown}{g'}\color{magenta}f\]

Tip 23.2 How about multiplying three functions?

Occasionally, mathematics gives us a situation where being more general produces simplicity.

In the case of function products, the generalization is from products of two functions \(f(x)\cdot g(x)\) to products of more than two functions, e.g. \(u(x) \cdot v(x) \cdot w(x)\).

The chain rule here takes a form that makes the overall structure much clearer:

\[\begin{eqnarray} \partial_x \left(\strut u(x) \cdot v(x) \cdot w(x)\right) = \ \ \ \ \ \ \ \ \ \ \ \ \\ \color{blue}{\partial_x u(x)} \cdot v(x) \cdot w(x)\ + \\ u(x) \cdot \color{blue}{\partial_x v(x)} \cdot w(x)\ + \\ u(x) \cdot v(x) \cdot \color{blue}{\partial_x w(x)}\ \ \ \ \end{eqnarray}\]\end{eqnarray}

In the Lagrange shorthand, the pattern is even more evident: \[\left( u\cdot v\cdot w\right)' = \color{blue}{u'}\cdot v\cdot w\ +\ u\cdot \color{blue}{v'}\cdot w\ +\ u\cdot v\cdot \color{blue}{w}'\]

As an example, consider the derivative of \(x^3\) with respect to \(x\). Obviously, \(x^3 \equiv x \cdot x \cdot x\), a product of three simple functions:

\[\begin{array}{ccc}\partial_x x^3 = \partial_x [x \cdot x \cdot x]\ \ \ & = \\ & [\partial_x x] &x&x& +\\ & x & [\partial_x x] & x& +\\ &x & x &[\partial_x x] \end{array}\]

Since \(\partial_x x = 1\) this collapses to \(\partial_x x^3 = 3 x^2\).

23.4 Chain rule for function composition

A function composition, as described in Section 9.2, involves inserting the output of one function (the “interior function”) as the input of the other function (the “exterior function”). As we so often do, we will be using pronouns a lot. A list might help keep things straight:

  • There are two functions involved in a composition. Generically, we call them \(f(y)\) and \(g(x)\). In the composition \(f(g(x))\), the exterior function is \(f()\) and the interior function is \(g()\).
  • Each of the two functions \(f()\) and \(g()\) has an input. In our examples, we use \(y\) to stand for the input to the exterior function and \(x\) for the input to the interior function.
  • As with all rules for differentiation, we will need to compute the derivatives of the functions involved, each with respect to its own input. So these will be \(\partial_y f(y)\) and \(\partial_x g(x)\).

A reason to use different pronouns for the inputs to \(f()\) and \(g()\) is to remind us that the output \(g(x)\) is in general not the same kind of quantity as the input \(x\). In a function composition, the \(f()\) function will take the output \(g(x)\) as input. But since \(g(x)\) is not necessarily the same kind of thing as \(x\), why would we want to use the same name for the input to \(f()\) as we use for the input to \(g()\).

With this distinction between the names of the inputs, we can be even more explicit about the composition, writing \(f(y=g(x))\) instead of \(f(g(x))\). Had we used the pronound \(x\) for the input to \(f()\) but our explicit statement, although technically correct, would be confusing: \(f(x = g(x))\)!

With all these pronouns in mind, here is the chain rule for the derivative \(\partial_x f(g(x))\):

\[\partial_x \left({\large\strut} f\left(\strut{\color{magenta}{g(x)}}\right)\right) =\color{brown}{\partial_y f({\color{magenta}{g(x)}})} \times \color{brown}{\partial_x g(x)}\]

Or, using the Lagrange prime notation, where \('\) stands for the derivative of a function with respect to its input, we have \[\text{Lagrange shorthand:}\ \ \left(\color{black}f({\color{magenta}g)}\right)' = \color{brown}{f'} (\color{magenta}{g}) \times \color{blue}{g}'\]

Tip 23.3: Calculating \(\partial_x \ln(x)\)

The chain rule can be used in a clever way to find a formula for \(\partial_x \ln(x)\).

We’ve already seen that the logarithm is the inverse function to the exponential, and vice versa. That is: \[e^{\ln(y)} = y \ \ \ \text{and}\ \ \ \ln(e^y) = x\] Since \(\ln(e^y)\) is the same function as \(y\), the derivative \(\partial_y \ln(e^y) = \partial_y y = 1\).

Let’s differentiate the second form using the chain rule: \[\partial_y \ln(e^y) = \left(\partial_y \ln\right)(e^y)\, e^x = 1\] giving \[\left(\partial_y \ln\right](e^y) = \frac{1}{e^y} = \recip(e^y)\] Whatever the function \(\partial_x \ln()\) might be, it takes its input and produces as output the reciprocal of that input. In other words: \[\partial_x \ln(x) = \frac{1}{x}\ .\]

Application area 23.1 Logarithms and Rates per time

In news and policy discussions, you will often hear about “inflation rate” or “birth rate” or “interest rate” or “investment rate of return.” In each case, there is a function of time combined with a derivative of that function: with the general form \[\frac{\partial_t g(t)}{g(t)}\ .\] In other words, the “rate” is the size of the change with time (\(\partial_t f(t)\)) divided by the size of the whole (\(f(t)\) at that time.

  • Inflation rate: The function \(f(t)\) is cost_of_living(\(t\)).
  • Population growth rate: The function is population(\(t\)).
  • Interest rate: The function is account_balance(\(t\)).
  • Investment returns: The function is net_worth(\(t\)).

In all these cases, The “rate” is not merely “per time” as would be the case for \(\partial_t g(t)\). Instead the rate is “per unit of the whole per time.” For population growth rate, the “whole” is the population. Such rates involving people are often stated with the phrase is “per capita per year.” (The Latin “per capita” translates to “by head.” Its modern sense is “per unit of population.” Of course, the “unit of population” is a person.)

Notice the two uses of “per” in the phrase: “births per capita per year.” A proportional rate is two rates in one. Births per capita is a proportion of the population. Births per year is an average rate with respect to time. But “births per capita per year” is a rate in the proportion with respect to time.

The rate word “per” also appears as part of “percent,” which literally means “per hundred.” A “percentage change” is the amount of change divided by the base amount. Confusingly, perhaps, “percentage change” is often truncated to the shorter “percent.” This is the case with inflation rates, interest rates, and rates of return on investment. The interest rate on a credit-card debt is stated as a proportion of the current debt; all that is packed into the word “percent.” The interest rate itself is the “proportion of the current debt per year”: two rates in one.

Similarly for an inflation rate. “Inflation” is stated as the change in prices divided by the current price: a proportional change. “Inflation rate” is the proportional change per unit of time, where the “whole” is current prices and the rate is change in current prices per year divided by current prices.

Thanks to the chain rule, there is a shortcut way of writing proportional rates per time. Exactly equivalent to the ratio \(\frac{\partial_t f(t)}{f(t)}\) is \[\partial_t \ln(f(t))\ .\]

Derivatives of logarithms appear often in fields such as economics or finance, where it is common to consider the logarithm of the economic quantity to render changes as percent of the whole.

For instance, consider Figure 23.1 which shows the cumulative number of COVID during a period in 2020, early in the pandemic.

Figure 23.1: Growth in the number of Coronavirus cases in Italy and the US early in the pandemic. Source Note that linear axes are used in the left graph and semi-log axes in the right graph.

The two panels in Figure 23.1 show the same data about growing numbers of coronavirus cases, the left graph on linear axes, the right on the now-familiar semi-log axes.

Most people are excellent at comparing slopes, even if they find it difficult or tedious to quantify a slope with a number and units. For instance, a glance suffices to show that in the left graph, well through mid-March the red curve (Italy) is steeper on any given date than the blue curve (US). Correspondingly, the number of people with coronavirus was growing faster (per day) in Italy.

The right graph tells a different story: up until about March 1, the Italian cases were increasing faster than the US cases. Afterwards, the US sees a larger growth rate than Italy until, around March 19, the US growth rate is substantially larger than the Italy growth rate.

The previous two paragraphs and their corresponding graphs seem to contradict one another. But they are both accurate, truthful depictions of the same events. What’s different between the two graphs is that the left shows one kind of rate and the right shows another kind of rate. In the left, the slope is new-cases-per-day, the output of the derivative function

left graph: \(\ \ \ \ \partial\_t\, \text{daily\_new\_cases}(t)\).

On the right, the slope is the proportional increase in cases per day, that is,

right graph: \(\ \ \ \ \frac{\partial_t\, \text{daily\_new\_cases}(t)}{\text{daily\_new\_cases}(t)}\).

From the chain rule, we know that

\[\partial_t \left(\strut\ln\left(\strut(f(t)\right)\right) = \frac{\partial_t f(t)}{f(t)}\ .\]

Since the right graph is on semi-log axes, the slope we perceive visually is \(\partial_t \left(\strut\ln(f(t))\right)\). That is an obscure-looking bunch of notation until the chain rule reveals it to be the rate of change in the number of covid cases at time \(t\) divided by the number of cases at time \(t\).

Tip 23.4: Proof for the chain rule (optional)

The derivation of the chain rule relies on two closely related statements which are expressions of the idea that near any value \(x\) a function can be expressed as a linear approximation with the slope equal to the derivative of the function :

  1. \(g(x + h) = g(x) + h g'(x)\)
  2. \(f(y + \epsilon) = f(y) + \epsilon f'(y)\), which is the same thing as (1) but uses \(y\) as the argument name and \(\epsilon\) to stand for the small quantity we usually write with an \(h\).

We will now look at \(\partial_x f\left({\large\strut} g(x)\right)\) by writing down the fundamental definition of the derivative. This, of course, involves the disclaimer \(\lim_{h\rightarrow 0}\) until we are sure that there is no division by \(h\) involved.

\[\partial_x \left({\large\strut} f\left(\strut\strut g(x)\right)\right) \equiv \lim_{h\rightarrow 0}\frac{\color{magenta}{f(g(x+h))} - f(g(x))}{h}\]

Let’s examine closely the expression \(\color{magenta}{f\left(\strut g(x+h)\right)}\). Applying rule (1) above turns it into \[\lim_{h\rightarrow 0} f\left(\strut g(x) + \color{blue}{h g'(x)}\right)\] Now apply rule (2) but substituting in \(g(x)\) for \(y\) and \(\color{blue}{h g'(x)}\) for \(\epsilon\), giving
\[\lim_{h\rightarrow 0} \color{magenta}{f\left(\strut g(x+h)\right)} = \lim_{h\rightarrow 0} \color{brown}{\left({\large\strut} f\left(g(x)\right) + \color{blue}{h g'(x)}f'\left(g(x)\right)\right)}\] We will substitute the \(\color{blue}{blue}\) and \(\color{brown}{brown}\) expression for the \(\color{magenta}{magenta}\) expression in \[\partial_x f\left(\strut g(x)\right) \equiv \lim_{h\rightarrow 0}\frac{\color{magenta}{f(g(x+h))} - f(g(x))}{h}\] giving \[\partial_x f\left(\strut g(x)\right) \equiv \lim_{h\rightarrow 0}\frac{\color{brown}{f\left(g(x)\right) + \color{blue}{h g'(x)}f'\left(g(x)\right)} - f\left(g(x)\right)}{h}\] In the denominator, \(f\left(g(x)\right)\) appears twice and cancels itself out. That leaves a single term with an \(h\) in the numerator and an \(h\) in the denominator. Those \(h\)’s cancel out, at the same time obviating the need for \(\lim_{h\rightarrow 0}\) and leaving us with the chain rule: \[\partial_x f\left(\strut g(x)\right) \equiv \lim_{h\rightarrow 0}\frac{\color{brown}{ \color{blue}{h g'(x)} f'\left(g(x)\right)}}{h} = f'\left(g(x)\right)\ g'(x)\]

Tip 23.5: Derivative of the logarithmic and power-law functions

Knowing that \(\partial_x \ln(x) = 1/x\) and the chain rule, we are in a position to demonstrate the power-law rule \(\partial_x x^p = p\, x^{p-1}\). The key is to use the identity \(e^{\ln(x)} = x\).

\[\partial_x x^p = \partial_x \left(e^{\ln(x)}\right)^p\] The rules of exponents allow us to recognize \[\left(e^{\ln(x)}\right)^p = e^{p \ln(x)}\] Thus, \(x^p\) can be seen as a composition of the exponential function onto the logarithm function.

Applying the chain rule to this composition gives \[\partial_x e^{p \ln(x)} = e^{p\ln(x)}\partial_x [p \ln(x)] = e^{p\ln(x)} \frac{p}{x}\ .\] Of course, we already know that \(e^{p \ln(x)} = x^p\), so we have \[\partial_x x^p = x^p \frac{p}{x} = p x^{p-1}\ .\]

23.5 Derivatives of the basic modeling functions

The basic modeling functions are the same as the pattern-book functions, but with bare \(x\) replaced by \(\line(x)\). In other words, each of the basic modeling functions is a composition of the corresponding pattern-book function with \(\line(x)\). Consequently, the derivatives of the basic modeling functions can be found using the chain rule.

Suppose \(f()\) is one of our pattern-book functions. Then \[\partial_x f(\color{magenta}{ax + b}) = \color{blue}{a} \color{brown}{f'(\color{magenta}{ax + b})}\] where \(\color{blue}{a}\) is the derivative with respect to \(x\) of \(\color{magenta}{ax + b}\).

Here are the steps for differentiating a basic modeling function \(\color{brown}{f}(\color{magenta}{a x + b})\) where \(f()\) is one of the pattern-book functions:

  • Step 1: Identify the particular pattern-book function \(\color{brown}{f}()\) and write down its derivative \(\color{brown}{f'}\). For example, if \(f()\) is \(\sin()\), then \(f'()\) is \(\cos()\).
  • Step 2: Find the derivative of the linear interior function. If the function is \(\color{magenta}{ax + b}\), then the derivative is \(\color{blue}{a}\). If the interior function is \(\color{magenta}{\frac{2\pi}{P}(t-t_0)}\), the derivative is \(\color{blue}{\frac{2 \pi}{P}}\).
  • Step 3: Write down the original function \({f(\color{magenta}{a x + b})}\) but replace \(f()\) with \(\large \color{brown}{f'()}\) and pre-multiply by the derivative of the interior function. For instance, \[\partial_x f(\color{magenta}{ax + b}) = {\large \color{magenta}{a}}{\large f'}(\color{magenta}{ax + b})\] Another example: \[\partial_t \color{brown}{\sin}\left(\color{magenta}{\frac{2 \pi}{P}(t-t_0)} \right) = {\color{magenta}{\frac{2 \pi}{P}}}\color{brown}{\cos}\left(\color{magenta}{\frac{2 \pi}{P}(t-t_0) }\right) \]

The rule for the derivative of any basic modeling function \(f(\line(x))\) is \[\partial_x f(\line(x)) = \partial_x \line(x) \times \partial_x f\left(\strut\line(x)\right)\]

To illustrate, we’ll write the exterior function in black, and its derivative in brown. \(\color{magenta}{\line()}\) The interior function is drawn in magenta and its derivative in blue. For example:

\[f(\color{magenta}{g(x)})' = \color{brown}{f'}(\color{blue}{g(x)})\ \color{magenta}{g'(x)}\]

Tip 23.6

By convention, there are different ways of writing \(\color{magenta}{\line()}\) when constructing the different basic modeling functions from the corresponding pattern-book functions. Regretably, this imposes extra cognitive load on the student. The point here is that all of the basic modeling functions are a patter-book function composed with a \(\color{magenta}{\line()}\) function, regardless of the form that \(\color{magenta}{\line()}\) is turned into when obeying convention. In Table 23.1 we have used magenta to help you see the different forms.

Table 23.1: Various conventions for writing \(\color{magenta}{\line()}\) in the basic modeling functions.
Pattern-book function \(\longrightarrow\) Basic modeling function
\(\sin(x)\) \(\sin\left(\strut {\color{magenta}{\frac{2 \pi}{P} \left( x-x_0 \right)}}\right)\)
\(\exp(x)\) \(\color{magenta}{A}\color{black}{\exp\left(\strut{\color{magenta}{k x}}\right)}\)
\(x^2\) \(\color{\black}{\left(\strut {\color{magenta}{mx + b}}\right)^2}\)
\(1/x\) \(\color{black}{1/\left(\strut {\color{magenta}{mx+ b}}\right)}\)
\(\ln(x)\) \(\color{black}{\ln\left(\strut {\color{magenta}{a x + b}}\right)}\)
\(\dnorm(x)\) \(\color{black}{\dnorm(\strut {\color{magenta}{\frac{x - \text{mean}}{\text{sd}}}})}\)
\(\pnorm(x)\) \(\color{black}{\pnorm(\strut {\color{magenta}{\frac{x - \text{mean}}{\text{sd}}}})}\)

The consequences of the various forms of \(\color{magenta}{\line()}\) are a possibly confusing diversity of forms for derivatives of the basic modeling functions. We ill continue with the color convention of writing \(f()\) in black, \(\color{brown}{f'()}\) in brown, and \(\partial_x \color{magenta}{\line()}\) in blue.

  • \(\partial_x e^{\color{magenta}{kx}} = {\color{blue}{k}}\, \color{brown}{e^{\color{magenta}{kx}}}\)
  • \(\partial_x \sin(\color{magenta}{\frac{2\pi}{P} (x-x_0)}) = \color{blue}{\frac{2\pi}{P}} \color{brown}{\cos\left(\strut{\color{magenta}{\frac{2\pi}{P} (x-x_0)}}\right)}\)
  • \(\partial_x (\color{magenta}{mx + b})^2 = \color{brown}{2}\color{blue}{m}\color{brown}{\left(\strut{\color{magenta}{m x + b}}\right)}\).
  • \(\partial_x \text{reciprocal}({\color{magenta}{mx + b}}) = \partial_x \frac{1}{{\color{magenta}{mx + b}}} = \color{brown}{\frac{\color{blue}{m}}{\left(\strut{\color{magenta}{mx+b}}\right)^2}}\)
  • \(\partial_x \ln(a x + b) = \color{brown}{{\frac{\color{magenta}{\color{blue}{a}}}{{\color{magenta}{ax+b}}}}}\)
  • \(\partial_x \pnorm(\color{magenta}{\frac{x-\text{mean}}{\text{sd}}}) =\color{blue}{\frac{1}{\text{sd}}}\color{brown}{\dnorm\left(\strut{\color{magenta}{\frac{x-\text{mean}}{\text{sd}}}}\right)}\).
  • \(\partial_x \dnorm\left(\color{magenta}{\frac{x-\text{mean}}{\text{sd}}}\right)=\color{brown}{-(x - \text{mean})}\color{blue}{\frac{1}{\text{sd}}}\color{brown}{\dnorm\left(\strut{\color{magenta}{\frac{x-\text{mean}}{\text{sd}}}}\right)}\)

You will be using the derivatives of the basic modeling functions so often, that you should practice and practice until you can write the derivative at a glance.