# The Ordinary Differential Equations Project

## Section1.5First-Order Linear Equations

A first-order differential equation is an equation of the form
$$\frac{dx}{dt} + p(t) x = q(t).\tag{1.5.1}$$
This equation will not be separable if $$p(t)$$ is not a constant. We shall have to find a new approach to solving such an equation. We could, of course, use a numerical algorithm to solve (1.5.1); however, we can always find an algebraic solution to a first-order linear differential equation. Moreover, the fact that we can obtain such a solution analytically will prove very useful when we investigate more complicated equations and systems of equations.

### Subsection1.5.1Mine Tailings

In any mining operation, tailings are what is left after everything of value has been extracted. For example, in a hard rock mining operation, ore is often pulverized and then processed using chemicals to extract certain minerals of value. Soft rock mining operations such as coal mining or extracting oil from tar sands might use solvents or water to extract any commodity of value. The material that is left over after the minerals, coal, or oil is extracted can often present huge environmental challenges. There are different ways of processing mine tailings, but one way is to store them in a pond, especially if water is used in the mining operation. This method allows any particles that are suspended in the water to settle to the bottom of the pond. The water can then be treated and recycled.
Suppose that we have a gold mining operation and we are storing our tailings in a pond that has an initial volume of 20,000 cubic meters. When we begin our operation, the tailings pond is filled with clean water. The pond has a stream flowing into it, and water is also pumped out of the pond. Chemicals are used in processing gold ore. These chemicals such as sodium cyanide can be highly poisonous and dangerous to the environment, and the water must be treated before it is released into the watershed. Suppose that 1000 cubic meters per day flow into the pond from stream and 1000 cubic meters are pumped from the pond each day to be processed and recycled. Thus, the water level of the pond remains constant.
At time $$t = 0\text{,}$$ the water from stream becomes contaminated with chemicals from the mining operation, say at a rate of 5 kilograms of chemicals per 1000 cubic meters. We will assume that water in our tailings pond is well mixed so that the concentration of chemicals through out the pond is fairly uniform. In addition, any particulate matter pumped into the pond from the stream settles to the bottom of the pond at a rate of 50 cubic meters per day. Thus, the volume of our tailings pond is reduced by 50 cubic meters each day, and our tailings pond will become full after 400 days of operation. We shall assume that the particulate matter and the chemicals are included in the 1000 cubic meters that flow into the pond from the stream each day.
We wish to find a differential equation that will model the amount of chemicals in the tailings pond at any particular time. Let $$x(t)$$ be the amount of chemicals in the pond at time $$t\text{.}$$ Then $$dx/dt$$ is the difference between the rate at which the chemicals are entering the pond and the rate at which the chemicals leave the pond.
\begin{equation*} \frac{dx}{dt} = \text{rate in} - \text{rate out}. \end{equation*}
Since water flows into the pond from the stream at a rate of 1000 cubic meters per day, the rate at which the chemicals enter the pond is 5 kilograms per day. On the other hand, the rate at which the chemicals leave the pond will depend on the amount of chemicals in the pond at time $$t\text{.}$$ The volume of the pond is decreasing due to sediment, and at time $$t$$ it is $$V(t) = 20000 - 50t\text{.}$$ Thus, the concentration of chemicals in the pond at time $$t$$ is $$x/(20000 - 50 t)\text{,}$$ and the rate at which the chemicals are flowing out of the pond to be recycled is
\begin{equation*} 1000 \left( \frac{x}{20000 - 50t} \right) = \frac{20x}{ 400 - t}. \end{equation*}
Hence, the differential equation that models the amount of chemical in the tailings pond at time $$t$$ is
$$\frac{dx}{dt} = 5 - \frac{20x}{ 400 - t}.\tag{1.5.2}$$
Of course, we will have to cease mining operations once the pond is full, since there will only be water in the pond if $$V(t) = 20000 - 50t \geq 0\text{;}$$ that is, when $$0 \leq t \lt 400\text{.}$$
Notice that equation (1.5.2) is not autonomous. In fact, it is not even separable. We will have to use a different approach to find a solution. First, we will rewrite the equation in the form
\begin{equation*} \frac{dx}{dt} + \frac{20}{ 400 - t} x = 5. \end{equation*}
If we multiply both sides of this equation by $$(400 - t)^{-20}\text{,}$$ we obtain
$$(400 - t)^{-20}\frac{dx}{dt} + 20(400 - t)^{-21} x = 5(400 - t)^{-20}.\tag{1.5.3}$$
We now make the crucial observation that the product rule applies to the lefthand side of our equation,
\begin{equation*} (400 - t)^{-20}\frac{dx}{dt} + 20(400 - t)^{-21} x = \frac{d}{dt} \left( (400 - t)^{-20}x \right). \end{equation*}
Thus, equation (1.5.3) becomes
\begin{equation*} \frac{d}{dt} \left( (400 - t)^{-20}x \right) = 5(400 - t)^{-20}. \end{equation*}
Integrating both sides of this equation, we have
\begin{equation*} (400 - t)^{-20}x = 5 \int (400 - t)^{-20} \, dt = \frac{5(400 - t)^{-19}}{19} + C, \end{equation*}
where $$C$$ is an arbitrary constant. Solving for $$x\text{,}$$ we obtain
\begin{equation*} x(t) = \frac{5}{19} (400 - t) + C(400 - t)^{20}. \end{equation*}
Since $$x(0) = 0\text{,}$$ we can quickly determine that $$C = - (5/19)400^{-19}$$ and that the solution to our initial value problem is
\begin{equation*} x(t) = \frac{5}{19} (400 - t) \left[ 1 - \left( \frac{400 - t}{400} \right)^{19} \right]. \end{equation*}
The graph of the solution to our differential equation (Figure 1.5.1) fits the situation. Initially, there are no chemicals in the pond, but $$x(t)$$ quickly increases. However, the amount of chemicals decreases as the pond begins to fill with sediment. Eventually, there are no chemicals at $$t = 400\text{.}$$

