<img src="https://d5nxst8fruw4z.cloudfront.net/atrk.gif?account=iA1Pi1a8Dy00ym" style="display:none" height="1" width="1" alt="" />
Skip Navigation

7.7: Ordinary Differential Equations

Difficulty Level: At Grade Created by: CK-12
Turn In

General and Particular Solutions

Differential equations appear in almost every area of daily life including science, business, and many others. We will only consider ordinary differential equations (ODE). An ODE is a relation on a function \begin{align*}y\end{align*} of one independent variable \begin{align*}x\end{align*} and the derivatives of \begin{align*}y\end{align*} with respect to \begin{align*}x\end{align*}, i.e. \begin{align*}y^{(n)} = F(x, y, y' , \ldots .,y^{(n - 1)})\end{align*}. For example, \begin{align*}y'' + (y' )^2 + y = x\end{align*}.

An ODE is linear if \begin{align*}F\end{align*} can be written as a linear combination of the derivatives of \begin{align*}y\end{align*}, i.e. \begin{align*}y^{(n)} = \sum a_i(x)y(i) + r(x)\end{align*}. A linear ODE is homogeneous if \begin{align*}r(x) = 0\end{align*}.

A general solution to a linear ODE is a solution containing a number (the order of the ODE) of arbitrary variables corresponding to the constants of integration. A particular solution is derived from the general solution by setting the constants to particular values. For example, for linear ODE of second degree \begin{align*}y'' + y = 0\end{align*}, a general solution has the form \begin{align*}y_g = A \cos x + B \sin x\end{align*} where \begin{align*}A, B\end{align*} are real numbers. By setting \begin{align*}A = 1\end{align*} and \begin{align*}B = 0, y_p = \cos x\end{align*}

It is generally hard to find the solution of differential equations. Graphically and numerical methods are often used. In some cases, analytical method works, and in the best case, \begin{align*}y\end{align*} has an explicit formula in \begin{align*}x\end{align*}.

Multimedia Links

For a video introduction to differential equations (27.0), see Math Video Tutorials by James Sousa, Introduction to Differential Equations (8:12).

Slope Fields and Isoclines

We now only consider linear ODE of the first degree, i.e. \begin{align*}\frac{dy}{dx} = F(x, y)\end{align*}. In general, the solutions of a differential equation could be visualized before trying an analytic method. A solution curve is the curve that represents a solution (in the \begin{align*}xy -\end{align*} plane).

The slope field of the differential |eq|uation is the set of all short line segments through each point \begin{align*}(x, y)\end{align*} and with slope \begin{align*}F(x, y)\end{align*}.

An isocline (for constant \begin{align*}k\end{align*}) is the line along which the solution curves have the same gradient \begin{align*}(k)\end{align*}. By calculating this gradient for each isocline, the slope field can be visualized; making it relatively easy to sketch approxi- mate solution curves. For example,\begin{align*}\frac{dy}{dx}=\frac{x}{y}\end{align*}. The isoclines are \begin{align*}y =\frac{x}{k}\end{align*}.

Example 1 Consider \begin{align*}\frac{dy}{dx}=\frac{x}{y^2}\end{align*}. We briefly sketch the slope field as above.

The solutions are \begin{align*}y^3 =\frac{3}{2}\ x^2+C\end{align*}.


  1. Sketch the slope field of the differential equation \begin{align*}\frac{dy}{dx}=1-y\end{align*}. Sketch the solution curves based on it.
  2. Sketch the slope field of the differential equation \begin{align*}\frac{dy}{dx}=y-x\end{align*}. Find the isoclines and sketch a solution curve that passes through \begin{align*}(1, 0)\end{align*}.

Differential Equations and Integration

We begin the analytic solutions of differential equations with a simple type where \begin{align*}F(x,y)\end{align*} is a function of \begin{align*}x\end{align*} only. \begin{align*}\frac{dy}{dx}= f(x)\end{align*} is a function of \begin{align*}x\end{align*}. Then any antiderivative of \begin{align*}f\end{align*} is a solution by the Fundamental Theorem of Calculus:

