Skip to main content
Logo image

Chapter 4 Models

Section 4.1 Functions modelling quantity and rate

We saw in Section 1.4 that when two quantities are varying in tandem so that the average rate of accumulation of one relative to the other is always constant, then we can express one of the quantities as a linear function of the other. What if the rate of accumulation is also varying? Then we might want a function to model it as well.

Example 4.1.1. A piecewise rate function.

In Example 2.3.1, we modelled the salary of salespeople who were paid a base salary, commission on each sale, and a bonus commission on each sale above some threshold. The model we came up with for the salary \(s(q)\) as a function of the number of units \(q\) sold was
\begin{equation*} s(q) = \begin{cases} 4000 + 10 q \amp 0 \le q \le 100 \\ 4000 + 10 q + 5 (q - 100) \amp q \gt 100 \end{cases}\text{.} \end{equation*}
Simplifying the second formula in the piecewise definition, we can write
\begin{equation*} s(q) = \begin{cases} 4000 + 10 q \amp 0 \le q \le 100 \\ 3500 + 15 q \amp q \gt 100 \end{cases}\text{.} \end{equation*}
That rate of accumulation of salary relative to number of units sold is constant — salary increases by \(10\) dollars per extra unit sold — up until the threshold where the bonus kicks in, at \(q = 100\text{.}\) After that, the rate of accumulation jumps to a new level — salary increases by \(15\) dollars per extra unit sold. To keep track of how the rate varies, we create a function to model the rate:
\begin{equation*} r(q) = \begin{cases} 10 \amp 0 \le q \le 100 \\ 15 \amp q \gt 100 \end{cases}\text{.} \end{equation*}
We know that the constant rate for a linear function is just the slope of the line, so essentially we have just extracted the slopes of the two “pieces” of \(s(q)\) on their respective subdomains.
A rate of accumulation can vary a lot more than just jumping from one value to another.

Example 4.1.2. Varying speed.

You get in your car and pull out, then accelerate up to the city speed limit of 50 kmh. With a stop light ahead, you slow down to a stop, wait for the light to turn green, then get back up to speed. A little later you merge onto the highway and accelerate some more.
In the case of forward motion, speed represents the rate of accumulation of mileage. And in the scenario described above, speed is itself varying.
Graph of a rate-of-travel model.
Figure 4.1.3. Graph of a rate-of-travel model.
In Figure 4.1.3, the plotted curve passes the Vertical Line Test, and so represents the graph of a function — a rate function, \(r(t)\text{.}\)
In Example 4.1.2, the quantity function \(q(t)\) would represent the car’s odometer reading at time \(t\text{,}\) and the associated rate function \(r(t)\) would represent the car’s speedometer reading at time \(t\text{,}\) and both are varying. We could imagine many other scenarios involving a varying quantity and a varying associated rate function.

Example 4.1.4. Measuring water flow.

A drain pipe empties into a covered reservoir. Let \(q(t)\) represents the volume of water (in litres) in the reservoir at time \(t\text{.}\) Then as rain water falls, is collected and routed through the drain pipe and accumulates in the reservoir, the quantity function \(q(t)\) varies. To measure how it varies, a flow meter is installed in the drain pipe to measure the rate of water flow into the reservoir in litres per second. If water only enters the reservoir through the drain pipe, then the rate of accumulation of water in the reservoir is the same as the rate of flow of water in the drain pipe. Therefore, the rate function \(r(t)\) associated to the varying quantity function \(q(t)\) is precisely the reading on the flow meter at time \(t\text{.}\)

Section 4.2 Rate equations