### Subsection1.5.2First-Order Linear Equations

The differential equation
\begin{equation*} \frac{dx}{dt} + \frac{20}{ 400 - t} x = 5 \end{equation*}
is an example of a first-order linear differential equation. More specifically, a first-order linear differential equation is an equation that can be written in the form
\begin{equation*} \frac{dx}{dt} + p(t) x = q(t). \end{equation*}
Let us first show how to solve first-order linear equations when the coefficient functions are constant. If
\begin{align*} \frac{dx}{dt} + px & = q,\\ x(t_0) & = x_0, \end{align*}
then we first multiply both sides of the equation by $$e^{pt}$$ to obtain
\begin{equation*} e^{pt} \frac{dx}{dt} + e^{pt} px = q e^{pt}. \end{equation*}
The left-hand side of the equation is exact. That is,
\begin{equation*} e^{pt} \frac{dx}{dt} + e^{pt} px = \frac{d}{dt} \left( x(t) e^{pt} \right). \end{equation*}
If we integrate both sides of
\begin{equation*} \frac{d}{dt} \left( x(t) e^{pt} \right)= q e^{pt}, \end{equation*}
then
\begin{equation*} x(t) e^{pt} = \frac{q}{p} e^{pt} + C. \end{equation*}
If we apply the initial condition, we can determine $$C\text{,}$$
\begin{equation*} C = \left( x_0 - \frac{q}{p} \right) e^{pt_0}. \end{equation*}
Thus, the solution that we seek is
\begin{equation*} x(t) = \frac{q}{p} + \left( x_0 - \frac{q}{p} \right) e^{p(t_0 - t)}. \end{equation*}
Suppose we wish to solve the initial value problem
\begin{align} \frac{dx}{dt} -2 x & = 3,\tag{1.5.4}\\ x(0) & = 1.\tag{1.5.5} \end{align}
Multiplying both sides of equation (1.5.4) by $$e^{-2t}\text{,}$$ we obtain
\begin{equation*} \frac{d}{dt}\left( e^{-2t}x \right) = e^{-2t}\frac{dx}{dt} -2 e^{-2t}x = 3e^{-2t}. \end{equation*}
Integrating both sides of this last equation, gives us the following
\begin{equation*} e^{-2t}x = 3 \int e^{-2t} \, dt + C = -\frac{3}{2} e^{-2t} + C. \end{equation*}
Applying the initial condition $$x(0) = 1\text{,}$$ we can conclude that $$C = 5/2\text{,}$$ and
\begin{equation*} x(t) = \frac{5}{2} e^{2t} - \frac{3}{2}. \end{equation*}
Now let us solve a first-order linear differential equation where the coefficients are not constant. Suppose that
\begin{equation*} y' + 2xy = e^{-x^2}, \end{equation*}
where $$y(0) = 1\text{.}$$ We will multiply both sides of the equation by $$e^{x^2}$$ and use the product rule to obtain
\begin{equation*} \frac{d}{dx} \left( e^{x^2} y \right) = e^{x^2} y' + 2xe^{x^2}y = e^{x^2} e^{-x^2} = 1. \end{equation*}
Integrating both sides, we get
\begin{equation*} e^{x^2} y = \int dx + C. \end{equation*}
Thus, the general solution is
\begin{equation*} y = (x + C) e^{-x^2}. \end{equation*}
Using the initial condition to solve for $$C\text{,}$$ we find that $$C = 1$$ and
\begin{equation*} y = (x + 1)e^{-x^2}. \end{equation*}
We can use Sage to check our solution.
x = var('x')
y = function('y')(x)
de = diff(y, x) + 2*x*y == exp(-x^2)
solution = desolve(de, y, ics = [0, 1])
solution.show()

