# The Ordinary Differential Equations Project

## Section1.2Separable Differential Equations

We will define a differential equation of order $$n$$ to be an equation that can be put in the form
\begin{equation*} F(t, x, x', x'', \ldots, x^{(n)}) = 0, \end{equation*}
where $$F$$ is a function of $$n + 2$$ variables. A solution to this equation on an interval $$I = (a, b)$$ is a function $$u = u(t)$$ such that the first $$n$$ derivatives of $$u$$ are defined on $$I\text{,}$$ and
\begin{equation*} F(t, u, u', u'', \ldots, u^{(n)}) = 0. \end{equation*}
We will concentrate on first-order differential equations in this chapter. That is, we will only consider equations of the form
\begin{equation*} \frac{dx}{dt} = f(t, x). \end{equation*}

### Subsection1.2.1Separable Differential Equations

In general, we cannot find such a formula for an arbitrary first-order differential equation. We can, however, solve a differential equation $$y' = f(x, y)$$ if we can write the equation in the form
\begin{equation*} f(x) + g(y) \frac{dy}{dx} = 0 \quad \text{or} \quad \frac{dy}{dx} =M(x) N(y). \end{equation*}
Such equations are called separable. We can solve separable equations by integrating the first term with respect to $$x$$ and the second term with respect to $$y\text{.}$$ Notice that we have used the variables $$x$$ and $$y$$ in place of $$t$$ and $$x\text{.}$$ This really is of no consequence as long as we are careful to keep track of the dependent and independent variables in the differential equation.

#### Example1.2.1.

Suppose that we wish to solve the initial value problem
\begin{align*} \frac{dy}{dx} & = xy\\ y(0) & = 1. \end{align*}
We can rewrite this equation in the form
\begin{equation*} \frac{1}{y} \frac{dy}{dx} = x \end{equation*}
or in the alternate form
\begin{equation*} \frac{1}{y} \, dy = x \, dx. \end{equation*}
Integrating both sides of the equation, we have
\begin{equation*} \ln |y| = \frac{1}{2} x^2 + C, \end{equation*}
where $$C$$ is an arbitrary constant. Using the initial condition, $$y(0) = 1$$ to find $$C\text{,}$$ we see that
\begin{equation*} 0 = \ln|1| = 0 + C. \end{equation*}
Thus, the solution to our initial value problem can be given implicitly by $$\ln y = x^2/2\text{.}$$ In this example, we can actually write down an explicit solution that is defined everywhere,
\begin{equation*} y = e^{x^2/2}. \end{equation*}
The Sage commands for solving our initial value problem are below.
x = var('x') #declare x as a variable
y = function('y')(x) #declare y as a function of x
de = diff(y, x) == x*y #write the differential equation
solution = desolve(de, y, ics=[0, 1]) #find the solution
solution

If we ask Sage to solve a differential equation that it cannot solve analytically, the computation will return an error. Sage will not solve the initial value problem
\begin{align*} \frac{dy}{dx} & = \sin(xy)\\ y(0) & = 1. \end{align*}
x = var('x')
y = function('y')(x)
de = diff(y, x) == sin(x*y)
solution = desolve(de, y, ics=[0, 1])
solution


#### Example1.2.2.

Consider the initial value problem
\begin{align*} \frac{dy}{dt} & = \frac{t}{y - t^2y}\\ y(0) & = 4. \end{align*}
First, we separate the variables of the equations and write
\begin{equation*} y \, dy = \frac{t}{1 - t^2} \, dt. \end{equation*}
Integrating both sides of the equation, we have
\begin{equation*} \frac{1}{2} y^2 = - \frac{1}{2} \ln|1 - t^2| + C \qquad \text{or} \qquad y^2 = - \ln|1 - t^2| + C. \end{equation*}
Using the initial condition, $$y(0) = 4\text{,}$$ we can determine the value of $$C\text{,}$$
\begin{equation*} y^2 = 16 - \ln|1 - t^2| \qquad \text{or} \qquad y = \sqrt{16 - \ln|1 - t^2| }. \end{equation*}
Notice that the solution does not make sense for all values of $$t\text{.}$$ In fact, the solution is only defined on the interval $$-1 \lt t \lt 1\text{,}$$ if we require that our solution be continuous. Let us see what Sage has to say.
t = var('t')
y = function('y')(t)
de = diff(y, t) == t/(y - t^2*y)
solution = desolve(de, y, ics=[0, 4])
solution

Sage does return a solution even if it looks a bit different than the one that we arrived at above. Notice that we have an imaginary term in our solution, where $$i^2 = -1\text{.}$$ We will examine the role of complex numbers and how useful they are in the study of ordinary differential equations in a later chapter, but for the moment complex numbers will just muddy the situation.

#### Example1.2.3.

The initial value problem in Example 1.1.2 is a good example of a separable differential equation,
\begin{align*} \frac{dP}{dt} & = k \left( 1 - \frac{P}{1000} \right) P\\ P(0) & = 100. \end{align*}
Using partial fractions, we can rewrite this equation as
\begin{equation} \frac{1000}{P(1000 - P)} \, dP = \left( \frac{1}{P} + \frac{1}{1000-P}\right) \, dP = k \, dt.\tag{1.2.1} \end{equation}
Integrating both sides of (1.2.1), we obtain
\begin{equation*} \ln|P| - \ln|1000 - P| = \ln \left|\frac{P}{1000 - P}\right| = kt + C. \end{equation*}
Taking the exponential of both sides yields
\begin{equation*} \frac{P}{1000 - P} = e^{kt + C} = e^{kt} e^C. \end{equation*}
Since $$C$$ is an arbitrary constant, we know that $$e^C$$ is an arbitrary positive constant, which we will also call $$C\text{.}$$ So we can rewrite this last equation as
\begin{equation*} P = Ce^{kt} (1000 - P) = 1000 Ce^{kt} - Ce^{kt}P. \end{equation*}
Solving for $$P$$ yields
\begin{equation*} P = \frac{1000Ce^{kt}}{Ce^{kt} + 1} = \frac{1000}{Ce^{-kt} + 1}. \end{equation*}
Using our initial condition $$P(0) = 100\text{,}$$ we can determine that $$C = 9\text{.}$$

#### Activity1.2.1.Solving Separable Differential Equations.

Solve each of the following differential equations using the separation of variables technique.
##### (a)
$$dy/dx = y/x$$
##### (b)
$$(x^2 + 1)y' = xy$$
##### (c)
$$dx/dt = e^x \sqrt{t}$$
##### (d)
$$\dfrac{dx}{dt} = \dfrac{\sec^2 t + 2t}{2x}\text{,}$$ $$x(0) = -2$$
##### (e)
$$dy/dx = \sqrt{xy}\text{,}$$ $$y(1) = 3$$

### Subsection1.2.2Newton’s Law of Cooling

Separable equations arise in a wide range of application problems. One does not have to watch too many crime dramas to realize that the time of death of a murder victim is an important question in many criminal investigations. How does a forensic scientist or a medical examiner determine the time of death? Human beings have a temperature of $$98.6^\circ$$F. If the surrounding temperature is cooler, then the body will cool down after death. Eventually, the temperature of the body will match the temperature of the environment. We should not expect the body to cool at a constant rate either. Think of how a hot cup of coffee or tea cools. The liquid will cool quite quickly during the first few minutes but will remain relatively warm for quite a long period.
The answer to our forensic question can be found by using Newton’s law of cooling, which tells us that the rate of change of the temperature of an object is proportional to the difference between the temperature of the object and the temperature of the surrounding medium. Newton’s law of cooling can be easily stated as a differential equation,
\begin{equation*} \frac{dT}{dt} = k(T - T_m), \end{equation*}
where $$T$$ is the temperature of the object, $$T_m$$ is the temperature of the surrounding medium, and $$k$$ is the proportionality constant.
Suppose that the temperature of the surrounding environment is $$70^\circ$$F, and we know from experience that a body under these conditions cools off approximately $$2^\circ$$F during the first hour after death. In order to determine a formula for the time of death, we must solve the initial value problem
\begin{align*} \frac{dT}{dt} & = k(T - 70)\\ T(0) & = 98.6, \end{align*}
where $$T(1) = 96.6\text{.}$$ If we rewrite the equation
\begin{equation*} \frac{dT}{dt} = k(T - 70) \end{equation*}
as
\begin{equation*} \frac{1}{T - 70} \frac{dT}{dt} = k, \end{equation*}
we see that this equation is separable. Integrating both sides of the last equation, we obtain $$\ln | T - 70| = kt + C\text{.}$$ Since we are assuming that $$T \gt 70\text{,}$$ we can write $$T - 70$$ instead of $$|T - 70|\text{.}$$ Thus, we have
\begin{equation*} \ln( T- 70) = kt + C \qquad \text{or} \qquad T - 70 = e^{kt + C} = e^{kt}e^C. \end{equation*}
Letting $$D = e^C\text{,}$$ the solution becomes
\begin{equation*} T(t) = D e^{kt} + 70. \end{equation*}
The initial condition, $$T(0) = 98.6\text{,}$$ tells us that $$D = 28.6\text{.}$$ Thus,
\begin{equation*} T(t) = 28.6 e^{kt} + 70. \end{equation*}
Since
\begin{equation*} 96.6 = T(1) =28.6 e^{k \cdot 1} + 70, \end{equation*}
we can determine the constant $$k$$ to be
\begin{equation*} k = \ln\left( \frac{26.6}{28.6} \right) \approx -0.0725. \end{equation*}
and
\begin{equation*} T(t) =28.6 e^{-0.0725 t} + 70. \end{equation*}
The graph of the $$T$$ seems appropriate to our model (Figure 1.2.4).
Let us solve our differential equation using Sage.
k,t = var('k,t')
T = function('T')(t)
de = diff(T,t) == k*(T - 70)
solution = desolve(de, T, ivar=t)
solution.show()

We can use Sage to plot our solution.
t = var('t')
T(t) = 28.6 * exp(-0.0725 * t) + 70
plot(T, (t, 0, 24))


#### Activity1.2.2.Coffee Temperature.

The brewing temperature of the water used is very important. It should be between $$195^\circ$$F and $$205^\circ$$F. The closer to $$205^\circ$$F the better. Boiling water ($$212^\circ$$F) should never be used, as it will burn the coffee. Water that is less than $$195^\circ$$F will not extract properly. On the other hand, coffee that has a temperature of $$205^\circ$$F is too hot to drink. 1  Coffee is best when it is served at a temperature of $$140^\circ$$F to $$155^\circ$$F (the Goldilocks range).
##### (a)
Suppose coffee is initially brewed at $$205^\circ$$F. If room temperature is $$70^\circ$$F, set up an initial value problem to model the temperature of the coffee at time $$t\text{,}$$ where $$t$$ is the time in minutes after brewing has finished.
##### (b)
Solve the initial value problem from Task 1.2.2.a
##### (c)
If the temperature of the coffee drops from $$205^\circ$$F to $$200^\circ$$F in the first two minutes after brewing, how long before the coffee reaches a temperature of $$155^\circ$$F?

### Subsection1.2.3Mixing Problems

There is a large class of problems in modeling known as mixing problems. These problems refer to situations where two or more substances are mixed together in a container or containers. For example, we might wish to model how chemicals are mixed together in a refinery, how pollutants are mixed together in a pond or a lake, how ingredients are mixed together when brewing beer, or even how various greenhouse gases mix together across different layers of the atmosphere.

#### Example1.2.5.

Suppose that we have a large tank containing 1000 gallons of pure water and that water containing 0.5 pounds of salt per gallon flows into the tank at a rate of 10 gallons per minute. If the tank is also draining at a rate of 10 gallons per minute, the water level in the tank will remain constant. We will assume that the water in the tank is constantly stirred so that the mixture of salt and water is uniform in the tank.
We can model the amount of salt in the tank using differential equations. If $$x(t)$$ is the amount of salt in the tank at time $$t\text{,}$$ then the rate at which the salt is changing in the tank is the difference between the rate at which salt is flowing into the tank and the rate at which it is leaving the tank, or
\begin{equation} \frac{dx}{dt} = \text{rate in} - \text{rate out}.\tag{1.2.2} \end{equation}
Of course, the salt flows into the tank at the rate of $$10 \cdot 0.5 = 5$$ pounds of salt per minute. However, the rate at which the salt leaves the tank depends on $$x(t)\text{,}$$ the amount salt in the tank at time $$t\text{.}$$ At time $$t\text{,}$$ there is $$x(t)/1000$$ pounds of salt in one gallon. Therefore, salt flows out of the tank at a rate of $$10x(t)/1000 = x(t)/100$$ pounds per minute. Equation (1.2.2) now becomes
\begin{align*} \frac{dx}{dt} \amp = 5 - \frac{x}{100}\\ x(0) \amp = 0. \end{align*}
This equation is separable,
\begin{equation*} \frac{dx}{500 - x} = \frac{dt}{100}. \end{equation*}
Integrating both sides of the equation, we have
\begin{equation*} -\ln|500 - x| = \frac{t}{100} + k \end{equation*}
or
\begin{equation*} \ln|500 - x| = - \frac{t}{100} - k. \end{equation*}
Consequently,
\begin{equation*} 500 - x = C e^{-0.01t}, \end{equation*}
where $$C = e^{-k}\text{.}$$ From our initial condition, we can quickly determine that $$C = 500$$ and
\begin{equation*} x(t) = 500 - 500 e^{-0.01t} \end{equation*}
models the amount of salt in the tank at time $$t\text{.}$$ Notice that $$x(t)\to 500$$ as $$t \to \infty\text{,}$$ as expected.

#### Activity1.2.3.A Brewery Problem.

The vast majority of beers from around the world have alcohol contents of 4 to 6 percent alcohol by volume (for example, Heineken Lager Beer has a 5 percent alcohol content). Suppose a local brewery has produced two beers with different alcohol contents, one 4 percent and one 7 percent. The master brewer would like to add some of the 7 percent beer to the 4 percent beer to obtain a beer with 5 percent alcohol.
##### (a)
A vat contains 500 gallons of 4% alcohol (by volume). Beer with 7% alcohol is pumped into the tank at a rate of 5 gallons per minute. Beer is also pumped out of the vat at a rate of 5 gallons per minute, so there is always 500 gallons in the tank. Set up an initial value problem to model the percentage of alcohol in the vat at time $$t\text{,}$$ where $$t$$ is the elapsed time in minutes.
##### (b)
Solve the initial value problem from Task 1.2.3.a
##### (c)
What is the percentage of alcohol in the vat after one hour?
##### (d)
At what time will the beer reach 5% alcohol?

### Subsection1.2.4A Retirement Model

Differential equations have many applications in economics and finance. For example, Dr. J., a college professor, wisely started saving for his retirement as soon as he entered the workforce, and he now has 500,000 in a retirement account earning an interest of 5% compounded continuously. The initial value problem, \begin{align*} \frac{dP}{dt} \amp = 0.05 P\\ P(0) \amp = 500 \end{align*} provides a nice model of Dr. J.’s investment, where $$P(t)$$ is the amount in thousands of dollars in the fund at time $$t\text{.}$$ The solution to our initial value problem is \begin{equation*} P(t) = 500e^{0.05t}. \end{equation*} If Dr. J. plans to retire in 10 years, he can expect a nest egg of $$P(10) \approx 824.360635350064$$ or about824,360.
Of course, Dr. J. still plans to make contributions to his retirement fund during his next ten years of employment. His annual contribution will be 5,000, which his employer will generously match. If we assume that these contributions will spread out evenly over the course of the year, we can incorporate this information into our original initial value problem, \begin{align*} \frac{dP}{dt} \amp = 0.05 P + 10\\ P(0) \amp = 500 \end{align*} This differential equation is separable, so we have \begin{equation*} \int \frac{dP}{0.05P + 10} = \int dt. \end{equation*} Integrating both sides of this equation, we have \begin{equation*} 20\ln|0.05P + 10| = t + k, \end{equation*} where $$k$$ is an arbitrary constant. Since $$0.05P + 10 \gt 0\text{,}$$ we have \begin{equation*} 20\ln(0.05P + 10) = t + k. \end{equation*} This last equation is equivalent to \begin{equation*} 0.05P + 10 = e^{0.05(t + k)} = e^{0.05t} e^{0.05k}. \end{equation*} If we let $$C = e^{0.05k}$$ and solve for $$P\text{,}$$ we obtain \begin{equation*} P = 20 C e^{0.05t} - 200. \end{equation*} Using our initial condition, \begin{equation*} 500 = P(0) = 20 C e^{0.05 \cdot 0} - 200 = 20 C - 200, \end{equation*} we have $$C = 35\text{.}$$ Thus, the solution that we seek is \begin{equation*} P(t) = 700e^{0.05t} - 200. \end{equation*} Dr. J.’s nest egg is now $$P(10) \approx 954.104889490090$$ or about954,105.
Once Dr. J. retires, he will need to begin withdrawing money from his account. He estimates that he will need to withdraw 60,000 a year for living expenses if he wishes to travel and enjoy his golden years. Of course, whatever remains in his account at any given time will still collect interest. We describe J.’s retirement situation with the initial value problem, \begin{align*} \frac{dP}{dt} \amp = \begin{cases} 0.05 P + 10, \amp t \leq 10 \\ 0.05 P - 60, \amp t \gt 10 \end{cases}\\ P(0) \amp = 500. \end{align*} If $$P = 954\text{,}$$ then \begin{equation*} \frac{dP}{dt} = 0.05 P - 60 \approx -12.3 \lt 0. \end{equation*} Hence, the rate of withdrawal exceeds the rate at which Dr. J.’s account is earning interest. Eventually, Dr. J.’s retirement fund will disappear. This may pose a problem, if Dr. J. plans to retire early and live a long life. Again, the differential equation $$dP/dt = 0.05 P - 60$$ is separable, and we have \begin{equation*} \int \frac{dP}{0.05P - 60} = \int dt. \end{equation*} Intergrating both sides of this equation yields \begin{equation*} 20\ln|0.05P - 60| = t + k. \end{equation*} Since $$0.05 P - 60 \lt 0\text{,}$$ \begin{equation*} |0.05P - 60| = 60 - 0.05P, \end{equation*} and \begin{equation*} 20\ln(60 - 0.05P) = t + k. \end{equation*} Consequently, \begin{equation*} 60 - 0.05P = e^{(t + k)/20}, \end{equation*} or \begin{equation*} P = 1200 - C e^{0.05t}, \end{equation*} where $$C = 20e^{k/20}\text{.}$$ Now, we can apply our initial condition $$P(10) = 954$$ to determine that $$C \approx 149.21\text{.}$$ Therefore, \begin{equation*} P = 1200 - 149.21 e^{0.05t} \end{equation*} describes how much money Dr. J.has after he retires ($$t \geq 10$$). If Dr. J. wants to know how long his retirement fund will last, he must solve the equation \begin{equation*} 1200 - 149.21 e^{0.05t} = 0. \end{equation*} In this case, \begin{equation*} t = 20 \ln\left( \frac{1200}{149.21} \right) \approx 41.7. \end{equation*} This means that if Dr. J. retires in 10 years at the early age of 55, he can expect his retirement to last into his mid 90s. ### Subsection1.2.5Some Theory We now give a theoretical basis for solving first-order separable differential equations. A differential equation $$y' = F(x, y)$$ is called separable if it can be written in the form \begin{equation} f(x) + g(y) \frac{dy}{dx} = 0.\tag{1.2.3} \end{equation} We now will prove that such an equation can be solved by integrating each term. If \begin{align*} h_1(s) & = \int f(s) \, ds\\ h_2(s) & = \int g(s) \, ds, \end{align*} then we can rewrite equation (1.2.3) as \begin{equation*} h_1'(x) + h_2'(y) \frac{dy}{dx} = 0. \end{equation*} Applying the chain rule to the second term, we obtain \begin{equation*} h_2'(y) \frac{dy}{dx} = \frac{d}{dx} [ h_2(y)]. \end{equation*} Hence, equation (1.2.3) now becomes \begin{equation*} \frac{d}{dx} (h_1(x) + h_2(y)) = 0. \end{equation*} Integrating, we obtain \begin{equation*} h_1(x) + h_2(y) = C, \end{equation*} where $$C$$ is any arbitrary constant. Now suppose that $$y(x_0) = y_0$$ is an initial condition for \begin{equation*} f(x) + g(y) \frac{dy}{dx} = 0. \end{equation*} Then $$h_1(x_0) + h_2(y_0) = C\text{.}$$ By the Fundamental Theorem of Calculus \begin{align*} h_1(x) - h_1(x_0) & = \int_{x_0}^x f(s) \; ds,\\ h_2(y) - h_2(y_0) & = \int_{y_0}^y g(s) \; ds. \end{align*} Consequently, we can replace equation (1.2.3) with the integral equation \begin{equation*} \int_{x_0}^x f(s) \; ds + \int_{y_0}^y g(s) \, ds = 0. \end{equation*} In other words, we simply need to integrate each term to solve the differential equation. ### Subsection1.2.6What Can Go Wrong #### Example1.2.6. It is not always possible to explicitly solve a separable differential equation. Consider the equation \begin{equation*} \frac{dy}{dx} = \frac{y(1 + y^2)}{y^2 + y + 1}. \end{equation*} This equation can be rewritten in the form \begin{equation*} \left( \frac{1}{1+ y^2} + \frac{1}{y} \right) \, dy = dx \end{equation*} Integrating both sides of the equation, we have \begin{equation*} \arctan y + \ln|y| = x + C. \end{equation*} However, we have no method of solving this last equation explicitly for $$y\text{.}$$ #### Example1.2.7. Another difficulty arises if we consider the equation \begin{equation*} y' = t e^{-y^2}. \end{equation*} This equation is separable since we can rewrite it in the form \begin{equation*} e^{y^2} \, dy = t \, dt. \end{equation*} Although the Fundamental Theorem of Calculus guarantees that every continuous function has an antiderivative, we cannot find an antiderivative for the function $$e^{y^2}$$ in terms of elementary functions. Thus, we are forced to write our solution as \begin{equation*} \int_0^y e^{s^2} \, ds = \frac{1}{2} t^2 + C. \end{equation*} #### Example1.2.8. Even if we have a separable differential equation, we are not guaranteed a unique solution. Consider the initial value problem $$y' = y^{1/3}$$ with $$y(0) = 0$$ and $$t \geq 0\text{.}$$ Separating the variables, \begin{equation*} y^{-1/3} \, dy = dt. \end{equation*} Thus, \begin{equation*} \frac{3}{2} y^{2/3} = t + C \end{equation*} or \begin{equation*} y = \left( \frac{2}{3} ( t + C)\right)^{3/2}. \end{equation*} If $$C = 0\text{,}$$ the initial condition is satisfied and \begin{equation*} y = \left( \frac{2}{3} t \right)^{3/2} \end{equation*} is a solution for $$t \geq 0\text{.}$$ However, we can find at least two additional solutions for $$t \geq 0\text{:}$$ \begin{align*} y & = - \left( \frac{2}{3} t \right)^{3/2},\\ y & \equiv 0. \end{align*} In Section 1.5 we will learn sufficient conditions for a first-order initial value problem to have a unique solution. #### Example1.2.9. Suppose that $$y' = y^2$$ with $$y(0) = 1\text{.}$$ Separating the variables, \begin{equation*} \frac{1}{y^2} \, dy = dt, \end{equation*} we see that \begin{equation*} y = - \frac{1}{t + C} \end{equation*} or \begin{equation*} y = \frac{1}{1-t}. \end{equation*} Therefore, a continuous solution also exists on $$(-\infty, 1)$$ if $$y(0) = 1\text{.}$$ In the case that $$y(0) = -1\text{,}$$ the solution is \begin{equation*} y = - \frac{1}{t + 1}, \end{equation*} and a continuous solution exists on $$(-1, \infty)\text{.}$$ ### Subsection1.2.7Important Lessons • A differential equation of order $$n$$ is an equation that can be put in the form \begin{equation*} F(t, x, x', x'', \ldots, x^{(n)}) = 0, \end{equation*} where $$F$$ is a function of $$n + 2$$ variables. A solution to the equation on an interval $$I = (a, b)$$ is a function $$u = u(t)$$ such that the first $$n$$ derivatives of $$u$$ are defined on $$I\text{,}$$ and \begin{equation*} F(t, u, u', u'', \ldots, u^{(n)}) = 0. \end{equation*} • In Chapter 1, we study first-order differential equations that can be written in the form \begin{equation*} \frac{dx}{dt} = f(t, x). \end{equation*} • A differential equation is separable if it can be written in the form \begin{equation*} \frac{dy}{dx} =M(x) N(y). \end{equation*} In this case we can rewrite the equation in the form \begin{equation*} f(x) + g(y)\frac{dy}{dx} = 0 \end{equation*} or \begin{equation*} g(y) \, dy = f(x) \, dx \end{equation*} and solve by integrating both sides. ### Reading Questions1.2.8Reading Questions #### 1. Does a differential equation always have a solution? Explain. #### 2. Is the differential equation \begin{equation*} \frac{dy}{dt} = y^2 + t^2 \end{equation*} separable? Why or why not? ### Exercises1.2.9Exercises #### 1.Baking a Potato (Part 2). Solve the differential equation that you used to model the temperature of a baked potato in Exercise 1.1.9.1. #### Finding General Solutions. Find the general solution for each equation in Exercise Group 1.2.9.2–11. ##### 2. $$x \, dx - y^2 \, dy = 0$$ ##### 3. $$\dfrac{dy}{dx} = \dfrac{y}{x}$$ ##### 4. $$(t^2 + 1) \, dt + (x^2 + x) \, dx = 0$$ ##### 5. $$\dfrac{dx}{dt} = x^2 - 6x + 14$$ ##### 6. $$y' = \dfrac{x^2}{y(2 + x^3)}$$ ##### 7. $$\dfrac{dy}{dx} = \dfrac{\sin x}{y}$$ ##### 8. $$xy' = \sqrt{1 - y^2}$$ ##### 9. $$\dfrac{dy}{dt} = \dfrac{4t - t^3}{4 + y^3}$$ ##### 10. $$y' = \dfrac{1}{ty + 2t + y + 2}$$ ##### 11. $$\dfrac{dx}{dt} = xe^t + 3e^t + x + 3$$ #### Solving Initial Value Problems. Solve the initial value problems in Exercise Group 1.2.9.12–21. ##### 12. $$x \, dx - y^2 \, dy = 0\text{,}$$ $$y(0) = 1$$ ##### 13. $$\dfrac{dy}{dx} = \dfrac{y}{x}\text{,}$$ $$y(1) = -2$$ ##### 14. $$(t^2 + 1) \, dt + (x^2 + x) \, dx = 0\text{,}$$ $$x(0) = -1$$ ##### 15. $$\dfrac{dx}{dt} = x^2 - 6x + 14\text{,}$$ $$x(0) = 3$$ ##### 16. $$y' = \dfrac{x^2}{y(2 + x^3)}\text{,}$$ $$y(0) = -2$$ ##### 17. $$\dfrac{dy}{dx} = \dfrac{\sin x}{y}\text{,}$$ $$y(0) = 2$$ ##### 18. $$xy' = \sqrt{1 - y^2}\text{,}$$ $$y(1) = 0$$ ##### 19. $$\dfrac{dy}{dt} = \dfrac{4t - t^3}{4 + y^3}\text{,}$$ $$y(0) = 1$$ ##### 20. $$y' = \dfrac{1}{ty + 2t + y + 2}\text{,}$$ $$y(0) = -3$$ ##### 21. $$\dfrac{dx}{dt} = xe^t + 3e^t + x + 3\text{,}$$ $$x(0) = 0$$ #### 23. Homogeneous Equations. A first-order differential equation, $$y' = f(x, y)\text{,}$$ is homogeneous if $$f(x, y) = f(tx, ty)\text{.}$$ 1. Show that the equation \begin{equation*} \frac{dy}{dx} = \frac{x^2 + y^2}{2xy} \end{equation*} is homogeneous. 2. Let $$y = xv$$ and show that the equation in part (a) can be written as \begin{equation*} v + x\frac{dv}{dx} = \frac{x^2 + v^2 x^2}{2v x^2}. \end{equation*} Use the fact that this new equation is separable to solve for $$y\text{.}$$ 3. Show that any homogeneous equation $$y' = f(x, y)$$ can be transformed into a separable differential equation by making the substitution $$y = vx\text{.}$$ 4. A function $$f$$ is said to homogeneous of degree $$n$$ if $$f(t x, t y)= t^n f(x, y)$$ for $$n = 1, 2, \ldots\text{.}$$ Show that differential equation \begin{equation*} P(x, y) dx + Q(x, y) dy = 0, \end{equation*} where $$P$$ and $$Q$$ are both homogeneous of degree $$n\text{,}$$ can be transformed into a separable differential equation using the substitution $$y = vx\text{.}$$ 5. Solve the differential equation \begin{equation*} x^2 y' = 2 y^2 - x^2. \end{equation*} #### 24. Mr. Ratchett, an elderly American, was found murdered in his train compartment on the Orient Express at 7 AM. When his body was discovered, the famous detective Hercule Poirot noted that Ratchett had a body temperature of 28 degrees. The body had cooled to a temperature of 27 degrees one hour later. If the normal temperature of a human being is 37 degrees and the air temperature in the train is 22 degrees, estimate the time of Ratchett’s death using Newton’s Law of Cooling. #### 25. You are starting a new position, and your employer has a generous retirement plan. If you put500 a month into a 401(k) plan, your employer will match your contributions.
1. Assume that you are 25 years old and plan to retire at age 65, how large can you expect your 401(k) pension to be when you retire? Assume that your 401(k) plan will collect interest at a rate of 5%.
2. If you begin withdrawing \$60,000 every year at age 65, how long will your retirement fund last?

### Subsection1.2.10Sage—Quick Start Guide to Solving Ordinary Differential Equations

Sage has powerful algorithms for finding exact and numerical solutions of differential equations. In addition, we can plot solutions and direction fields. Although some differential equations have an exact solution and can be solved using analytic techniques with calculus, many differential equations can only be solved using numerical techniques. This should not be too surprising if we consider how we solve polynomials. It is quite easy to find the roots of any equation of the form $$ax^2 + bx + c = 0$$ by either factoring or using the quadratic equation, but solving an equation such as
\begin{equation*} 5x^7 - 6x^4 +3x^3 -23 x^2 +3x -17 = 0 \end{equation*}
is a much more difficult problem. Unlike the situation for quadratic equations, there does not exist a general formula for solving seventh degree equations. We can even encounter difficulties when using a numerical method such as the Newton-Raphson algorithm.
In general, Sage needs three things to solve a differential equation:
1. An abstract function
2. A differential equation
3. A Sage command to solve the equation.
Suppose we wish to solve the equation
\begin{equation*} \frac{dy}{dx} = x + y. \end{equation*}
We can use the following sequence of Sage commands.
y = function('y')(x)
de = diff(y,x) == x + y
solution = desolve(de, y)
solution.show()

The first command defines the abstract function. The second describes the actual differential equation. Finally, we use the Sage command desolve to find the actual solution. Try replacing the solution.show() command with solution or latex(solution).
We can also specify an initial condition for our differential equation, say $$y(0) = 1\text{.}$$
y = function('y')(x)
de = diff(y,x) == x + y
solution = desolve(de, y, ics=[0,1])
solution.show()

There are many other commands and packages to solve ordinary differential equations using Sage. For more information, see www.sagemath.org/doc/reference/calculus/sage/calculus/desolvers.html. An empty Sage cell is below for practice and exploration.