\begin{align*}\frac{d}{dx}\int_{a}^{x}\ f(t)\ dt=f(x)\end{align*}.

Example 1 Solve the differential equation \begin{align*}\frac{dy}{dx}= x\end{align*} with \begin{align*}y(0) = 1\end{align*}.

Solution. \begin{align*}y =\int\ x\ dx =\frac{x^2}{2}+C\end{align*}. Then \begin{align*}y(0) = 1\end{align*} gives \begin{align*}1 = 0 + C\end{align*}, i.e. \begin{align*}C = 1\end{align*} Therefore \begin{align*}y =\frac{x^2}{2}+ 1\end{align*}.


  1. Solve the differential equation \begin{align*}\frac{dy}{dx}= \sqrt{9-x^2}\end{align*} with \begin{align*}y(0) = 3\end{align*}.

Solving Separable First-Order Differential Equations

The next type of differential equation where analytic solution are relatively easy is when the dependence of \begin{align*}F(x, y)\end{align*} on \begin{align*}x\end{align*} and \begin{align*}y\end{align*} are separable: \begin{align*}\frac{dy}{dx}= F(x, y)\end{align*} where \begin{align*}F(x, y) = f(x) g(y)\end{align*} is the product of a functions of \begin{align*}x\end{align*} and \begin{align*}y\end{align*} respectively. The solution is in the form \begin{align*}P(x) = Q(y)\end{align*}. Here \begin{align*}g(y)\end{align*} is never or the values of \begin{align*}y\end{align*} in the solutions will be restricted by where \begin{align*}g(y) = 0\end{align*}.

Example 1 Solve the differential equation \begin{align*}y' = xy\end{align*} with the initial condition \begin{align*}y(0) = 1\end{align*}.

Solution. Separating \begin{align*}x\end{align*} and \begin{align*}y\end{align*} turns the equation in differential form \begin{align*}\frac{dy}{y}=xdx\end{align*}. Integrating both sides, we have \begin{align*}\ln|y| =\frac{1}{2}x^2 + C\end{align*}.

Then \begin{align*}y(0) = 1\end{align*} gives \begin{align*}\ln|1| = \frac{1}{2}(0)^2 + C\end{align*}, i.e. \begin{align*}C = 0\end{align*} and \begin{align*}\ln|y| = \frac{1}{2}x^2\end{align*}.

So \begin{align*}|y| = e^{\frac{1}{2}x^2}.\end{align*}

Therefore, the solutions are \begin{align*}y = \pm e^{\frac{1} {2}x^2}\end{align*}.

Here \begin{align*}Q(y) = y\end{align*} is when \begin{align*}y = 0\end{align*} and the values of \begin{align*}y\end{align*} in the solutions satisfy \begin{align*}y > 0\end{align*} or \begin{align*}y < 0\end{align*}.

Example 2. Solve the differential equation \begin{align*}2xy' = 1 - y^2\end{align*}.

Solution. Separating \begin{align*}x\end{align*} and \begin{align*}y\end{align*} turns the equation in differential form \begin{align*}\frac{2} {1 - y^2} dy = \frac{dx} {x}.\end{align*}

Resolving the partial fraction \begin{align*}\frac{2} {1 - y^2} = \frac{A} {1 - y} + \frac{B} {1 + y}\end{align*} gives linear equations \begin{align*}A + B = 2\end{align*} and \begin{align*}A - B = 0\end{align*}.

So \begin{align*}\left (\frac{1} {1 - y} + \frac{1} {1 + y}\right ) dy = \frac{dx} {x}\end{align*}. Integrating both sides, we have \begin{align*}-\ln | 1 - y | + \ln | 1 + y | = \ln | x | + C\end{align*} or \begin{align*}\ln \left |\frac{1 + y} {1 - y}\right | = \ln (e^C | x | ) = \ln D | x |\end{align*} with \begin{align*}D = e^C > 0\end{align*}. Then \begin{align*}\left |\frac{1 + y} {1 - y}\right | = D | x |\end{align*}, i.e. \begin{align*}\frac{1 + y} {1 - y} = \pm Dx\end{align*} where \begin{align*}D > 0\end{align*}.