Surprisingly, the strategy in Example 1.5.3 will always work. Suppose that
$$x' + p(t) x = q(t).\tag{1.5.6}$$
If we choose $$P(t)$$ such that $$P'(t) = p(t)$$ and multiply both sides of the equation by $$e^{P(t)}\text{,}$$ then
\begin{equation*} \left( e^{P(t)} x \right)' = e^{P(t)} ( x'(t) + p(t) x(t) )= e^{P(t)} q(t). \end{equation*}
Integrating both sides,
\begin{equation*} e^{P(t)} x = \int e^{P(t)} q(t) \, dt + C \end{equation*}
or
\begin{equation*} x = \frac{1}{e^{P(t)} } \left( \int e^{P(t)} q(t) \, dt + C \right). \end{equation*}
The Fundamental Theorem of Calculus tells us that $$P(t) = \int p(t) \, dt\text{.}$$ We say that
\begin{equation*} \mu(t) = e^{\int p(t) \, dt} = \exp\left( \int p(t) \, dt \right) \end{equation*}
is an integrating factor for the differential equation (1.5.6).
Consider the initial value problem
\begin{gather*} \frac{dy}{dx} - \frac{2}{x} y = 2x^2\\ y(-2) = 4. \end{gather*}
Our integrating factor is
\begin{equation*} \mu(x) = \exp\left( - \int \frac{2}{x} \, dx\right) = e^{-2 \ln x} = e^{\ln x^{-2}} = x^{-2}. \end{equation*}
Multiplying both of our differential equation by $$\mu(x) = x^{-2}\text{,}$$ we obtain
\begin{equation*} x^{-2} \left(\frac{dy}{dx} - \frac{2}{x} y \right) = 2 \end{equation*}
or
\begin{equation*} \frac{d}{dx}\left( x^{-2} y \right) = x^{-2} \frac{dy}{dx} - 2 x^{-3} y = 2. \end{equation*}
We can now integrate this equation to get
\begin{equation*} x^{-2} y = 2x + C. \end{equation*}
The initial condition $$y(-2) = 4$$ allows us to find $$C = 5\text{.}$$ Therefore, the solution to our initial value problem is
\begin{equation*} y = 2x^3 + 5x^2. \end{equation*}

#### Activity1.5.1.Finding Solutions to First-Order Linear Differential Equations.

Solve each of the following initial value problems.
##### (a)
$$y' = 3y + t\text{;}$$ $$y(0) = 1$$
##### (b)
$$x' = tx + 2t\text{;}$$ $$x(1) = 2$$
##### (c)
$$y' = 2x - 3y + e^{-x}\text{;}$$ $$y(0) = 1$$
##### (d)
$$\dfrac{du}{dt} = \dfrac{t - 1}{t} u + t^2\text{;}$$ $$u(1) = 0$$
##### (e)
$$y' = \sin x - y\text{;}$$ $$y(0) = 1$$

### Subsection1.5.3Mixing Models