It is usually difficult to immediately write down a function for a varying quantity. Being able to do so is equivalent to predicting both “past” and “future” values of the quantity for any input value. When we model a system, it is usually easier to model the variation itself. But again, not immediately as a rate function (which is effectively just as difficult as trying to determine a quantity function directly). Instead, we try to model how the variation in the quantity is affected by the quantity itself.
For example, consider trying to model a population of some species of animal over time. It would be very difficult to make an exact prediction like “In \(t\) years I think the population size will be \(P\text{.}\)” It is much more reasonable to express patterns like “More animals means more offspring means more animals.” In other words, the rate of accumulation could initially be modelled not directly in terms of time but indirectly in terms of the population size — large population means high rate of accumulation, small population means low rate of accumulation. The next step in analyzing the situation would be to try to make this observation more precise using an equation relating the rate to the quantity size.

Definition 4.2.1. Rate equation.

Let \(q(t)\) represent a quantity function (whose formula is unknown) and let \(r(t)\) represent the rate function that models the rate of accumulation of the quantity (also unknown). A rate equation (or differential equation) is an equation relating \(r(t)\) to \(q(t)\text{.}\)

Note 4.2.2. Equation versus formula.

There is a difference between a formula for a function and an equation. An equation expresses an equality of two different formulas, while a function formula describes the input-output process of the function. For example, the expression \(r(t) = t^2\) is not a rate equation (even though it contains an equals sign), it is a formula defining a rate function.

Example 4.2.3. Radioactive decay.

Physicists observed long ago that radioactive material decays at a rate that is proportional to the amount of material left. That is, if \(q(t)\) models the amount of some sample of radioactive material remaining after a period of time measured by \(t\text{,}\) and \(r(t)\) models the rate of variation of the amount of material, then there is a positive constant \(k\) so that
\begin{gather} \frac{r(t)}{q(t)} = - k \text{.}\tag{✶} \end{gather}
(The negative is because we expect the rate to be negative because the quantity is decreasing, but the quantity itself will always be a positive amount.)
We can re-arrange (✶) to
\begin{equation*} r(t) = - k q(t) \text{,} \end{equation*}
a rate equation relating rate to quantity. Even though this is a linear relationship between \(r\) and \(q\text{,}\) the model for \(q(t)\) in terms of \(t\) is definitely not linear, as we will see in Chapter 15.

Example 4.2.4. Mixing problem.

A 1000 L tank of salt water (brine) is being fed by a supply of fresh brine of concentration 15 gL at a rate of 2 Ls. To maintain a constant volume, old brine is also being drained from the tank at the same rate of 2 Ls. We assume that the tank is well-mixed, so that there are no pockets of higher or lower concentration brine within the tank.
Diagram of brine entering and being drained from a tank so that volume is held constant.
Figure 4.2.5. Brine entering and being drained from a tank so that volume is held constant.
Let \(q(t)\) represent the amount of salt in the tank in grams at \(t\) seconds after the system starts up, and let \(r(t)\) represent the rate of accumulation of salt in the tank in grams per second. This rate function is dependent on how much salt is in the tank, because even through brine both enters and drains from the tank at a constant rate, how much salt exits the tank through the drain depends on how much salt is in the tank at that moment.
Is the amount of salt increasing or decreasing? We seem to have both behaviours at once, since salt is entering through the fresh brine supply and is being lost through the drained liquid. The actual rate of variation of the quantity of salt is the net effect:
\begin{equation*} r(t) = (\text{rate in }) - (\text{rate out}) \text{.} \end{equation*}
Let’s analyze these one at a time. The rate of salt entering is
\begin{align*} \text{rate in} \amp = (15 \; \mathrm{g}/\mathrm{L}) (2 \; \mathrm{L}/\mathrm{s}) \\ \amp = 30 \; \mathrm{g}/\mathrm{s} \text{.} \end{align*}
We can use the same calculation formula of concentration-times-flow-rate to calculate the rate out, where here we want to use the concentration of the mixed solution in the tank. Except we don’t know the concentration because it is varying! However, since the volume in the tank is staying constant at 1000 L, then at any given moment if we knew the value of \(q(t)\) the concentration in the tank would be
\begin{equation*} \frac{q(t)}{1000} \text{.} \end{equation*}
Thus,
\begin{align*} \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} \text{.} \end{align*}
Combining the last two calculations yields rate equation
\begin{equation*} r(t) = 30 - \frac{q(t)}{500} \text{.} \end{equation*}
A rate function can also involve the independent variable \(t\text{.}\)

