Skip to main content

Chapter 18 Product rule and integrating factors

Section 18.1 Derivatives of products

Let’s begin by revisiting Pattern 6.3.13. If function \(q(t) \) is a vertical scaling of another function \(p(t) \text{,}\) with \(q(t) = k p(t) \text{,}\) then when computing \(dq/dt \) at a particular point \(t = t^\ast \) we have
\begin{align*} \dqdt \amp = \frac{q(t^\ast + dt) - q(t^\ast)}{dt} \\ \amp = \frac{k p(t^\ast + dt) - k p(t^\ast)}{dt} \\ \amp = k \frac{p(t^\ast + dt) - p(t^\ast)}{dt} \\ \amp = k \ddt{p} \text{.} \end{align*}
What if the scale factor \(k \) isn’t actually constant, but itself is varying?
\begin{equation*} q(t) = k(t) p(t) \end{equation*}
Over the very short time interval \(t^\ast \le t \le t^\ast + dt \) (or \(t^\ast + dt \le t \le t^\ast \text{,}\) if \(dt \) is negative), we might assume that \(k(t) \) is approximately constant:
\begin{align*} k(t) \amp \approx k^\ast = k(t^\ast) \amp \amp\text{for all} \amp t^\ast \amp \le t \le t^\ast + dt\text{.} \end{align*}
Then a small variation in \(t \) causes a small variation in \(p(t) \text{,}\) which causes a variation of approximately
\begin{equation*} k^\ast \, \ddt{p} \end{equation*}
in \(q(t) \text{.}\) But \(k(t) \) isn’t actually constant — a small variation in \(k(t) \) also causes a small variation in \(q(t) \text{.}\) So what if we turn this around, and consider
\begin{equation*} q(t) = p(t) k(t) \end{equation*}
as a vertical scaling of \(k(t) \) with varying scale factor \(p(t) \text{?}\) Then just as before, we might now assume that \(p(t) \) is approximately constant:
\begin{align*} p(t) \amp \approx p^\ast = p(t^\ast) \amp \amp\text{for all} \amp t^\ast \amp \le t \le t^\ast + dt\text{.} \end{align*}
And then a small variation in \(t \) causes a small variation in \(k(t) \text{,}\) which causes a variation of approximately
\begin{equation*} p^\ast \, \ddt{k} \end{equation*}
in \(q(t) \text{.}\) To get the total variation in \(q(t) \text{,}\) we should add these variations together:
\begin{equation*} \dqdt = k^\ast \, \ddt{p} + p^\ast \, \ddt{k} \text{.} \end{equation*}
Since this is true at all points \(t = t^\ast \text{,}\) we may as well just write
\begin{equation*} \dqdt = k(t) \, \ddt{p} + p(t) \, \ddt{k} \text{.} \end{equation*}

Justification.

First, we have
\begin{equation*} q(t + dt) = f(t + dt) g(t + dt) \text{.} \end{equation*}
To compute \(dq/dt \text{,}\) we compute the difference of \(q(t + dt) \) and \(q(t) \text{,}\) and divide by \(dt \text{.}\) But in that difference calculation, the result won’t change if we “vertically shift” both terms by the same amount:
\begin{equation*} \bigl[ q(t + dt) - C \bigr] - \bigl[ q(t) - C \bigr] = q(t + dt) - q(t)\text{.} \end{equation*}
Using \(C = f(t + dt) g(t) \text{,}\) we have
\begin{align*} q(t + dt) - C \amp = f(t + dt) g(t + dt) - f(t + dt) g(t)\\ \amp = f(t + dt) \bigl[ g(t + dt) - g(t) \bigr]\\ \\ q(t) - C \amp = f(t) g(t) - f(t + dt) g(t)\\ \amp = \bigl[ f(t) - f(t + dt) \bigr] g(t)\text{.} \end{align*}
By the algebra rules of fractions, we may divide each of these by \(dt \) before subtracting:
\begin{align*} \frac{q(t + dt) - C}{dt} \amp = f(t + dt) \cdot \frac{g(t + dt) - g(t)}{dt} \\ \amp = f(t + dt) \cdot \ddt{g} \\ \\ \frac{q(t) - C}{dt} \amp = \frac{f(t) - f(t + dt)}{dt} \cdot g(t) \\ \amp = - \ddt{f} \cdot g(t) \text{.} \end{align*}
So then we have
\begin{align*} \frac{q(t + dt) - q(t)}{dt} \amp = \frac{q(t + dt) - C}{dt} - \frac{q(t) - C}{dt} \\ \amp = f(t + dt) \cdot \ddt{g} - \left( - \ddt{f} \cdot g(t) \right) \\ \amp = f(t + dt) \cdot \ddt{g} + \ddt{f} \cdot g(t) \end{align*}
Finally, since \(f \) is assumed to be differentiable, it must be continuous, and so
\begin{equation*} dt \approx 0 \qquad\implies\qquad f(t + dt) \approx f(t) \text{.} \end{equation*}
From this, we have
\begin{equation*} \dqdt = f(t) \cdot \ddt{g} + \ddt{f} \cdot g(t) \text{,} \end{equation*}
as required.