Many applications involve the mixing of two or more substances together. As we mentioned previously, we can model how petroleum products are mixed together in a refinery, how various ingredients are mixed together in a brewery, or how greenhouse gases move across various layers of the earth's atmosphere.
Suppose that a 100-gallon tank initially contains 50 gallons of salt water containing five pounds of salt. A brine mixture containing one pound of salt per gallon flows into the top of the tank at a rate of 5 gallons per minute. A well mixed solution leaves the tank at rate of 4 gallons per minute. We wish to know how much salt is in the tank, when the tank is full.
To construct our model, we will let $$t$$ be the time (measured in minutes) and set up a differential equation that will measure how fast the amount of salt at time $$t\text{,}$$ $$x(t)\text{,}$$ is changing. We have the initial condition $$x(0) = 5\text{,}$$ and
\begin{align*} \frac{dx}{dt} & = \text{rate of salt flowing in} - \text{rate of salt flowing out}\\ & = \underbrace{5}_{\text{in flow}} - \underbrace{4 \frac{x}{V(t)}}_{\text{out flow}}, \end{align*}
where $$V(t)$$ is the volume at time $$t\text{.}$$ The expression $$x/V(t)$$ is the amount of salt in one gallon at time $$t\text{.}$$ We have $$V(t) = 50 + t\text{,}$$ since the tank starts with 50 gallons and five gallons are pumped into the tank per minute while four gallons leave the tank during the same time interval. Thus, our differential equation becomes
\begin{equation*} \frac{dx}{dt} = 5 - \frac{4}{50 + t}x. \end{equation*}
Our equation is linear since we can rewrite it as
$$\frac{dx}{dt} + \frac{4}{50 + t} x = 5.\tag{1.5.7}$$
An integrating factor for this differential equation is
\begin{equation*} \mu(t) = \exp\left( \int \frac{4}{50 + t} \, dt \right) = e^{4 \ln(50 + t)} = (50 + t)^4. \end{equation*}
Therefore, if we multiply both sides of equation (1.5.7) by $$\mu(t)\text{,}$$ we get
\begin{equation*} (50 + t)^4\frac{dx}{dt} + 4(t + 50)^3 x = 5(50 + t)^4. \end{equation*}
We can now apply the product rule to obtain
\begin{equation*} \frac{d}{dt}[ (50 + t)^4 x] = 5(50 + t)^4. \end{equation*}
Integrating both sides and simplifying gives us
\begin{equation*} x = t + 50 + \frac{C}{(t + 50)^4}. \end{equation*}
Our initial condition, $$x(0) = 5$$ tells us that $$C = -281{,}250{,}000$$ and
\begin{equation*} x(t) = t + 50 - \frac{281250000}{(t + 50)^4}. \end{equation*}
Thus, when the tank is full, $$t = 50$$ and the amount of salt in the tank is $$x(50) = 97.188$$ pounds. We can use Sage to easily check the solution of our initial value problem.
t = var('t')
x = function('x')(t)
de = diff(x, t) + 4*x/(50 + t) == 5
solution(t) = desolve(de, x, ics=[0, 5])
solution(50).n(digits = 5)


#### Activity1.5.2.A Mixing Problem.

Suppose that a tank contains 1000 gallons of a solution consisting of 200 pounds of salt dissolved in water. Pure water is pumped into the tank at a rate of 6 gallons per minute. At the same time, the tank is drained at the same rate. Assume that the brine mixture is kept well stirred.
##### (a)
Set up an initial value problem to model the amount of salt in the tank at time $$t\text{.}$$
##### (b)
How long will it take until there is only 20 pounds of salt left in the tank?.

### Subsection1.5.4Finance Models

There are a number of problems in finance that can be modeled using differential equations. Let $$P(t)$$ be the balance of an account at time $$t$$ and suppose that the account pays interest at a rate of $$r$$ percent per year compounded continuously. Suppose that we also allow withdrawals of $$W$$ dollars per year. The net increase in the balance between times $$t$$ and $$t + \Delta t$$ can now be described as
\begin{equation*} P(t + \Delta t) - P(t) \approx r P \Delta t - W \Delta t \end{equation*}
Thus,
\begin{equation*} P'(t) = \lim_{\Delta t \rightarrow 0} \frac{P(t + \Delta t) - P(t) }{\Delta t} = rP - W. \end{equation*}
We can solve the equation
\begin{equation*} P' = rP - W \end{equation*}
by multiplying both sides of the equation by the integrating factor
\begin{equation*} \mu(t) = \exp\left(- \int r \, dt\right) = e^{-rt}. \end{equation*}
to obtain
\begin{equation*} \frac{d}{dt} [e^{-rt} P] = -We^{-rt}. \end{equation*}
Integrating both sides of this equation, we have
\begin{equation*} e^{-rt} P = \frac{W}{r} e^{-rt} + C \end{equation*}
or
\begin{equation*} P = \frac{W}{r} + Ce^{rt}. \end{equation*}
If we know the initial balance in the account, say $$P(0) = P_0\text{,}$$ we can determine $$C\text{.}$$ That is,
\begin{equation*} P_0 = \frac{W}{r} + C \end{equation*}
or
\begin{equation*} C = P_0 - \frac{W}{r}. \end{equation*}
Thus, the solution to our initial value problem is
\begin{equation*} P = \frac{W}{r} + \left( P_0 - \frac{W}{r} \right) e^{rt}. \end{equation*}
Suppose that your parents have established a money market account with a balance of $50,000 that they will use to help you pay for your college education. The account receives an average annual interest of 4%. You estimate that your tuition, room and board, and other college expenses to be$20,000 per year.
We model this financial situation with the differential equation
\begin{align*} \frac{dP}{dt} \amp = 0.04P - 20000\\ P(0) \amp = 50000. \end{align*}
Rewriting the differential equation as $$dP/dt - 0.04P = -20000\text{,}$$ our integrating factor becomes $$\mu(t) = e^{-0.04t}\text{,}$$ and
\begin{equation*} e^{-0.04t} \frac{dP}{dt} -0.04 e^{-0.04t} P= \frac{d}{dt} [e^{-0.04t} P] = -20000e^{-0.04t}. \end{equation*}
Thus,
\begin{equation*} e^{-0.04t} P = \frac{20000}{0.04}e^{-0.04t} + C = 500000e^{-0.04t} + C. \end{equation*}
The solution to this initial value problem is
\begin{equation*} P(t) = \frac{20000}{0.04} + \left( 50000 - \frac{20000}{0.04} \right) e^{0.04t} = 500000 - 450000e^{0.04t}. \end{equation*}
Your parents have been quite generous but have told you that you must be responsible for the balance of the cost of your education.

