<meta http-equiv="refresh" content="1; url=/nojavascript/"> Ordinary Differential Equations | CK-12 Foundation
Skip Navigation
You are reading an older version of this FlexBook® textbook: CK-12 Calculus Go to the latest version.

7.7: Ordinary Differential Equations

Created by: CK-12

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 y of one independent variable x and the derivatives of y with respect to x, i.e. y^{(n)} = F(x, y,  y' , \ldots .,y^{(n - 1)}). For example, y'' + (y' )^2 + y = x.

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

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 y'' + y = 0, a general solution has the form y_g = A \cos x + B \sin x where A, B are real numbers. By setting A = 1 and B = 0, y_p = \cos x

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, y has an explicit formula in x.

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. \frac{dy}{dx} = F(x, y). 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 xy - plane).

The slope field of the differential |eq|uation is the set of all short line segments through each point (x, y) and with slope F(x, y).

An isocline (for constant k) is the line along which the solution curves have the same gradient (k). 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,\frac{dy}{dx}=\frac{x}{y}. The isoclines are y =\frac{x}{k}.

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

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


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

Differential Equations and Integration

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

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

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

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


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

Solving Separable First-Order Differential Equations

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

Example 1 Solve the differential equation y' = xy with the initial condition y(0) = 1.

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

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

So |y| = e^{\frac{1}{2}x^2}.

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

Here Q(y) = y is 0 when y = 0 and the values of y in the solutions satisfy y > 0 or y < 0.

Example 2. Solve the differential equation 2xy' = 1 - y^2.

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

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

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

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


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

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 \frac{dP} {dt} = kP, where k > 0 is the growth rate. In a refined model, the rate of growth is adjusted by another factor \left (1 - \frac{P} {K}\right ) where K is the carrier capacity. This is close to 1 when P is small compared with K but close to 0 when P is close to K.

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

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

Example 1 (Exponential Growth) The population of a group of immigrants increased from 10000 to 20000 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 P = P_{0}e^{kt} where the initial population and relative growth rate are to be determined.

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

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

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

Then back in the first equation, 10000 = P_0(2). So P_0 = 5000. There are 5000 initial immigrants.

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

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

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.

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


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

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 (a, b) through the algorithm:

y_{n + 1} = y_{n} + hF(x_{n}, y_{n}) where x_{0} = a, y_{0} = b and h 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: y_{n+1} = y_n + \frac{h} {2} [F(x_n, y_n) + F(x_{n + 1}, y_{n + 1})].

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

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

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:

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

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

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

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

We know the exact solution is y = e^x. 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.

Image Attributions




Date Created:

Feb 23, 2012

Last Modified:

May 29, 2014
Files can only be attached to the latest version of None


Please wait...
Please wait...
Image Detail
Sizes: Medium | Original

Original text