Checkpoint 18.1.2. Another verification of the product rule.

Use Logarithmic differentiation instead of the Product Rule to compute
\begin{equation*} \opddt \, \bbrac{ f(t) g(t) } \text{,} \end{equation*}
and simplify until you obtain the same formula as in Pattern 18.1.1.

Example 18.1.3. Applying the Product Rule.

Here are a few examples of applying the Product Rule. In the last example, we combine with the Chain Rule.
  1. \begin{align*} \opddt \bbrac{ t \ln\abs{t} } \amp = t \cdot \opddt \bbrac{\ln\abs{t}} + \ddt{t} \cdot \ln\abs{t}\\ \amp = t \cdot \frac{1}{t} + 1 \cdot \ln\abs{t} \\ \amp = 1 + \ln\abs{t} \end{align*}
  2. \begin{align*} \opddt \bbrac{ e^t \tan(t) } \amp = e^t \cdot \opddt \bbrac{\tan(t)} + \ddt{e^t} \cdot \tan(t)\\ \amp = e^t \sec^2(t) + e^t \cdot \tan(t) \\ \amp = e^t \bbrac{\sec^2(t) + \tan(t)} \end{align*}
  3. For
    \begin{equation*} \opddt \bbrac{ t \sin(t^2) } \text{,} \end{equation*}
    set \(u = t^2 \text{.}\) Then
    \begin{align*} \opddt \bbrac{ t \sin(t^2) } \amp = t \cdot \opddt \bbrac{ \sin(t^2) } + \ddt{t} \cdot \sin(t^2)\\ \amp = t \cdot \ddu{\bbrac{ \sin(u) }} \cdot \dudt + 1 \cdot \sin(t^2)\\ \amp = t \cos(u) \cdot (2 t) + 1 \cdot \sin(t^2) \\ \amp = 2 t^2 \cos(t^2) + \sin(t^2) \text{.} \end{align*}
The first calculation in Example 18.1.3 actually tells us something about the antiderivatives of the logarithm.

Justification.

Turning the first calculation in Example 18.1.3 around, we see
\begin{gather*} 1 + \ln\abs{t} = \opddt \bbrac{ t \ln\abs{t} } \\ \ln\abs{t} = \opddt \bbrac{ t \ln\abs{t} } - 1 \\ \ln\abs{t} = \opddt \bbrac{ t \ln\abs{t} } - \ddt{t} \\ \ln\abs{t} = \opddt \bbrac{ t \ln\abs{t} - t } \text{.} \end{gather*}
Since \(\ln\abs{t} \) is the derivative of \(t \ln\abs{t} - t \text{,}\) then also \(t \ln\abs{t} - t \) is an antiderivative of \(\ln\abs{t} \text{,}\) and every other antiderivative must be a vertical shift of that particular one:
\begin{equation*} \ccmiint{\ln\abs{t}}{t} = t \ln\abs{t} - t + C \text{,} \end{equation*}
as required.
We can also combine the product rule with logarithmic differentiation to tackle derivatives that would have been more difficult to compute before.

Example 18.1.5. An exponential functin with a varying base.