### Subsection1.5.5Existence and Uniqueness of Solutions

Several questions about the existence and uniqueness of solutions to first-order linear differential equations now arise.
• Does an initial value problem always have a solution?
• Is the solution unique?
• Is the solution globally defined or does it only hold for a small interval?
We can use the following theorem to answer these questions.
If
\begin{equation*} \mu(t) = \exp\left( \int p(t) \, dt \right), \end{equation*}
then
\begin{equation*} \frac{d}{dt}(\mu(t) y) = \mu(t) \left( \frac{dy}{dt} + p(t) y \right) = \mu(t)g(t). \end{equation*}
Integrating both sides of this equation and solving for $$y\text{,}$$ we have
\begin{equation*} y = \frac{1}{\mu(t)} \left( \int \mu(t) g(t) \, dt + C \right). \end{equation*}
Since $$y(t_0) = y_0\text{,}$$ the constant $$C$$ is uniquely determined. Notice that we have used continuity to guarantee that the integrals exist.

### Subsection1.5.6Important Lessons

• Any first-order linear differential equation
\begin{equation*} y' + p(x) y = g(x) \end{equation*}
can be solved by multiplying each side of the equation by an integrating factor
\begin{equation*} \mu(s) = e^{\int p(x) \, dx}. \end{equation*}
In this case, we get
\begin{equation*} \left( e^{P(x)} y \right)' = e^{P(x)} ( y'(x) + p(x) y(x) ) = e^{P(x)} g(x). \end{equation*}
Integrating both sides,
\begin{equation*} e^{P(x)} y = \int e^{P(x)} g(x) \, dx \end{equation*}
or
\begin{equation*} y = \frac{1}{e^{P(x)} } \int e^{P(x)} g(x) \, dx. \end{equation*}
• If
\begin{equation*} y' + p(t) y = g(t) \end{equation*}
is a differential equation such that $$y(t_0) = y_0\text{,}$$ and $$p(t)$$ and $$g(t)$$ are continuous on the open interval $$I = (\alpha, \beta)\text{,}$$ then there exists a unique function $$y = \phi(t)$$ satisfying the differential equation and the initial condition on $$I\text{.}$$

#### 1.

Explain in your own words what a first-order linear differential equation is.

#### 2.

What important rule from differential calculus do we use when solving a first-order differential equation?

### Exercises1.5.8Exercises

#### Finding General Solutions.

Find the general solution for each equation in Exercise Group 1.5.8.1–10.
##### 1.
$$\dfrac{dy}{dx} + 5y = 0$$
##### 2.
$$x' - 7x = 0$$
##### 3.
$$y' + 2xy = 0$$
##### 4.
$$\dfrac{dx}{dt} -t^2 x = 0$$
##### 5.
$$y' + \dfrac{2}{x}y = 0$$
##### 6.
$$\dfrac{dy}{dx} - 5y = e^x$$
##### 7.
$$y' - 5y = 10x$$
##### 8.
$$\dfrac{dx}{dt} - 5x = \sin 2t$$
##### 9.
$$y' - \dfrac{3}{x^2} y = \dfrac{1}{x^2}$$
##### 10.
$$\dfrac{dy}{dx} + \dfrac{2}{x} y = \dfrac{\sin x}{x^2}$$