Therefore, the solution has form \begin{align*}y = \pm \frac{Dx - 1} {Dx + 1}\end{align*} where \begin{align*}D > 0\end{align*}.


  1. Solve the differential equation \begin{align*}\frac{dy} {dx} = \frac{1} {e^y}\end{align*} which satisfies the condition \begin{align*}y(e) = 0\end{align*}.
  2. Solve the differential equation \begin{align*}\frac{dy} {dx} = x(y^2 + 1)\end{align*}.
  3. Solve the differential equation \begin{align*}\frac{dy} {dx} = \frac{x} {\sqrt{1 - y^2}}\end{align*}.

Exponential and Logistic Growth

In some models, the population grows at a rate proportional to the current population without restrictions. The population is given by the differential equation \begin{align*}\frac{dP} {dt} = kP\end{align*}, where \begin{align*}k > 0\end{align*} is the growth rate. In a refined model, the rate of growth is adjusted by another factor \begin{align*}\left (1 - \frac{P} {K}\right )\end{align*} where \begin{align*}K\end{align*} is the carrier capacity. This is close to \begin{align*}1\end{align*} when \begin{align*}P\end{align*} is small compared with \begin{align*}K\end{align*} but close to when \begin{align*}P\end{align*} is close to \begin{align*}K\end{align*}.

Both differential equations are separable and could be solved as in last section. \begin{align*}\frac{dP} {dt} = kP \left (1 - \frac{P} {K}\right )\end{align*}. The solutions are respectively:

\begin{align*}P(t) = P(0)e^{kt}\end{align*} and \begin{align*}P(t) = \frac{P_0} {1 + Ae^{kt}}\end{align*} with \begin{align*}A = \frac{K - P_0} {P_0}\end{align*}.

Example 1 (Exponential Growth) The population of a group of immigrants increased from \begin{align*}10000\end{align*} to \begin{align*}20000\end{align*} from the end of the first year to the end of second year they came to an island. Assuming an exponential growth model on the population, estimate the size of the group of initial immigrants.

Solution. The population of the group is given by \begin{align*}P = P_{0}e^{kt}\end{align*} where the initial population and relative growth rate are to be determined.

At \begin{align*}t = 1\end{align*} (year), \begin{align*}P = 10000\end{align*}, so \begin{align*}10000 = P_{0}e^{k \cdot 1} = P_{0}^{e^k}\end{align*}.

At \begin{align*}t = 2\end{align*} (year), \begin{align*}P = 20000\end{align*}, so \begin{align*}20000 = P_{0}e^{k \cdot 2} = P_{0}e^{2k}\end{align*}.

Dividing both sides of the second equation by the first, we have \begin{align*}2 = e^{k}\end{align*}.

Then back in the first equation, \begin{align*}10000 = P_0(2)\end{align*}. So \begin{align*}P_0 = 5000\end{align*}. There are \begin{align*}5000\end{align*} initial immigrants.

Example 2 (Logistic Growth) The population on an island is given by the equation \begin{align*}\frac{dP} {dt} = 0.05P\left (1 - \frac{P_0} {5000}\right ), P_0 = 5000\end{align*}. Find the population sizes \begin{align*}P(20), P(30)\end{align*}. At what time will the population first exceed \begin{align*}4000\end{align*}?

Solution. The solution is given by \begin{align*}P = \frac{P_0} {1 - Ae^{0.05t}}\end{align*} where \begin{align*}A = \frac{5000 - 1000} {1000} = 4\end{align*}.