Example 4.2.6. A completely made-up rate equation.

If \(q(t)\) represents some quantity that is changing over time, and \(r(t)\) models the rate of accumulation of that quantity, then the equation
\begin{equation*} r(t) = \frac{q(t) \bbrac{1 - q(t)}}{t + 1} \end{equation*}
is a rate equation.
However, a rate equation should not only involve the independent variable \(t\text{,}\) since then that would just be a rate formula.
After forming a rate equation to model a system, our goal is to recover a formula for the quantity function so that we can make predictions about the behaviour of the system.

Definition 4.2.7. Solution to a rate equation.

Given a rate equation
\begin{equation*} r(t) = \text{some formula in } t \text{ and } q(t) \text{,} \end{equation*}
a solution is a function \(q(t)\) that, when substituted into the right-hand side of the rate equation, gives the correct rate function \(r(t)\) for that particular \(q(t)\text{.}\)

Example 4.2.8. A simple rate equation with a simple solution.

Suppose we have an unknown quantity \(q(t)\) that satisfies the rate equation
\begin{equation*} r(t) = q(t) - 5 t \text{.} \end{equation*}
Could any linear quantity models satisfy this equation? That is, are there any values of \(m\) and \(q_0\) so that
\begin{equation*} q(t) = m t + q_0 \end{equation*}
is a solution to this rate equation? We know that a linear quantity function has a constant rate function, so we can compare left-hand and right-hand sides in the rate equation to see when they are equal.
\begin{align*} \mathrm{LHS} \amp = r(t) \amp \mathrm{RHS} \amp = q(t) - 5 t \\ \amp = m \amp \amp = (m t + q_0) - 5 t \\ \amp \amp \amp = (m - 5) t + q_0 \text{.} \end{align*}
Now, we don’t want to set these two expressions to be equal and solve for \(t\text{,}\) because we don’t want them to be equal for just one value of \(t\text{,}\) we want them to be equal for all values of \(t\). That is, we need them to be the same function. And since the left-hand side is a constant function, we will only get equality if the right-hand side is also a constant function, which requires
\begin{equation*} m - 5 = 0 \text{,} \end{equation*}
or \(m = 5\text{.}\) In that case, we are left with just \(q_0\) on the right-hand side, so matching left with right we also need \(q_0 = 5\text{.}\) This tells us that the only linear quantity model that solves the rate equation is
\begin{equation*} q(t) = 5 t + 5 \text{.} \end{equation*}
A rate equation can have many different solutions. In Example 4.2.8, we found that there was just one linear solution to that particular rate equation, but there could be other, non-linear solutions. Generally when we try to “solve” a rate equation, we are looking for all possible solution functions \(q(t)\text{,}\) not just individual solutions of a particular form.

Remark 4.2.9.

We will often refer to a single solution to a rate equation as a particular solution, to distinguish it from the definition below.

Definition 4.2.10. General solution to a rate equation.

Given a rate equation
\begin{equation*} r(t) = \text{some formula in } t \text{ and } q(t) \text{,} \end{equation*}
the general solution is a formula involving the independent variable \(t\) and one or more parameters, so that
  • choosing particular value(s) for the parameter(s) provides a formula for a particular solution function \(q(t)\)
  • every particular solution can be recovered from choosing particular parameter value(s).

Example 4.2.11. A general solution based on one parameter.