#### Solving Initial Value Problems.

Solve the initial value problems in Exercise Group 1.5.8.11–20.
##### 11.
$$\dfrac{dy}{dx} + 5y = 0\text{,}$$ $$y(0) = 2$$
##### 12.
$$x' - 7x = 0\text{,}$$ $$x(0) = 1$$
##### 13.
$$y' + 2xy = 0\text{,}$$ $$y(0) = 3$$
##### 14.
$$\dfrac{dx}{dt} -t^2 x = 0\text{,}$$ $$x(0) = -1$$
##### 15.
$$y' + \dfrac{2}{x}y = 0\text{,}$$ $$y(1) = -3$$
##### 16.
$$y' = - \dfrac{2y}{x + 1} + 2x\text{,}$$ $$y(0) = 2$$
Hint.
$$y = \dfrac{3 x^{4} + 8 x^{3} + 6 x^{2} + 12}{6 (x + 1)^2}$$
##### 17.
$$y' = - \dfrac{2y}{1 + x} + e^x\text{,}$$ $$y(0) = 1$$
Hint.
$$y = (e^x + 1)/(x+1)^2$$
##### 18.
$$\dfrac{dx}{dt} - 5x = \sin 2t\text{,}$$ $$x(0) = \pi$$
##### 19.
$$y' = y \tan x + \dfrac{e^x}{\cos x}\text{,}$$ $$y(0) = 1$$
Hint.
$$y = e^x \sec x$$
##### 20.
$$y' = - \dfrac{y}{x + 2} + \dfrac{\cos x}{x + 2}\text{,}$$ $$y(0) = 1$$
Hint.
$$y = \sin x / (x + 2)$$

#### 21.

A 600-liter tank initially contains 200 liters of water containing 10 kilograms of salt. Supposed that water containing 0.1 kilograms of salt flows into the top of the tank at a rate of 10 liters per minute. The water in the tank is kept well mixed, and 5 liters per minute are removed from the bottom of the tank. How much salt is in the tank when the tank is full?
Hint.
If $$x(t)$$ is the amount of salt in the tank at time $$t\text{,}$$ we know that $$x(0) = 10\text{.}$$ The volume of the tank is $$V = 200 + 5t\text{.}$$ We can model the amount of salt in the tank at time $$t$$ with a differential equation,
\begin{align*} \frac{dx}{dt} & = \text{rate in} - \text{rate out}\\ & = 10(0.1) - 5 \frac{x}{V}\\ & = 1 - 5\frac{x}{200+ 5t}\\ & = 1 - \frac{x}{40 + t}. \end{align*}
The resulting equation
\begin{equation*} \frac{dx}{dt} + \frac{1}{40 + t}x = 1 \end{equation*}
is a first order linear differential equation. An integrating factor for this equation is given by
\begin{equation*} \mu(t) = \exp\left(\int \frac{1}{40 + t} \, dt\right) = 40 + t. \end{equation*}
Multiplying both sides of the differential equation by $$\mu(t)\text{,}$$ we have
\begin{equation*} \frac{d}{dt} [(40 + t)x] = (40 + t) \frac{dx}{dt} + x = (40 + t)\left( \frac{dx}{dt} + \frac{1}{40 + t}x \right) = 40 + t. \end{equation*}
Integrating both sides of this equation, we obtain
\begin{equation*} (40 + t)x = 40t + \frac{t^2}{2} + C. \end{equation*}
Using the intial condition $$x(0) = 10\text{,}$$ we can determine that $$C = 400$$ or
\begin{equation*} x(t) = \frac{t^2 + 80t + 800}{2t + 80}. \end{equation*}
The tank is full at time $$t = 400/5 = 80\text{,}$$ and the tank contains $$x(80) = 170/3 \approx 56.67$$ kilograms of salt when the tank is full.

#### 22.

A manager in a communications company contributes $2400 per year into her retirement fund by making many small deposits throughout the year. The fund grows at a rate of 3.5% per year compounded continuously. After 35 years, she retires and begins and begins withdrawing from the retirement fund at a rate of$3500 per month. If she does not make any deposits after she retires, how long will her retirement fund last? [Hint: Divide the problem into two smaller problems—one that deals with the situation before retirement and one that deals with the problem after retirement.]

