9.1 Solving Differential Equations

A differential equation is an equation that involves an unknown function \(y=y(x)\) and its first or higher derivatives. A solution is a function \(y=f(x)\) satisfying the given equation. As we have seen in previous chapters, solutions usually depend on one or more arbitrary constants (denoted \(A\), \(B\), and \(C\) in the following examples):

Differential equation General solution
\(y' = -2y\) \(y=Ce^{-2x}\)
\(\displaystyle\frac{dy}{dt}=t\) \(\displaystyle y=\frac12t^2+C\)
\(y''+y=0\) \(y=A\;\sin x+B\;\cos x\)

An expression such as \(y=Ce^{-2x}\) is called a general solution. For each value of \(C\), we obtain a particular solution. The graphs of the solutions as \(C\) varies form a family of curves in the \(xy\)-plane (Figure 9.1).

Figure 9.1: Family of solutions of \(y'=-2y\).

The first step in any study of differential equations is to classify the equations according to various properties. The most important attributes of a differential equation are its order and whether or not it is linear.

503

The order of a differential equation is the order of the highest derivative appearing in the equation. The general solution of an equation of order \(n\) usually involves \(n\) arbitrary constants. For example, \[y''+y=0\] has order 2 and its general solution has two arbitrary constants \(A\) and \(B\) as listed above.

A differential equation is called linear if it can be written in the form \[ a_n(x)y^{(n)}+a_{n-1}(x)y^{(n-1)}+\cdots +a_1(x)y'+a_0(x)y=b(x) \] The coefficients \(a_j(x)\) and \(b(x)\) can be arbitrary functions of \(x\), but a linear equation cannot have terms such as \(y^3\), \(yy'\), or \(\sin y\).

Differential equation Order Linear or nonlinear
\(x^2y' + e^xy = 4\) First-order Linear
\(x(y')^2= y+x\) First-order Nonlinear (because \((y')^2\) appears)
\(y''=(\sin x)y'\) Second-order Linear
\(y'''= x(\sin y)\) Third-order Nonlinear (because \(\sin y\) appears)

In this chapter we restrict our attention to first-order equations.

Separation of Variables

We are familiar with the simplest type of differential equation, namely \(y'=f(x)\). A solution is simply an antiderivative of \(f(x)\), so can write the general solution as \[y=\int f(x)\,dx \] A more general class of first-order equations that can be solved directly by integration are the separable equations, which have the form \[ \begin{equation} \label{10.solvdiff.sep} \frac{dy}{dx} = f(x)g(y) \end{equation}\] For example,

In separation of variables, we manipulate \(dx\) and \(dy\) symbolically, just as in the Substitution Rule.

Separable equations are solved using the method of separation of variables: Move the terms involving \(y\) and \(dy\) to the left and those involving \(x\) and \(dx\) to the right. Then integrate both sides: \[ \begin{alignat*}{2} \frac{dy}{dx} &= f(x)g(y)&\quad &\textrm{(separable equation)}\\ \frac{dy}{g(y)} &= f(x)\,dx&\quad &\textrm{(separate the variables)}\\ \int \frac{dy}{g(y)} &= \int f(x)\,dx&\quad &\textrm{(integrate)} \end{alignat*} \] If these integrals can be evaluated, we can try to solve for \(y\) as a function of \(x\).

504

EXAMPLE 1

Show that \(y\frac{dy}{dx}-x = 0\) is separable but not linear. Then find the general solution and plot the family of solutions.

Note that one constant of integration is sufficient in Eq. (2). An additional constant for the integral on the left is not needed.

Solution  This differential equation is nonlinear because it contains the term \(yy'\). To show that it is separable, rewrite the equation: \[ y\frac{dy}{dx} - x = 0\quad\Rightarrow\quad \frac{dy}{dx} = xy^{-1}\quad\textrm{(separable equation)} \] Now use separation of variables: \[ \begin{alignat}{3} y\,dy &= x\,dx&\quad&\textrm{(separate the variables)} \notag\\ \int y\, dy &= \int x\,dx& \quad&\textrm{(integrate)} \notag\\ \frac12 y^2 &= \frac12 x^2+C \label{10.solvdiff.int}\\ y &= \pm \sqrt{x^2+2C}&\quad&(\textrm{solve for } y)\notag \end{alignat} \] Since \(C\) is arbitrary, we may replace \(2C\) by \(C\) to obtain (Figure 9.2) \[ y=\pm\sqrt{x^2+C} \] Each choice of sign yields a solution.

Figure 9.2: Solutions \(y = \sqrt{x^2 + C}\) to \(y\frac{dy}{dx}-x=0\).

It is a good idea to verify that solutions you have found satisfy the differential equation. In our case, for the positive square root (the negative square root is similar), we have \[\begin{align*} \frac{dy}{dx}&=\frac{d}{dx} \sqrt{x^2+C} = \frac{x}{\sqrt{x^2+C}} \\ y\frac{dy}{dx} &= \sqrt{x^2+C} \left(\frac{x}{\sqrt{x^2+C}} \right) = x\quad\Rightarrow\quad y\frac{dy}{dx}-x = 0 \end{align*}\] This verifies that \(y=\sqrt{x^2 +C}\) is a solution.

Most differential equations arising in applications have an existence and uniqueness property: There exists one and only one solution satisfying a given initial condition. General existence and uniqueness theorems are discussed in textbooks on differential equations.

Although it is useful to find general solutions, in applications we are usually interested in the solution that describes a particular physical situation. The general solution to a first-order equation generally depends on one arbitrary constant, so we can pick out a particular solution \(y(x)\) by specifying the value \(y(x_0)\) for some fixed \(x_0\) (Figure 9.3). This specification is called an initial condition. A differential equation together with an initial condition is called an initial value problem.

505

EXAMPLE 2 Initial Value Problem

Solve the initial value problem \[y'=-ty,\qquad y(0) = 3\]

Figure 9.3: The initial condition \(y(0)=3\) determines one curve in the family of solutions to \(y'=-ty\).

Solution Use separation of variables to find the general solution: \[\begin{align*} \frac{dy}{dt}=-ty\quad\Rightarrow\quad \frac{dy}y&=-t\,dt\\ \int \frac{dy}y&=-\int t\,dt\\ \quad\ln |y|&=-\frac12t^2+C\\ |y|&=e^{-t^2/2+C}= e^C\, e^{-t^2/2} \end{align*}\] Thus, \(y=\pm e^C\, e^{-t^2/2}\). Since \(C\) is arbitrary, \(e^C\) represents an arbitrary positive number, and \(\pm e^C\) is an arbitrary nonzero number. We replace \(\pm e^C\) by \(C\) and write the general solution as \[\begin{equation} \label{1.sepvar.initvalex} y = Ce^{-t^2/2} \end{equation}\] Now use the initial condition \(y(0) =Ce^{-0^2/2}=3\). Thus, \(C=3\) and \(y = 3e^{-t^2/2}\) is the solution to the initial value problem (Figure 9.3).

If we set \(C=0\) in Eq. (3), we obtain the solution \(y=0\). The separation of variables procedure did not directly yield this solution because we divided by \(y\) (and thus assumed implicitly that \(y\ne 0\)).

In the context of differential equations, the term “modeling” means finding a differential equation that describes a given physical situation. As an example, consider water leaking through a hole at the bottom of a tank (Figure 9.4). The problem is to find the water level \(y(t)\) at time \(t\). We solve it by showing that \(y(t)\) satisfies a differential equation.

Figure 9.4: Water leaks out of a tank through a hole of area \(B\) at the bottom.

The key observation is that the water lost during the interval from \(t\) to \(t+\Delta t\) can be computed in two ways. Let \[\begin{align*} v(y) = &\text{velocity of the water flowing through the hole}\\ &\text{when the tank is filled to height } y\\ B = &\textrm{area of the hole}\\ A(y) = &\textrm{area of horizontal cross section of the tank at height } y \end{align*}\] First, we observe that the water exiting through the hole during a time interval \(\Delta t\) forms a cylinder of base \(B\) and height \(v(y)\Delta t\) (because the water travels a distance \(v(y)\Delta t\)—see Figure 9.4). The volume of this cylinder is approximately \(Bv(y)\Delta t\) [approximately but not exactly, because \(v(y)\) may not be constant]. Thus, \[ \textrm{Water lost between \(t\) and \(t+\Delta t\)} \approx Bv(y)\Delta t \]

Second, we note that if the water level drops by an amount \(\Delta y\) during the interval \(\Delta t\), then the volume of water lost is approximately \(A(y)\Delta y\) (Figure 9.4). Therefore, \[ \textrm{Water lost between \(t\) and \(t+\Delta t\)} \approx A(y)\,\Delta y \] This is also an approximation because the cross-sectional area may not be constant. Comparing the two results, we obtain \(A(y)\Delta y\approx Bv(y)\Delta t\), or \[ \frac{\Delta y}{\Delta t} \approx \frac{Bv(y)}{A(y)} \]

506

Now take the limit as \(\Delta t\to 0\) to obtain the differential equation \[\begin{equation} \boxed{\bbox[#FAF8ED,5pt]{\frac{dy}{dt} = \frac{Bv(y)}{A(y)}}} \end{equation}\]

Like most if not all mathematical models, our model of water draining from a tank is at best an approximation. The differential equation (4) does not take into account viscosity (resistance of a fluid to flow). This can be remedied by using the differential equation \[ \frac{dy}{dt} = k\frac{Bv(y)}{A(y)} \] where \(k<1\) is a viscosity constant. Furthermore, Torricelli's Law is valid only when the hole size \(B\) is small relative to the cross-sectional areas \(A(y)\).

To use Eq. (4), we need to know the velocity of the water leaving the hole. This is given by Torricelli's Law (\(g=9.8 \text{m/s}^2\)): \[\begin{equation} \boxed{\bbox[#FAF8ED,5pt]{v(y) = -\sqrt{2gy} = -\sqrt{2(9.8)y} \approx -4.43\sqrt{y} \textrm{m/s}}} \end{equation}\]

EXAMPLE 3 Application of Torricelli's Law

A cylindrical tank of height 4 m and radius 1 m is filled with water. Water drains through a square hole of side 2 cm in the bottom. Determine the water level \(y(t)\) at time \(t\) (seconds). How long does it take for the tank to go from full to empty?

Solution We use units of centimeters.

Step 1. Write down and solve the differential equation

The horizontal cross section of the cylinder is a circle of radius \(r=100\) cm and area \(A(y) =\pi r^2= 10{,}000\pi \mathrm{cm}^2\) (Figure 9.5). The hole is a square of side \(2\) cm and area \(B= 4 \mathrm{cm}^2\). Since we are using centimeters, we take \(g=980\) cm/s\(^2\) in Eq. (5), which gives us \(v(y) =-\sqrt{2(980)y}=-44.3\sqrt{y}\) cm/s. Eq. (4) becomes \[\begin{equation} \label{10.sepvar.eq} \frac{dy}{dt} = \frac{Bv(y)}{A(y)} = -\frac{4(44.3\sqrt{y})}{10{,}000\pi} \approx -0.0056\sqrt y \end{equation}\] Solve using separation of variables: \[ \begin{align} \int \frac{dy}{\sqrt y} &= -0.0056\int \,dt\notag\\ 2y^{1/2} &= -0.0056t+C \label{10.1.torrconstant}\\ y &= \left(- 0.0028t+\frac12C \right)^2\notag \end{align} \] Since \(C\) is arbitrary, we may replace \(\frac12 C\) by \(C\) and write \[ y=\left(C - 0.0028t\right)^2 \]

Step 2. Use the initial condition

The tank is full at \(t=0\), so we have the initial condition \(y(0)=400\) cm. Thus \[ y(0) = C^2=400 \quad\Rightarrow\quad C = \pm 20 \] Which sign is correct? You might think that both sign choices are possible, but notice that the water level \(y\) is a decreasing function of \(t\), and the function \(y=\left(C - 0.0028t\right)^2\) decreases to \(0\) only if \(C\) is positive. Alternatively, we can see directly from Eq. (7) that \(C>0\), because \(2y^{1/2}\) is nonnegative. Thus, \[ y(t)= \left(20 - 0.0028t \right)^2 \]

To determine the time \(t_e\) that it takes to empty the tank, we solve \[ y(t_e) = \left(20 - 0.0028t_e\right)^2 =0 \quad\Rightarrow\quad t_e \approx 7142 \mathrm{s} \] Thus, the tank is empty after \(7142\) s, or nearly two hours (Figure 9.6).

507

CONCEPTUAL INSIGHT

The previous example highlights the need to analyze solutions to differential equations rather than relying on algebra alone. The algebra seemed to suggest that \(C=\pm 20\), but further analysis showed that \(C=-20\) does not yield a solution for \(t \geq 0\). Note also that the function \[ y(t)=\left(20 - 0.0028t\right)^2 \] is a solution only for \(t\le t_e\)—that is, until the tank is empty. This function cannot satisfy Eq. (6) for \(t>t_e\) because its derivative is positive for \(t>t_e\) (Figure 9.6), but solutions of Eq. (6) have nonpositive derivatives.

9.1.1 Summary