\begin{align*}P(20) & = \frac{5000} {1 + 4e^{-0.05(20)}} = \frac{5000} {1 + 4e^{-1}} = 2023 \\ P(30) & = \frac{5000} {1 + 4e^{-0.05(30)}} = \frac{5000} {1 + 4e^{-1.5}} = 3785.\end{align*}

Solve for time, \begin{align*}4000 = \frac{5000} {1 + 4e^{-0.05(t)}}\end{align*} gives \begin{align*}e^{(-0.05t)} = \frac{\frac{5000} {4000} - 1} {4} = 0.0625\end{align*}. So \begin{align*}t = 56\end{align*}. The population first exceed \begin{align*}4000\end{align*} in the \begin{align*}56^{th}\end{align*} year.


  1. (Exponential Growth) The population of a suburban city increased from \begin{align*}10000\end{align*} in 2005 to \begin{align*}30000\end{align*} in 2007. Assuming an exponential growth model on the population, by which year will the population first exceed \begin{align*}100000\end{align*}?
  2. (Logistic Growth) The population of a city is given by the equation \begin{align*}\frac{dP} {dt} = 0.06P\left (1 - \frac{P_0} {100000}\right ), P_0 = 25000\end{align*}. Find the population sizes \begin{align*}P(10), P(25)\end{align*}. At what time will the population first exceed \begin{align*}90000\end{align*}?

Multimedia Links

For a video presentation of Differential Equations including growth and decay (27.0), see Differential Equations, Growth and Decay (7:23).

Numerical Methods (Euler's, Improved Euler, Runge-Kutta)

The Euler's method is a numerical approximation to a solution curve starting from the point \begin{align*}(a, b)\end{align*} through the algorithm:

\begin{align*}y_{n + 1} = y_{n} + hF(x_{n}, y_{n})\end{align*} where \begin{align*}x_{0} = a, y_{0} = b\end{align*} and \begin{align*}h\end{align*} is the step size.

The shorter step size, the better is the approximation to the solution curve.

Improved Euler (Heun) method adapts on Euler's method by using both end point values: \begin{align*}y_{n+1} = y_n + \frac{h} {2} [F(x_n, y_n) + F(x_{n + 1}, y_{n + 1})].\end{align*}

Since \begin{align*}y_{n+1}\end{align*} also appears on the right side, we replace it by Euler's formula,

\begin{align*}y_{n+1} = y_n + \frac{h} {2} [F(x_n, y_n) + F(x_{n + 1}, y_n + hF(x_n, y_n))].\end{align*}

The Runge-Kutta methods are an important family of implicit and explicit iterative methods for the approximation of solutions of our ODE. On them, apply Simpson's rule:

\begin{align*}y_{n + 1} - y_n = \int_{x_n}^{x_{n + 1}} f'(x) dx = \int_{x_n}^{x_n + h} f'(x) dx\end{align*}

\begin{align*}\approx \frac{h} {6} \left \{y'(x_n) + 4y'\left (x_n + \frac{h} {2}\right ) + y' (x_n + 1)\right \}.\end{align*}

Exercise 1. Apply the Euler's, improved Euler's and the Runge-Kutta methods on the ODE

\begin{align*}\frac{dy} {dx} = y\end{align*} to approximate the solution that satisfy \begin{align*}y(0) = 1\end{align*} from \begin{align*}x = 0\end{align*} to \begin{align*}x = 1\end{align*} with \begin{align*}h = 0.2\end{align*}.

We know the exact solution is \begin{align*}y = e^x\end{align*}. Compare their relative accuracy against the exact solution.

Texas Instruments Resources

In the CK-12 Texas Instruments Calculus FlexBook, there are graphing calculator activities designed to supplement the objectives for some of the lessons in this chapter. See http://www.ck12.org/flexr/chapter/9732.

Notes/Highlights Having trouble? Report an issue.

Color Highlighted Text Notes
Please to create your own Highlights / Notes
Show More

Image Attributions

Show Hide Details
Files can only be attached to the latest version of section
Please wait...
Please wait...
Image Detail
Sizes: Medium | Original