#### 23.

Lake Baikal, located in southern Siberia, is only the seventh largest lake in the world in terms of surface area; however, it is the world's deepest lake. The lake has a depth of 1,642 meters, and the bottom lies 1,186.5 meters below sea level. Lake Baikal has a volume of 23,600 cubic kilometers and contains 20% of the world's unfrozen fresh water. In contrast, Lake Superior, the largest of the Great Lakes, has a volume of only 12,100 cubic kilometers. Although 544 rivers flow into Lake Baikal, there is only a single outlet, the Angara River. The outflow of the lake is pretty constant at 60.4 cubic kilometers per year.
Pollution is an increasing concern in Lake Baikal. One of the major polluters has been Baykalsk Pulp and Paper Mill. The mill was constructed in 1966 on the shoreline of Lake Baikal and regularly discharged waste into the lake. The plant was closed in November 2008 due to unprofitability, but production resumed in January 2010. The mill underwent a final bankruptcy in September 2013, but the longterm fate of the mill is still undecided. 1
Suppose that we wish to understand how the pollution level changes in Lake Baikal over a period of years. Hypothetically, let us assume that the Baykalsk Pulp and Paper Mill has been responsible for most of the pollution in Lake Baikal for the last several decades. Suppose that at $$t = 0$$ years the mill ceases operation and there are no longer any pollutants discharged into the lake from the mill although there are still other sources of pollution. Let us assume that the lake is currently 6 times more polluted than these other sources of contaminants. We wish to know how long it will take for the pollution level to reduce to half of its current level of lake. Lake Baikal's waters are well-mixed and well-oxygenated in spite of its great depth, so we can model this situation as a simple mixing problem.
1. The volume of water in Lake Baikal is $$V = 23,600 \text{ km}^3\text{,}$$ and
\begin{equation*} r_{\text{in}} = r_{\text{out}} = r = 60 \text{ km}^3/\text{year} \end{equation*}
be the rates of inflow from the numerous rivers that feed the lake and outflow to the Angara River. Assume that $$C = C_{\text{in}}$$ is the pollutant concentration flowing into Lake Baikal and $$C_{\text{out}}$$ is the concentration of the outflow into the Angara River (measured in metric tons per cubic km). If $$x(t)$$ is the amount of solute at time $$t$$ in Lake Baikal, then
\begin{equation*} x_0 = x(0) = 6CV \end{equation*}
is the initial amount of solute in the lake. Estimate $$\Delta x$$ during the time interval $$[t, t + \Delta t]\text{,}$$ where $$\Delta t > 0$$ is small.
2. From your estimate of $$\Delta x$$ in part (1), write an initial value problem that describes the amount of pollutants in the lake at time $$t\text{.}$$
3. The equation that you found in part (2) is a first-order linear equation. Solve this equation.
4. Using part (3), predict how many years it will take to reduce the pollution in Lake Baikal to half of its current level.

#### 24.

Variation of Parameters. Consider the following method of solving the general linear equation of the first order,
$$y' + p(t)y = g(t).\tag{1.5.8}$$
1. If $$g(t)$$ is identically zero, show that the solution is
\begin{equation*} y = A \exp\left[ - \int p(t) \, dt \right], \end{equation*}
where $$A$$ is a constant.
2. If $$g(t)$$ is not identically zero, assume that the solution is of the form
$$y = A(t) \exp\left[ - \int p(t) \, dt \right],\tag{1.5.9}$$
where $$A$$ is now a function of $$t\text{.}$$ By substituting for $$y$$ in the given differential equation (1.5.8), show that $$A(t)$$ must satisfy the condition
$$A'(t) = g(t) \exp\left[ \int p(t) \, dt \right].\tag{1.5.10}$$
3. Find $$A(t)$$ from Equation (1.5.10). Then substitute for $$A(t)$$ in equation (1.5.9) and determine $$y\text{.}$$ Verify that the solution obtain in this manner agrees with the solution given in the proof of Theorem Theorem 1.5.7. That is, show that this solution is equivalent to the solution
\begin{equation*} y = \frac{1}{\mu(t)} \left( \int \mu(t) g(t) \, dt + C \right), \end{equation*}
where
\begin{equation*} \mu(t) = \exp\left( \int p(t) \, dt \right). \end{equation*}
This technique is know as variation of parameters, which we will revisit when we study second order linear differential equations.

#### 25.