Consider the rate equation
\begin{equation*} r(t) = \frac{q(t) \cdot \bbrac{1 - q(t)}}{t + 1} \text{.} \end{equation*}
We will learn a technique for solving this equation in Chapter 15, and when that technique is successfully applied it leads to general solution
\begin{equation*} q(t) = \frac{c (t + 1)}{c t + 1} \end{equation*}
involving the parameter \(c\text{.}\) From this we can obtain many different particular solutions, one for each value of \(c\text{.}\)
For example,
\begin{equation*} c = 1 \qquad \implies \qquad q(t) = \frac{t + 1}{t + 1} = 1 \text{,} \end{equation*}
so in fact in this case we have a constant solution. Is it actually a solution? We know that a constant function isn’t varying, so its rate of variation is \(0\text{.}\) That is,
\begin{equation*} q(t) = 1 \qquad \implies \qquad r(t) = 0 \text{.} \end{equation*}
In this case,
\begin{align*} \mathrm{LHS} \amp = r(t) \amp \mathrm{RHS} \amp = \frac{q(t) \cdot \bbrac{1 - q(t)}}{t + 1} \\ \amp = 0 \amp \amp = \frac{1 \cdot \bbrac{1 - 1}}{t + 1} \\ \amp \amp \amp = 0 \text{,} \end{align*}
and so we have \(\mathrm{LHS} = \mathrm{RHS}\text{,}\) as desired.
But other values of \(c\) provide different solution functions. For example,
\begin{gather*} c = -1 \qquad \implies \qquad q(t) = - \frac{t + 1}{- t + 1} \\ c = \sqrt{2} \qquad \implies \qquad q(t) = \frac{\sqrt{2} (t + 1)}{\sqrt{2} t + 1} \\ c = \pi \qquad \implies \qquad q(t) = \frac{\pi (t + 1)}{\pi t + 1} \text{.} \end{gather*}
We wouldn’t want to verify that each of these is a solution one-by-one using the LHS vs RHS method as above, instead we can just do it all at once with the general solution expression. Later in the course we will learn techniques for computing a rate function formula from a quantity function formula. For now, let’s just ask the computer algebra system Sage to compute the rate function for us. The math word for computing a rate function from a quantity function is differentiate, and that is also the name of the Sage command.
The t |--> portion of the Sage output says that the rate function also uses input variable \(t\text{,}\) and then the formula for the rate function follows:
\begin{equation*} r(t) = \frac{-c^2 (t + 1)}{{(c t + 1)}^2} + \frac{c}{c t + 1} \text{.} \end{equation*}
To verify that the general solution formula always provides a solution to the rate equation, no matter the value of the parameter \(c\text{,}\) we would substitute
\begin{equation*} q(t) = \frac{c (t + 1)}{c t + 1} \end{equation*}
into the left-hand side of the rate equation and manipulate it algebraically until it resembles the rate function \(r(t)\) above.

Checkpoint 4.2.12.

Carry out the verification of the general solution to the rate equation in Example 4.2.11, using the process described at the end of that example.
When we have a general solution in hand, how do we decide what to take as the value(s) of the parameter(s)? A rate equation says that the rate of accumulation of some quantity depends on how much of the quantity is present, so it follows that how the system behaves will differ depending on the initial amount. That is, choosing parameter value(s) should be done to match a desired initial state of the system.

Definition 4.2.13. Initial value problem.

A rate equation together with a data point \(q(0) = q_0\) representing the initial amount data point.

Remark 4.2.14.

Technically, there is no reason to require that the “initial” data point be at \(t = 0\) — any single data point should be enough to turn a general solution into a particular solution that matches that data point.

Example 4.2.15. Obtaining a particular solution from an initial condition.

Let’s return to the rate equation and general solution from Example 4.2.11. Suppose we want the particular solution that satisfies initial condition
\begin{equation*} q(0) = 7 \text{.} \end{equation*}
Then
\begin{align*} q(t) = \frac{c (t + 1)}{c t + 1} \qquad \implies \qquad q(0) \amp = \frac{c (0 + 1)}{0 + 1} \\ \amp = c \text{.} \end{align*}
So to get \(q(0) = 7\) we need \(c = 7\text{,}\) and the particular solution we were looking for is
\begin{equation*} q(t) = \frac{7 (t + 1)}{7 t + 1} \text{.} \end{equation*}
While it will often be the case, it won’t always happen that the parameter in the general solution ends up representing the initial amount \(q(0)\text{.}\)