Consider
\begin{align*} q(t) \amp = \bigl[\cos(t)\bigr]^t \amp -\frac{\pi}{2} \amp \lt t \lt \frac{\pi}{2} \text{.} \end{align*}
(We restrict the domain to ensure the base is always positive.)
We can’t apply the Power Rule, because the exponent is varying. We can’t apply our formula for the derivative of an exponential (Pattern 12.6.2) directly, because the base is varying. So instead we’ll take the logarithm of each side so that we can turn that varying exponent into a factor:
\begin{gather*} q = \bigl[\cos(t)\bigr]^t \\ \ln(q) = t \ln\bigl[\cos(t)\bigr] \end{gather*}
(We haven’t bothered with the absolute value brackets this time, since we have already restricted the domain so that \(q \) is always positive.)
Now we differentiate both sides:
\begin{gather*} \opddt \, \bigl[\ln(q)\bigr] = \opddt \Bigl[ t \ln\bbrac{\cos(t)} \Bigr] \\ \frac{1}{q} \cdot \dqdt = t \cdot \opddt \Bigl[ \ln\bbrac{\cos(t)} \Bigr] + \ddt{t} \cdot \ln\bbrac{\cos(t)}\\ \frac{1}{q} \cdot \dqdt = t \cdot \frac{1}{\cos(t)} \cdot \opddt \bbrac{\cos(t)} + 1 \cdot \ln\bbrac{\cos(t)}\\ \frac{1}{q} \cdot \dqdt = \frac{t}{\cos(t)} \cdot \bbrac{- \sin(t)} + \ln\bbrac{\cos(t)}\\ \frac{1}{q} \cdot \dqdt = \ln\bbrac{\cos(t)} - t \tan(t) \text{.} \end{gather*}
Isolating \(dq/dt \) and subsituting back in for \(q \text{,}\) we have
\begin{equation*} \dqdt = \bigl[\cos(t)\bigr]^t \cdot \Bigl[\ln\bbrac{\cos(t)} - t \tan(t)\Bigr] \text{.} \end{equation*}

Remark 18.1.6.

Another approach to Example 18.1.5 would be to express \(q(t) \) as
\begin{equation*} q(t) = \exp\Bbrac{t \ln\bbrac{\cos(t)}} \end{equation*}
and then combining the Chain Rule with the Product Rule. This alternative approach is essentially equivalent to what we have done in Example 18.1.5, but doesn’t involve implicit differentiation.

Checkpoint 18.1.7. A Quotient Rule.

Suppose \(q(t) \) is a rational function
\begin{equation*} q(t) = \frac{f(t)}{g(t)} \text{.} \end{equation*}
Rewriting this as
\begin{equation*} q(t) = f(t) \inv{\bigl[g(t)\bigr]} \text{,} \end{equation*}
combine the Product Rule with one of our two versions of the Chain Rule (Pattern 15.2.1 or Pattern 17.1.7) to produce a “Quotient Rule.” You should be able to simplify your final result into a rational expression involving \(f \text{,}\) \(g \text{,}\) and their derivatives.

Section 18.2 Integrating factors

Example 18.2.1. Mixing problem with variable source.

