# 3.9: Differential Equations

- Page ID
- 71068

\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

\( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)

( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)

\( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

\( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)

\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

\( \newcommand{\Span}{\mathrm{span}}\)

\( \newcommand{\id}{\mathrm{id}}\)

\( \newcommand{\Span}{\mathrm{span}}\)

\( \newcommand{\kernel}{\mathrm{null}\,}\)

\( \newcommand{\range}{\mathrm{range}\,}\)

\( \newcommand{\RealPart}{\mathrm{Re}}\)

\( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

\( \newcommand{\Argument}{\mathrm{Arg}}\)

\( \newcommand{\norm}[1]{\| #1 \|}\)

\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

\( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)

\( \newcommand{\vectorA}[1]{\vec{#1}} % arrow\)

\( \newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow\)

\( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

\( \newcommand{\vectorC}[1]{\textbf{#1}} \)

\( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

\( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

\( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

\(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)A **differential equation** is an equation involving the derivative of a function. They allow us to express with a simple equation the relationship between a quantity and it's rate of change.

A bank pays 2% interest on its certificate of deposit accounts, but charges a $20 annual fee. Write an equation for the rate of change of the balance, \( B'(t) \).

**Solution**

If the balance \( B(t) \) has units of dollars, then \( B'(t) \) has units of dollars per year. When we think of what is changing the balance of the account, there are two factors:

- The interest, which increases the balance, and
- The fee, which decreases the balance.

Considering the interest, we know each year the balance will increase by 2%, but 2% of what? Each year that will change, since we earn interest on whatever the current balance is. We can represent the amount of increase as 2% of the balance: \( 0.02B(t) \) dollars/year.

The fee already has the units of dollars/year. Since everything now has the same units, we can put the two together, and create the equation: \[ B'(t)=0.02B(t)-20. \nonumber \]

The result is an example of a differential equation. Notice this particular equation involves both the derivative *and* the original function, and so we can't simply find \( B(t) \) using basic integration.

Algebraic equations contain constants and variables, and the solutions of an algebraic equation are typically numbers. For example, \(x = 3\) and \(x = -2\) are solutions of the algebraic equation \(x^2 = x + 6\). Differential equations contain derivatives or differentials of functions. Solutions of differential equations are functions. The differential equation \(y' = 3x^2\) has infinitely many solutions, and two of those solutions are the functions \(y = x^3 + 2\) and \(y = x^3 - 4\).

You have already solved lots of differential equations: every time you found an antiderivative of a function \(f(x)\), you solved the differential equation \(y' = f(x)\) to get a solution \(y\). The differential equation \(y' = f(x)\), however, is just the beginning. Other applications generate different differential equations, like in the bank balance example above.

## Checking Solutions of Differential Equations

Whether a differential equation is easy or difficult to solve, it is important to be able to check that a possible solution really satisfies the differential equation.

A possible solution of an algebraic equation can be checked by putting the solution into the equation to see if the result is true: \(x = 3\) is a solution of \(5x + 1 = 16\) since \(5(3) + 1 = 16\) is true. Similarly, a solution of a differential equation can be checked by substituting the function and the appropriate derivatives into the equation to see if the result is true: \(y = x^2\) is a solution of \(xy' = 2y\) since \(y' = 2x\) and \(x(2x) = 2\left(x^2\right)\) is true.

- Check that \(y = x^2 + 5\) is a solution of \(y'' + y = x^2 + 7\) and
- Check that \(y = x + \frac{5}{x}\) is a solution of \(y' + \frac{y}{x} = 2\).

**Solution**

- \(y = x^2 + 5\) so \(y' = 2x\) and \(y'' = 2\). Substituting these functions for \(y\) and \(y''\) into the differential equation \(y'' + y = x^2 + 7\), we have \[y'' + y = (2) + \left(x^2 + 5\right) = x^2 + 7,\nonumber \] so \(y = x^2 + 5\) is a solution of the differential equation.
- \(y = x + \frac{5}{x}\) so \(y' = 1 - \frac{5}{x^2}\). Substituting these functions for \(y\) and \(y'\) in the differential equation \(y' + \frac{y}{x} = 2\), we have \[ y' + \frac{y}{x} = \left(1 - \frac{5}{x^2}\right) + \frac{1}{x}\left(x + \frac{5}{x}\right) = 1 - \frac{5}{x^2} + 1 + \frac{5}{x^2} = 2, \nonumber \] the result we wanted to verify.

## Separable Differential Equations

A differential equation is called **separable** if the variables can be separated algebraically so that all the \(x\)'s and \(dx\) are one one side of the equation, and all the \(y\)'s and \(dy\) are on the other side of the equation. In other words, so the equation has the form \( f(x)\, dx=g(y)\, dy \).

Once separated, separable differential equations can be solved by integrating both sides of the equation.

Find the solution of \[ y'=\frac{6x+1}{2y}. \nonumber \]

**Solution**

Rewriting \(y'\) is a helpful first step: \[ \frac{dy}{dx}=\frac{6x+1}{2y}\nonumber \]

Now we can multiply both sides by \(dx\) and by \(2y\) to separate the variables: \[ 2y\, dy=(6x+1)\, dx \nonumber\]

Integrating each side, we have \[ \begin{align*} \int 2y\, dy & = \int (6x+1)\, dx \\ y^2+C_1 & = 3x^2+x+C_2 \end{align*} \nonumber \]

Notice that we can combine the two constants to create a new, consolidated constant \(C\), so we usually only bother to put a constant on the right side: \[ y^2=3x^2+x+C. \nonumber \]

As expected, there is a whole family of solutions to this differential equation.

An **initial value problem** is a differential equation that provides additional information about the initial, or starting, value of the function. This allows us to then solve for the constant and find a single solution.

Find the solution of \( y'=\frac{6x+1}{2y} \) which satisfies \( y(2)=3 \).

**Solution**

In the previous example we found the general solution, \( y^2=3x^2+x+C \).

Substituting in the initial condition, \(y = 3\) when \(x = 2\), \[3^2=3(2)^2+2+C,\nonumber \] so \( 9=12+2+C \), giving \( C=-5 \).

The solution is \[ y^2=3x^2+x-5. \nonumber \] Sometimes it is desirable to solve for \(y\), which would yield \( y=\pm\sqrt{3x^2+x-5} \), but since the initial condition had a positive \(y\) value, we isolate the positive solution: \[ y=\sqrt{3x^2+x-5}. \nonumber \]

A bank pays 2% interest on its certificate of deposit accounts, but charges a $20 annual fee. If you initially invest $3,000, how much will you have after 10 years?

**Solution**

You may recognize this as the example from the beginning of the section, for which we set up the equation \( B'(t)=0.02B(t)-20 \) or, more simply, \[ \frac{dB}{dt}=0.02B-20. \nonumber \]

We can separate this equation by multiply by \(dt\) and dividing by the entire expression on the right: \[ \frac{dB}{0.02B-20}=dt. \nonumber \]

Integrating the left side of this equation requires substitution. Let \( u=0.02B-20 \), so \( du=0.02\, dB \). Making the substitution, \[ \begin{align*} \int\frac{dB}{0.02B-20} & = \int\frac{du/0.02}{u} \\ & = \int\frac{1}{u}\frac{du}{0.02} \\ & = \frac{1}{0.02}\int\frac{1}{u}\, du \\ & = \frac{1}{0.02}\ln|u|+C_1\\ & = \frac{1}{0.02}\ln|0.02B-20|+C_1 \end{align*} \nonumber \]

Integrating on the right side of the differential equation is easier: \[\int dt = t+C_2\nonumber \]

Together, this gives us the general solution to the differential equation (we're also combining the \( C \)'s in this step): \[ \frac{1}{0.02}\ln|0.02B-20|=t+C \nonumber \]

Now we would like to solve for \(B\). Start by multiplying by 0.02. \[ \begin{align*} \ln|0.02B-20| & = 0.02t+0.02C &\\ \ln|0.02B-20| & = 0.02t+D &\qquad\text{We can rename \( D=0.02C \) for simplicity.}\\ e^{\ln|0.02B-20|} & = e^{0.02t+D} &\qquad\text{Exponentiate both sides: \( e^{\text{left}}=e^{\text{right}} \).}\\ |0.02B-20| & = e^{0.02t+D} &\qquad\text{Use the log rule \( e^{\ln(A)}=A \).}\\ 0.02B-20 & = e^{0.02t+D} &\qquad\text{Since the RHS is always positive, we can drop the abs value.}\\ 0.02B-20 & = e^{0.02t}e^D &\qquad\text{Using the rule \( e^{A+B}=e^Ae^B \).}\\ 0.02B-20 & = ke^{0.02t} &\qquad\text{Rename \( k=e^D \).}\\ B & = \frac{ke^{0.02t}+20}{0.02}=\frac{ke^{0.02t}}{0.02}+1000 &\qquad\text{Add 20 and divide by 0.02.}\\ B & = Ae^{0.02t}+1000 &\qquad\text{Rename \( A=\frac{k}{0.02} \).} \end{align*} \nonumber \]

Finally, we can substitute our initial value of \(B = 3000\) when \(t = 0\) to solve for the constant \(A\): \[ \begin{align*} 3000 & = Ae^{0.02(0)}+1000 \\ A & = 2000 \end{align*} \nonumber \]

This gives us the equation for the account balance after \(t\) years: \[ B(t)=2000e^{0.02t}+1000. \nonumber \]

To find the balance after 10 years, we can evaluate this equation at \(t = 10\): \[ B(10)=2000e^{0.02(10)}+1000\approx \$3442.81. \nonumber \]

It's worth noting that this answer isn't exactly right. Differential equations assume *continuous* changes, and it is unlikely interest is compounded continuously or the fee is extracted continuously. However, the answer is probably close to the actual answer, and differential equations provide a relatively simple model of a complicated situation.

## Models of Growth

The bank account example demonstrated one basic model of growth: growth proportional to the existing quantity. Bank accounts and populations both tend to grow this way if not constrained. This type of growth is called **unlimited growth**.

If a quantity or population y grows at a rate proportional that quantity's size, it can be modeled with **unlimited growth**, which has the differential equation: \[ y'=ry, \nonumber \] where \(r\) is a constant.

A population grows by 8% each year. If the current population is 5,000, find an equation for the population after \(t\) years.

**Solution**

\[ \begin{align*} \frac{dy}{dt} & = 0.08y &\\ \frac{1}{y}\, dy & = 0.08\, dt &\qquad\text{Separate the variables.}\\ \ln|y| & = 0.08t+C &\qquad\text{Integrate both sides.}\\ e^{\ln|y|} & = e^{0.08t+C} &\qquad\text{Exponentiate both sides.}\\ y & = Ae^{0.08t} &\qquad\text{Simplify both sides, using the tricks we used in the bank example.} \end{align*} \nonumber \]

Now substitute in the initial condition: \( 5000=Ae^{0.08(0)} \), so \( A=5000 \).

The population will grow following the equation \[ y=5000e^{0.08t}. \nonumber \]

Notice that the solution to the unlimited growth equation is an exponential equation.

When a product is advertised heavily, sales will tend to grow very quickly, but eventually the market will reach saturation, and sales will slow. In this type of growth, called **limited growth**, the population grows at a rate proportional to the distance from the maximum value.

If a quantity grows at a rate proportional to the distance from the maximum value, \(M\), it can be modeled with **limited growth**, which has the differential equation \[ y'=k(M-y), \nonumber \] where \(k\) is a constant, and \(M\) is the maximum size of \(y\).

A new cell phone is introduced. The company estimates they will sell 200 thousand phones. After 1 month they have sold 20 thousand. How many will they have sold after 9 months?

**Solution**

In this case there is a maximum amount of phones they expect to sell, so \(M = 200\) thousand. Modeling the sales, \(y\), in thousands of phones, we can write the differential equation \[ y'=k(200-y). \nonumber \]

Since it was a new phone, \( y(0)=0 \). We also know the sales after one month, \( y(1)=20 \).

Solving the differential equation: \[ \begin{align*} \frac{dy}{dt} & = k(200-y) &\\ \frac{dy}{200-y} & = k\, dt &\qquad\text{Separate the variables.}\\ -\ln|200-y| & = kt+C &\qquad\text{Integrate both sides. On the left use the substitution.}\\ e^{\ln|200-y|} & = e^{-kt+C} &\qquad\text{Multiply both sides by -1, and exponentiate both sides.}\\ 200-y & = Be^{-kt} &\qquad\text{Simplify.}\\ y & = Ae^{-kt}+200 &\qquad\text{Subtract 200, divide by -1, and simplify.} \end{align*} \nonumber \]

Using the initial condition \( y(0)=0 \), \[ 0=Ae^{-k(0)}+200, \nonumber \] so \( 0=A+200 \), giving \( A=-200 \).

Using the value \( y(1)=20 \): \[ \begin{align*} 20 & = -200e^{-k(t)}+200 &\\ \frac{=180}{-200} & = 0.9=e^{-k} &\qquad\text{Subtract 200 and divide -200.}\\ \ln(0.9) & = \ln\left(e^{-k}\right)=-k &\qquad\text{Take the ln of both sides.}\\ k & = -\ln(0.9)\approx 0.105 &\qquad\text{Divide by -1.} \end{align*} \nonumber \]

As a quick sanity check, this value is positive as we would expect, indicating that the sales are growing over time. We now have the equation for the sales of phones over time: \[ A=-200e^{-0.105t}+200. \nonumber \]

Finally, we can evaluate this at \(t = 9\) to find the sales after 9 months: \[ A(9)=-200e^{-0.105(9)}+200\approx 122.26\text{ thousand phones}. \nonumber \]

Limited growth is also commonly used for learning models, since when learning a new skill, people typically learn quickly at first, then their rate of improvement slows down as they approach mastery.

Jim is learning a new set of product codes for work. Each day he studies, and tests his recall. Suppose that after 4 days, Jim has mastered 70% of the new codes. How long will it take for him to master 95% of the codes, if the limited growth model applies.

**Solution**

In this case there is a maximum amount of mastery possible, so \(M\) = 100%. Modeling his learning, \(L\), as percent of mastery, we can write the differential equation \(L'=k(100-L)\)

Solving as we did in the previous example, we obtain \(L=Ae^{-kt}+100\).

Since he started not knowing any of the codes \(L(0)=0\), so \(0 = Ae^{-k(0)}+100\), so \(A = -100\).

Using that Jim mastered 70 of the codes in 4 days, \(L(4)=70\), so

\[\begin{align*} 70 = -100e^{-k(4)}+100 \\ -30 = -100e^{-k(4)} \\ 0.3 = e^{-k(4)} \\ \ln(0.3) = \ln \left(e^{-k(4)}\right) = -4k \\ k = \frac{\ln(0.3)}{-4} \approx 0.301 \end{align*}\]

Now we have the equation \(L = -100e^{-0.301t} + 100\), we can solve for when \(L = 95\).

\[\begin{align*} 95 = -100e^{-0.301t}+100 \\ -5 = -100e^{-0.301t} \\ 0.05 = e^{-0.301t} \\ \ln(0.3) = \ln \left(e^{-0.301t}\right) = -0.301t \\ t = \frac{\ln(0.05)}{-0.301} \approx 9.95 \end{align*}\]

Jim will have reached 95% mastery after about 10 days.

Earlier we used unlimited growth to model a population, but often a population will be constrained by food, space, and other resources. When a population grows both proportional to its size, and relative to the distance from some maximum, that is called **logistic growth**. This leads to the differential equation \( y'=ky(M-y) \), which is accurate but not always convenient to use. We will use a slight modification. Since solving this differential equation requires integration techniques we haven't learned, the solution form is given.

If a quantity grows at a rate proportional to its size and to the distance from the maximum value, \(M\), it can be modeled with **logistic growth**, which has the differential equation: \[ y'=ry\left(1-\frac{y}{M}\right). \nonumber \]

\(r\) can be interpreted as the growth rate absent constraints

, i.e., how the population would grow if there wasn't a maximum value.

This differential equation has solutions of the form \[ y=\frac{M}{1+Ae^{-rt}}. \nonumber \]

A colony of 100 rabbits is introduced to a reclaimed forest. After 1 year, the population has grown to 300. It is estimated the forest can sustain 5000 rabbits. The forest service plans to reintroduce wolves to the forest when the rabbit population reaches 3000 rabbits. When will that occur?

**Solution**

The maximum sustainable population was given as \(M = 5000\). Using the solution form \[ y=\frac{M}{1+Ae^{-rt}} \nonumber \] and the initial condition \( y(0)=100 \) we can solve for \( A \): \[ \begin{align*} 100 & = \frac{5000}{1+Ae^{-r(0)}} &\\ 100 & = \frac{5000}{1+A} &\qquad\text{Simplify.}\\ 100(1+A) & = 5000 &\qquad\text{Multiply both sides by \( 1+A \).}\\ 1+A & = 50 &\qquad\text{Divide by 100.}\\ A & = 49 & \end{align*} \nonumber \]

Now, using \( y(1)=300 \), we can solve for \(r\): \[ \begin{align*} 300 & = \frac{5000}{1+49e^{-r(1)}} \\ 300\left(1+49e^{-r}\right) & = 5000 \\ 1+49e^{-r} & = \frac{5000}{300} \\ e^{-r} & = \frac{\frac{50}{3}-1}{49}\approx 0.3197 \\ -r & = \ln(0.3197) \\ r & = -\ln(0.3197)\approx 1.1404 \end{align*} \nonumber \]

We now have the equation for the population after \(t\) years: \[ y=\frac{5000}{1+49e^{-1.1404t}}. \nonumber \]

To answer the original equation, of when the rabbit population will reach 3000, we need to solve for \(t\) when \(y = 3000\): \[ \begin{align*} 3000 & = \frac{5000}{1+49e^{-1.1404t}} \\ 3000\left(1+49e^{-1.1404t}\right) & = 5000 \\ e^{-1.1404t} & = \frac{\frac{5}{3}-1}{49}\approx 0.01361 \\ t & = \frac{\ln(0.01361)}{-1.1404}\approx 3.77\text{ years}. \end{align*} \nonumber \]

Logistic growth is also a good model for unadvertised sales. A new product that is not advertised will have sales increase slowly at first, then grow as word of mouth spreads and people become familiar with the product. Sales will level off as they approach market saturation.