Section 4.3 Direction fields

Even though we haven’t yet developed any techniques for solving rate equations, we can still get an idea of what solutions look like graphically from the rate formula in a rate equation. Suppose we have
\begin{equation*} r(t) = \text{some formula in } t \text{ and } q(t) \text{.} \end{equation*}
Then the formula on the right will tells us the rate of variation at any data point \(\bbrac{t_0, q(t_0)}\text{.}\) That is, if we assume that a particular solution with “initial” condition \(\bbrac{t_0, q(t_0)}\) is possible, then the formula on the right tells us what the rate of variation of \(q\) is for that solution function at that time. To turn this kind of information into a picture, we make a simplifying assumption.

Remark 4.3.2.

Assumption 4.3.1 will be central to developing techniques for recovering a rate function from a quantity function.
To put Assumption 4.3.1 in other words, for such a quantity function, over a small enough time interval there isn’t enough time for the rate of variation to vary much. (We could say the same about the quantity function itself, but assuming the quantity function is approximately constant isn’t useful because we the whole idea of a rate equation is to model how \(q(t)\) is varying.)
The point of making this assumption is to say we expect solution functions to be locally linear: a function with a constant rate must be linear, so if a function has approximately constant rate over a small time interval, then it must be approximately linear over that time interval. Recalling that graphically a constant rate corresponds to the slope of the linear function, at each data point \(\bbrac{t_0, q(t_0)}\) that we consider, if there exists a solution with that “initial” condition, then the graph of the solution function
  • must pass through that point in the \(tq\)-plane
  • must have a graph that is approximately linear for a short time interval around that data point, with slope equal to the rate predicted by the rate equation for that data point.
We can use this assumption to make a graphical picture of what particular solutions approximately look like by making a grid of data points in the \(tq\)-plane, and then at each point drawing a small line segment with the corresponding slope predicted by the rate equation for that data point. Such a diagram is called a direction field (or slope field).

Example 4.3.3. Direction field for radioactive decay.

Let’s return to the rate equation
\begin{equation*} r(t) = - k q(t) \end{equation*}
from Example 4.2.3, and for the purposes of this example, let’s take \(k = 1/2\text{,}\) so that
\begin{equation*} r(t) = - \frac{q(t)}{2} \text{.} \end{equation*}
If the graph of a potential solution passes through the data point \((1,4)\text{,}\) then \(q(1) = 4\) and
\begin{align*} r(1) \amp = - \frac{q(1)}{2} \\ \amp = - \frac{4}{2} \\ \amp = - 2 \text{.} \end{align*}
So in our direction field we will draw a little line segment at position \((1,4)\) with slope \(-2\text{.}\) But notice what happens if we consider a different potential solution that passes through the data point \((3,4)\text{.}\) Then \(q(3) = 4\) and
\begin{align*} r(3) \amp = - \frac{q(3)}{2} \\ \amp = - \frac{4}{2} \\ \amp = - 2 \text{.} \end{align*}
So in our direction field we will also draw a little line segment at position \((3,4)\) with slope \(-2\text{.}\)
It’s not a coincidence that we got the same rate value in both of our example calculations above — since the rate equation does not involve the independent variable \(t\text{,}\) different potential solutions that pass through the same output level but at different \(t\)-positions will do so with the same rate value. For example, any solution that hits \(q(t_0) = 4\) at some \(t = t_0\) must have \(r(t_0) = -2\) there. With this in mind, we can set up a table to record some \(r(t)\) values from potential \(q(t)\) values.
\(q(t)\) \(0\) \(1\) \(2\) \(3\) \(4\) \(5\) \(6\)
\(r(t)\) \(0\) \(-1/2\) \(-1\) \(-3/2\) \(-2\) \(-5/2\) \(-6\)
Then when we draw our direction field for this rate equation below in Figure 4.3.4, we use the same slope value for grid points that are at the same \(q\)-level.
Direction field for a rate equation modelling radioactive decay.
Figure 4.3.4. Direction field for a rate equation modelling radioactive decay.
From the direction field, we can see the overall behaviour that individual solutions exhibit — when there is a lot of material (large \(q(t)\)) then it decays rapidly, and where is little material the decay occurs much more slowly.
We can attempt to draw in what graphs of solutions corresponding to different initial condition values \(q(0)\) might look like.
Several solution curves superimposed onto the direction field for a rate equation modelling radioactive decay.
Figure 4.3.5. Several solution curves superimposed onto the direction field for a rate equation modelling radioactive decay.
In Figure 4.3.5, we see that the solution curves follow the general direction of the direction field.
We can even use the direction field and representative solution curves to make predictions about solutions, such as long-term behaviour. For example, it appears that no matter the initial amount \(q(0)\text{,}\) all solution functions will satisfy
\begin{equation*} q(t) \to 0 \qquad \text{as} \qquad t \to \infty \text{.} \end{equation*}