Let’s revisit our Mixing problem from Chapter 7, where fresh brine was entering a vat, and the volume of the vat was held constant by simultaneously draining liquid from the vat at the same rate that fresh brine was entering.
Diagram of brine entering and being drained from a tank so that volume is held constant.
Figure 18.2.2. Brine entering and being drained from a tank so that volume is held constant.
Now consider a variation of this problem. Perhaps the incoming brine is being produced by a machine that introduces salt into a fresh water supply. When the system is first started up, we might assume that opening the fresh water valve brings the flow rate up to speed nearly instantaneously. But salt moves more slowly, so perhaps the rate at which the salt is supplied causes it to take some time until the concentration of the incoming brine is near the design specifications.
Diagram of brine entering and being drained from a tank so that volume is held constant, where the incoming brine is assumed to be of varying concentration.
Figure 18.2.3. Brine entering and being drained from a tank so that volume is held constant, where the incoming brine is assumed to be of varying concentration.
We might model the incoming concentration \(k(t) \) with a function that begins at \(k(0) = 0 \text{,}\) but then quickly ramps up to approach a horizontal asymptote at the desired concentration of 15 g⁄L. Maybe something like
\begin{equation*} k(t) = 15 (1 - e^{-t}) \text{.} \end{equation*}
Graph of a model function for the ramping up of salt concentration in the incoming brine supply.
Figure 18.2.4. A model function for the ramping up of salt concentration in the incoming brine supply.
To obtain a rate equation for this system, we use the same
\begin{equation*} r(t) = (\text{rate in }) - (\text{rate out}) \end{equation*}
analysis that we used in Example 7.2.5, but now our rate in is varying instead of constant. Remember that our analysis in that example was based on amount of salt in grams, not concentration. So letting \(q(t) \) represent the amount of salt in the tank at time \(t \text{,}\) we have
\begin{align*} \text{rate in} \amp = \bbrac{k(t) \; \mathrm{g}/\mathrm{L}} (2 \; \mathrm{L}/\mathrm{s}) \\ \amp = 2 k(t) \; \mathrm{g}/\mathrm{s} \\ \amp = 30 (1 - e^{-t}) \; \mathrm{g}/\mathrm{s} \\ \\ \text{rate out} \amp = \left(\frac{q(t)}{1000} \; \mathrm{g}/\mathrm{L}\right) (2 \; \mathrm{L}/\mathrm{s}) \\ \amp = \frac{q(t)}{500} \; \mathrm{g}/\mathrm{s} \\ \\ r(t) \amp = 30 (1 - e^{-t}) - \frac{q(t)}{500} \text{.} \end{align*}
Writing \(r(t) = \dqdt \) as usual, let’s rearrange this equation to
\begin{equation*} \dqdt + \frac{q}{500} = 30 (1 - e^{-t}) \text{.} \end{equation*}
Just as when we solved separable rate equations (Section 16.3), we would like to interpret each side as somehow the result of a differentiation. With the addition on the left-hand side, it could be the result of a Product Rule computation. It would look even more like that if the first term was
\begin{equation*} u \cdot \dqdt \end{equation*}
instead of just \(dq/dt \text{,}\) for some function \(u(t) \text{.}\) To introduce this new factor, let’s multiply the whole rate equation by this (currently unknown) function \(u(t) \text{:}\)
\begin{equation*} u \cdot \dqdt + \frac{u}{500} \cdot q = 30 u (1 - e^{-t}) \text{.} \end{equation*}
But the Product Rule pattern is
\begin{equation*} \opddt \, ( u q ) = u \cdot \dqdt + \dudt \cdot q \text{.} \end{equation*}
So for this to work, we would need
\begin{equation*} \dudt = \frac{u}{500} \text{.} \end{equation*}
Luckily, we already know from Pattern 16.3.5 that the function
\begin{equation*} u(t) = e^{t / 500} \end{equation*}
satisfies this new rate equation. (Note that we have chosen \(u_0 = u(0) = 1 \text{,}\) since we only need one appropriate function \(u \) to use, not every possible such function.)
So with \(u \) as above, our rate equation becomes
\begin{gather*} e^{t / 500} \cdot \dqdt + \frac{e^{t / 500}}{500} \cdot q = 30 e^{t / 500} (1 - e^{-t}) \\ \opddt \, ( e^{t / 500} \cdot q ) = 30 e^{t / 500} - 30 e^{- 499 t / 500} \text{.} \end{gather*}
So now we explicitly have the left-hand side as a derivative calculation. Since the two sides are equal, let’s make them appear more the same by also interpreting the right-hand side as the result of a derivative calculation. Since
\begin{align*} \opddt \, \left( 15000 e^{t / 500} + \frac{15000}{499} e^{- 499 t / 500} \right) \amp = \frac{15000}{500} e^{t / 500} + \frac{15000}{499} \cdot \left( \frac{-499}{500} \right) e^{-499 t / 500}\\ \amp = 30 e^{t / 500} - 30 e^{-499 t / 500} \text{,} \end{align*}
we can rewrite our modified rate equation as
\begin{equation*} \opddt \, ( e^{t / 500} \cdot q ) = \opddt \, \left( 15000 e^{t / 500} + \frac{15000}{499} e^{- 499 t / 500} \right)\text{.} \end{equation*}
This now says that the functions
\begin{align*} e^{t / 500} \amp \cdot q \amp \frac{15000}{499} \amp ( 499 e^{t / 500} + e^{- 499 t / 500} ) \end{align*}
have the same derivative. From Fact 14.5.6, we know that this means that they must be vertical shifts of each other:
\begin{equation*} e^{t / 500} \cdot q = \frac{15000}{499} ( 499 e^{t / 500} + e^{- 499 t / 500} ) + C \end{equation*}
\begin{align*} q \amp = \frac{1}{e^{t / 500}} \cdot \frac{15000}{499} ( 499 e^{t / 500} + e^{- 499 t / 500} ) + C\\ \amp = \frac{15000}{499} ( 499 + e^{- t} ) + C e^{- t / 500} \text{,} \end{align*}
where \(C \) is an arbitrary constant.
We can use the same method to solve rate equations of a similar form.

Definition 18.2.5. First-order, linear rate equation.

A rate equation that can be expressed in the form
\begin{equation*} \dqdt + p(t) \cdot q = f(t) \end{equation*}
for some functions \(p \) and \(f \) is called a first-order, linear rate equation. The function \(p(t) \) is called the coefficient function, and the function \(f(t) \) is called the forcing function for the system.
We can use the same method as in Example 18.2.1 to solve such a rate equation. We would like to determine a function \(u(t) \) so that
\begin{equation*} u \cdot \dqdt + u p q \end{equation*}
is the same as the result of a Product Rule computation
\begin{equation*} \opddt \, (u q) = u \cdot \dqdt + \dudt \cdot q \text{.} \end{equation*}
For this to be true, we need \(u \) to satisfy
\begin{equation*} \dudt = u \cdot p(t) \text{,} \end{equation*}
which is a Separable rate equation in \(u \) and \(t \text{.}\)