Bernoulli's equation is an equation of the form
\begin{equation*} y' = a(t) y + f(t) y^n, \end{equation*}
where $$n \neq 0$$ or 1. Bernoulli's equation is nonlinear and cannot be solved by the techniques that we have used to solve first order linear equations. 2
1. Using the substitution $$z = y^{1- n}\text{,}$$ show that we can transform Bernoulli's equation into the linear equation
\begin{equation*} z' = (1 -n )a(t) z + (1-n) f(t). \end{equation*}
2. Solve the equation $$xy' + y = x^4y^3\text{.}$$

#### 26.

The first-order nonlinear differential equation
$$y' = p(t) + q(t) y + r(t) y^2\tag{1.5.11}$$
is known as the Ricatti equation and has some useful applications in control theory. If one solution $$y_1(t)$$ of the Ricatti equation is known, then a more general solution containing an arbitrary constant can be found by substituting $$y = y_1(t) + 1/v(t)$$ into equation (1.5.11) to find a first-order linear equation in $$v$$ and $$t\text{,}$$ which we can solve to find a general solution to the Ricatti equation.
1. Show that this first-order linear equation is $$v' + [q(t) + 2 r(t) y_1(t)]v = - r(t)\text{.}$$
2. Find the solution to the Ricatti equation
\begin{equation*} y' = - \frac{1}{t^2} - \frac{1}{t} y + y^2 \end{equation*}
given the particular solution $$y_1 = 1/t\text{.}$$
3. Find the solution to the Ricatti equation
\begin{equation*} y' = \cos t - y \tan t + y^2 \sec t \end{equation*}
given the particular solution $$y_1 = \sin t\text{.}$$
4. Find the solution to the Ricatti equation
\begin{equation*} y' = 2 - 3y + y^2 \end{equation*}
given the particular solution $$y_1 \equiv 2\text{.}$$
Hint.
1. If $$y = y_1 + 1/v\text{,}$$ then $$y' = y_1' - v'/v^2\text{.}$$ Substituting into our original equation, we obtain
\begin{equation*} y' = y_1' - \frac{v'}{v^2} = p + q y_1 + r y_1^2 - \frac{v'}{v^2}. \end{equation*}
On the other hand,
\begin{align*} y' & = p + q \left(y_1 + \frac{1}{v} \right) + r \left(y_1 + \frac{1}{v} \right)^2\\ & = p + q y_1 + \frac{q}{v} + r y_1^2 + \frac{2r y_1}{v} + \frac{r}{v^2}\\ & = y_1' + \frac{q}{v} + \frac{2r y_1}{v} + \frac{r}{v^2}. \end{align*}
Therefore,
\begin{equation*} - \frac{v'}{v^2} = \frac{q}{v} + \frac{2r y_1}{v} + \frac{r}{v^2}, \end{equation*}
which is just the first-order linear equation
\begin{equation*} v' + [q(t) + 2 r(t) y_1(t)]v = - r(t). \end{equation*}
2. \begin{equation*} y = t + \frac{1}{C - t} \end{equation*}
3. \begin{equation*} y(t) = \frac{1}{C \cos t - \sin t} + \sin t \end{equation*}
4. \begin{equation*} y(t) = 2 + \frac{1}{C e^t - 1} \end{equation*}

#### 27.

Suppose that we have a population that not only grows logistically but also requires a minimum threshold population to survive. For example, the case of the North Pacific right whale, a species now very much on the endangered list. If the population drops too low, whales might not be able to find suitable mates and the species will eventually go extinct. In other words, the population will die out if it drops below a certain threshold. We can model this with the following equation,
$$\frac{dP}{dt} = k\left(1 - \frac{P}{N} \right) (P - aN),\tag{1.5.12}$$
where $$P$$ is the population of the whales at time $$t$$ and $$N$$ is the carrying capacity. The constants $$k$$ and $$a$$ are positive with $$a \lt 1\text{.}$$
1. Find the equilibrium solutions of the this equation.
2. Since equation (1.5.12) is autonomous, we can find a solution using separation of variables. Find this solution.
3. Equation (1.5.12) is also a Ricatti equation (1.5.11). Since we know an equilibrium solution from part (1), we can use the method of the previous problem to find a general solution to (1.5.12). Find the general solution using the fact that we have a Ricatti equation and show that your solution agrees with the solution that you found in part (2).
Levy, Clifford J. (November 8, 2010). “Last Gasp for Factory Bequeathed by Soviets.” The New York Times. Retrieved March 14, 2014 from www.nytimes.com/2010/11/09/world/europe/09baikal.html.