Example 4.3.6. A direction field that varies in both horizontal and vertical.

Now let’s try plotting a direction field for the rate equation in Example 4.2.6. This example is slightly different from the last in that the rate equation involves the independent variable as well, so the slopes of our line segments will vary more.
Our rate equation in that example was
\begin{equation*} r(t) = \frac{q(t) \bbrac{1 - q(t)}}{t + 1} \text{.} \end{equation*}
Here is an example slope calculation for one of the line segments in the direction field. If we assume that there exists a solution function \(q(t)\) whose graph passes through the point \((1,-2)\text{,}\) then that means \(q(1) = -2\text{,}\) and so
\begin{align*} r(1) \amp = \frac{q(1) \bbrac{1 - q(1)}}{1 + 1} \\ \amp = \frac{-2 \bbrac{1 - (-2)}}{2} \\ \amp = - 3 \text{.} \end{align*}
So in our direction field we should draw a little line segment at point \((1,-2)\) with slope \(-3\text{.}\) To get an actual direction field, we repeat the above calculation at a number of points in a grid. In Figure 4.3.7, we have carried this out for
\begin{align*} 0 \le \amp t \le 4, \amp -4 \le \amp q(t) \le 4 \text{,} \end{align*}
with grid points spaced a half-unit apart.
Direction field for a rate equation involving both the dependent and independent variables.
Figure 4.3.7. Direction field for a rate equation involving both the dependent and independent variables.
In this direction field, we can see a few different kinds of behaviours on the domain \(t \ge 0\text{.}\) First, we can see two equilibrium or “steady-state” solutions at \(q(t) = 1\) and \(q(t) = 0\text{.}\) (The slope segments at \(q(t) = 0\) are hidden by the \(t\)-axis, but they are also horizontal there.) Second, when the initial amount \(q(0)\) is positive, the solutions appear to tend to \(1\) over the long term. That is, when \(q(0) \gt 0\text{,}\) it appears that we will have
\begin{equation*} q(t) \to 1 \qquad \text{as} \qquad t \to \infty \text{.} \end{equation*}
However, when the initial amount \(q(0)\) is negative, the solutions appear to eventually head sharply downward. That is, when \(q(0) \lt 0\text{,}\) it appears that we will have
\begin{equation*} q(t) \to -\infty \qquad \text{as} \qquad t \to \infty \text{.} \end{equation*}
Several solution curves superimposed onto the direction field for a rate equation.
Figure 4.3.8. Several solution curves superimposed onto the direction field for a rate equation.

Definition 4.3.9. Integral curve.

A curve in the \(tq\)-plane that follows the direction field for a specific rate equation.

Warning 4.3.10.

Integral curves do not always represent solution functions, as they sometimes fail the Vertical Line Test. But even in that case we can usually “snip” them into pieces of the curve so that each individual piece is the graph of a solution function.