Remark 18.2.7.

The chosen function \(u(t) \) is called an integrating factor for the rate equation, as introducing it as an extra factor in each term allows us to undo the differentiation on the left-hand side — that is, it allows us to solve the equation by integrating.

Example 18.2.8. Using the procedure.

Suppose we would like to solve
\begin{equation*} r(t) = \frac{1 - 2 t q(t)}{1 + t^2} \text{.} \end{equation*}
It certainly doesn’t like a Separable rate equation, and at first glance it also doesn’t look it’s of the form in Definition 18.2.5. But we can rearrange:
\begin{gather*} \dqdt = \frac{1 - 2 t q}{1 + t^2} \\ \dqdt = \frac{1}{1 + t^2} - \frac{2 t}{1 + t^2} \cdot q \\ \dqdt + \frac{2 t}{1 + t^2} \cdot q = \frac{1}{1 + t^2} \text{.} \end{gather*}
So now we see that it is first-order linear, with
\begin{align*} p(t) \amp = \frac{2 t}{1 + t^2} \amp f(t) \amp = \frac{1}{1 + t^2} \text{.} \end{align*}
So first we need to solve
\begin{gather*} \frac{1}{u} \cdot \dudt = p(t) \\ \ccmiint{\frac{1}{u}}{u} = \ccmiint{\frac{2 t}{1 + t^2}}{t} \\ \ln\abs{u} = \ccmiint{\frac{2 t}{1 + t^2}}{t} \text{.} \end{gather*}
On the left, use the substitution \(v = 1 + t^2 \text{,}\) so that \(dv/dt = 2 t \text{:}\)
\begin{gather*} \ln\abs{u} = \ccmiint{\frac{1}{1 + t^2} (2 t)}{t} \\ \ln\abs{u} = \ccmiint{\frac{1}{1 + t^2} \ddt{v}}{t} \\ \ln\abs{u} = \ccmiint{\frac{1}{v}}{v} \\ \ln\abs{u} = \ln\abs{v} + C \\ \ln\abs{u} = \ln\abs{1 + t^2} + C \text{.} \end{gather*}
Recall that we only need one integrating factor \(u \text{,}\) not all possible ones, so we will take \(C = 0 \text{.}\) Then we can apply the exponential function to both sides to get
\begin{gather*} \abs{u} = \abs{1 + t^2} \\ u = \pm (1 + t^2) \text{.} \end{gather*}
Again, we only need one \(u \) that works, so we discard the negative solution and proceed with \(u = 1 + t^2 \text{:}\)
\begin{gather*} \dqdt + \frac{2 t}{1 + t^2} \cdot q = \frac{1}{1 + t^2} \\ (1 + t^2) \dqdt + 2 t q = 1 \\ \opddt \, \bbrac{ (1 + t^2) q } = 1 \\ \ccmiint{\opddt \, \bbrac{ (1 + t^2) q }}{t} = \ccmiint{1}{t} \\ (1 + t^2) q = t + K \\ q(t) = \frac{t + K}{1 + t^2} \text{,} \end{gather*}
where \(K \) is an arbitrary constant. (We have chosen the letter \(K \) for the constant of integration here to avoid confusion with our previous constant of integration from solving for \(u \text{.}\))

Remark 18.2.9.

You may have noticed that Example 18.2.8 is a bit contrived, since without all the hassle of solving for the integrating factor \(u = 1 + t^2 \text{,}\) we might have chosen to multiply through by that factor just for algebraic reasons, to clear fractions:
\begin{gather*} \dqdt + \frac{2 t}{1 + t^2} \cdot q = \frac{1}{1 + t^2} \\ (1 + t^2) \cdot \dqdt + \cancel{(1 + t^2)} \cdot \frac{2 t}{\cancel{1 + t^2}} \cdot q = \cancel{(1 + t^2)} \cdot \frac{1}{\cancel{1 + t^2}}\\ (1 + t^2) \cdot \dqdt + 2 t q = 1 \text{.} \end{gather*}
At which point it should be fairly obvious that the left-hand side is indeed the result of a product rule
\begin{equation*} \opddt \, \bigl[ (1 + t^2) \cdot q \bigr] = (1 + t^2) \cdot \dqdt + 2 t q \text{.} \end{equation*}