Ordinary Differential Equations (ODEs)

Overview of ODEs

There are four major areas in the study of ordinary differential equations that are of interest in pure and applied science.

  • Exact solutions, which are closed-form or implicit analytical expressions that satisfy the given problem.
  • Numerical solutions, which are available for a wider class of problems, but are typically only valid over a limited range of the independent variables.
  • Qualitative theory, which is concerned with the global properties of solutions and is particularly important in the modern approach to dynamical systems.
  • Existence and uniqueness theorems, which guarantee that there are solutions with certain desirable properties provided a set of conditions is fulfilled by the differential equation.

Of these four areas, the study of exact solutions has the longest history, dating back to the period just after the discovery of calculus by Sir Isaac Newton and Gottfried Wilhelm von Leibniz. The following table introduces the types of equations that can be solved by DSolve.

name of equation
general form
date of discovery
mathematician
separable1691G. Leibniz
homogeneous1691G. Leibniz
linear first-order ODE1694G. Leibniz
Bernoulli1695James Bernoulli
Riccati1724Count Riccati
exact first-order ODE with 1734L. Euler
Clairaut1734A-C. Clairaut
linear with constant coefficients with constant1743L. Euler
hypergeometric1769L. Euler
Legendre1785M. Legendre
Bessel1824F. Bessel
Mathieu1868E. Mathieu
Abel1834N. H. Abel
Chini1924M. Chini

Examples of ODEs belonging to each of these types are given in other tutorials (clicking a link in the table will bring up the relevant examples).

First Order ODEs

Straight Integration

This equation is solved by simply integrating the right-hand side with respect to :
Here is a plot of the integral curves for different values of the arbitrary constant C[1]:

Separable Equations

The general solution to this equation is found by separation of variables:

Even when variables can be separated, the final solution might be accompanied by a warning message from Solve, or it might only be given as an InverseFunction object.

Solving this ODE generates a warning message because Solve obtains an expression for using Log, the inverse of Exp. This warning message can be ignored:
The solution to this equation is given as an InverseFunction object, in order to get an explicit expression for :

Homogeneous Equations

Here is a homogeneous equation in which the total degree of both the numerator and the denominator of the right-hand side is 2. The two parts of the solution list give branches of the integral curves in the form :
This plots both branches together, showing the complete integral curves for several values of C[1]:
If an initial condition is specified, DSolve picks the branch that passes through the initial point. The DSolve::bvnul message indicates that one branch of the general solution (the lower branch in the previous graph) did not give a solution satisfying the given initial condition y[1]3:

Linear First-Order Equations

The following is a linear first-order ODE because both and occur in it with power 1 and is the highest derivative. Note that the solution contains the imaginary error function Erfi:
Here is the solution for a more general linear first-order ODE. The K variables are used as dummy variables for integration. The Erfi term in the previous example comes from the integral in the second term of the general solution as follows:
A more traditional form of the solution can be obtained by replacing K[1] with a variable such as :

Inverse Linear Equations

It may happen that a given ODE is not linear in but can be viewed as a linear ODE in . In this case, it is said to be an inverse linear ODE.

This is an inverse linear ODE. It is constructed by interchanging and in an earlier example:

Bernoulli Equations

A Bernoulli equation is a first-order equation of the form

The problem of solving equations of this type was posed by James Bernoulli in 1695. A year later, in 1696, G. Leibniz showed that it can be reduced to a linear equation by a change of variable.

Here is an example of a Bernoulli equation:
This verifies that the solution is correct:

In general, the solution to a Bernoulli equation will consist of branches, where is the degree of in the equation.

Here is an example of a Bernoulli equation with . The solution has four branches:

Riccati Equations

A Riccati equation is a first-order equation of the form

This equation was used by Count Riccati of Venice (16761754) to help in solving second-order ordinary differential equations.

Solving Riccati equations is considerably more difficult than solving linear ODEs.

Here is a simple Riccati equation for which the solution is available in closed form:

Any Riccati equation can be transformed to a second-order linear ODE. If the latter can be solved explicitly, then a solution for the Riccati equation can be derived.

Here is an example of a Riccati equation and the corresponding second-order ODE, which is Legendre's equation:
Finally, consider the following Riccati equation. It is integrable because the sum of the coefficients of the terms on the right-hand side is 0:
This verifies the solution:

Exact Equations

Here is an example of an exact ODE:
This verifies the solution:
Here is a contour plot of the solution:

If an equation is not exact, it may be possible to find an integrating factor (a multiplier for the functions P and Q, defined previously) that converts the equation into exact form. DSolve tries a variety of techniques to automatically find integrating factors in such situations.

Clairaut Equations

A Clairaut equation is a first-order equation of the form

A remarkable feature of this nonlinear equation is that its general solution has a very simple form.

This is an example of a Clairaut equation:

The general solution to Clairaut equations is simply a family of straight lines.

This plots the solution for several values of C[1]:

Abel Equations

An Abel ODE is a first-order equation of the form

This equation arose in the context of the studies of Niels Henrik Abel on the theory of elliptic functions, and represents a natural generalization of the Riccati equation.

Associated with any Abel ODE is a sequence of expressions that is built from the coefficients of the equation and invariant under certain coordinate transformations of the independent variable and the dependent variable. These invariants characterize each equation and can be used for identifying integrable classes of Abel ODEs. In particular, Abel ODEs with zero or constant invariants can be integrated easily and constitute an important integrable class of these equations.

Here is the construction of a particular invariant with value 0 and the solution of the corresponding Abel ODE:

Another important class of integrable Abel ODEs are those that can be reduced to inverse linear first-order ODEs using a nonlinear coordinate transformation.

This Abel ODE is solved by transforming it to an inverse linear first-order ODE. The ExpIntegralEi term in the solution to this equation comes from solving the linear ODE:

Another important class of integrable Abel ODEs consists of those that can be transformed to an inverse Riccati equation. Since Riccati equations can be transformed to second-order linear ODEs, the solutions for this class are usually given in terms of special functions such as AiryAi and BesselJ.

This Abel ODE is solved by reducing it to an inverse Riccati equation:
This verifies the solution:

The Abel ODEs considered so far are said to be of the first kind. Abel ODEs of the second kind are given by the following general formula.

An Abel ODE of the second kind can be converted to an equation of the first kind with a coordinate transformation. Thus, the solution methods for this kind of Abel ODE are identical to the methods for equations of the first kind.

Here is the solution for an Abel ODE of the second kind:
This verifies the solution:

Chini Equations

Chini equations are a generalization of Abel and Riccati equations.

This solves a Chini equation:

Linear Second-Order ODEs

Overview

Solving linear first-order ODEs is straightforward and only requires the use of a suitable integrating factor. In sharp contrast, there are a large number of methods available for handling linear second-order ODEs, but the solution to the general equation belonging to this class is still not available. Therefore the linear case is discussed in detail before moving on to nonlinear second-order ODEs.

The general linear second-order ODE has the form

Here, , , and are arbitrary functions of . The term "linear" refers to the fact that the degree of each term in , and is 1. (Thus, terms like or would make the equation nonlinear.)

Equations with Constant Coefficients

The simplest type of linear second-order ODE is one with constant coefficients.

This linear second-order ODE has constant coefficients:

Notice that the general solution is a linear combination of two exponential functions. The arbitrary constants C[1] and C[2] can be varied to produce particular solutions.

This is one particular solution to the equation:

The exponents and in the basis are obtained by solving the associated quadratic equation. This quadratic equation is called the auxiliary or characteristic equation.

This solves the auxiliary equation:

The roots are real and distinct in this case. There are two other cases of interest: real and equal roots, and imaginary roots.

This example has real and equal roots:
This example has roots with nonzero imaginary parts:
Here is a plot of the three solutions:

Euler and Legendre Equations

An Euler equation has the general form

Euler equations can be solved by transforming them to equations with constant coefficients.

This is an example of an Euler equation:

The Legendre linear equation is a generalization of the Euler equation. It is an ODE of the form

Here is an example of a Legendre linear equation:

Exact Equations

A linear second-order ordinary differential equation

is said to be exact if

An exact linear second-order ODE is solved by reduction to a linear first-order ODE.

Here is an example. The appearance of the unevaluated integral in the solution is explained here:
This verifies the solution:

Equations with Solutions Involving Special Functions

DSolve can find solutions for most of the standard linear second-order ODEs that occur in applied mathematics.

Here is the solution for Airys equation:
Here is a plot that shows the oscillatory behavior of the Airy functions for large negative values of :
The solution to this equation is given in terms of the derivatives of the Airy functions, AiryAiPrime and AiryBiPrime:
Here is the solution for Bessels equation with . Note that the solution is given in terms of Bessel functions of the first kind, BesselJ, as well as those of the second kind, BesselY:
Here is a plot of the BesselJ functions for specific values of :
Here is the general solution for Legendres equation with :

These special functions can be expressed in terms of elementary functions for certain values of their parameters. The Wolfram Language performs this conversion automatically wherever it is possible.

These are some of these expressions that are automatically converted:

As a result of these conversions, the solutions of certain ODEs can be partially expressed in terms of elementary functions. Hermite's equation is one such ODE.

Here is the solution for Hermite's equation with arbitrary :
With set to 5, the solution is given in terms of polynomials, exponentials, and Erfi:

Equations with Rational Coefficients

The hypergeometric functions play a unifying role in mathematical analysis since many important functions, such as the Bessel functions and Legendre functions, are special cases of them. Each hypergeometric function is associated with a linear ODE having rational coefficients.

Here is the ODE for the Hypergeometric2F1 function:

DSolve can solve a large class of second-order linear ODEs by reducing them to the ODEs for hypergeometric functions. The reduction involves coordinate transformations of both the independent and dependent variables.

This equation is equivalent to the ODE for Hypergeometric2F1:
This verifies the solution using numerical values:
Solutions to this equation are returned in terms of HypergeometricU (the confluent hypergeometric function) and LaguerreL. This example appears on (equation 2.16, page 403 of [K59]):

The ODEs for special functions have been studied since the eighteenth century. During the last 30 years, powerful algorithms have been developed for systematically solving ODEs with rational coefficients. An important algorithm of this type is Kovacics algorithm, a decision procedure that either generates a solution for the given ODE in terms of Liouvillian functions or proves that the given ODE does not have a Liouvillian solution.

This equation is solved using Kovacic's algorithm:

The solution returned from Kovacic's algorithm may occasionally include functions such as ExpIntegralEi or an unevaluated integral of elementary functions because, while it is easy to find a second solution for a second-order linear ODE once one solution is known, the integral involved in finding the second solution may be hard to evaluate explicitly.

The solution to this equation is obtained using Kovacics algorithm. It includes ExpIntegralEi:

In general, the solutions for linear ODEs with rational coefficients and order greater than one can be given in terms of DifferentialRoot objects. This is similar to the representation for solutions of polynomial equations in terms of Root.

The solution to this equation is given in terms of DifferentialRoot:
The solution may be evaluated and plotted in the usual way:

Equations with Non-Rational Coefficients

The ODEs that arise in practical applications often have non-rational coefficients. In such cases, DSolve attempts to convert the equation into one with rational coefficients using a suitable coordinate transformation.

Here is an equation that has Exp[x] as a coefficient. It is solved by transforming it to Bessels equation:
This equation (equation 2.437, page 507 of [K59]) has trigonometric coefficients. The solution is given in terms of elementary functions:
Here is an equation with a hyperbolic function in the coefficient of . The solution is given in terms of Legendre functions:
The solution to this equation is given in terms of HypergeometricU and LaguerreL:
This verifies the solution using random values of , , , and :

Inhomogeneous Equations

If the given second-order ODE is inhomogeneous, DSolve applies the method of variation of parameters to return a solution for the problem.

This solves an inhomogeneous linear second-order ODE. The solution is composed of two parts: the first part is the general solution to the homogeneous equation, and the second part is a particular solution to the inhomogeneous equation:
This solves the homogeneous equation, which is an Euler equation:
Different particular solutions can be obtained by varying the constants C[1] and C[2] in the solution:

Nonlinear Second-Order ODEs

The general form of a nonlinear second-order ODE is

For simplicity, assume that the equation can be solved for the highest-order derivative to give

There are a few classes of nonlinear second-order ODEs for which solutions can be easily found.

The first class consists of equations that do not explicitly depend on ; that is, equations of the form . Such equations can be regarded as first-order ODEs in .

Here is an example of this type:

As in the case of linear second-order ODEs, the solution depends on two arbitrary parameters C[1] and C[2].

Here is a plot of the solution for a specific choice of parameters:
This verifies the solution:

The second class of easily solvable nonlinear second-order equations consists of equations that do not depend explicitly on or ; that is, equations of the form . These equations can be reduced to first-order ODEs with independent variable . Inverse functions are needed to give the final solution for .

Here is an example of this type:

The third class consists of equations that do not depend explicitly on ; that is, equations of the form . Once again, these equations can be reduced to first-order ODEs with independent variable .

This example is based on (equation 6.40, page 550 of [K59]). The underlying first-order ODE is an Abel equation. The hyperbolic functions in the solution result from the automatic simplification of Bessel functions:

The fourth class consists of equations that are homogeneous in some or all of the variables , , and . There are several possibilities in this case, but here only the following simple example is considered.

In this equation, each term has a total degree of 2 in the variables , , and . This equation can be solved by transforming it to a first-order ODE:

The fifth and final class of easily solvable nonlinear second-order ODEs consists of equations that are exact or can be made to be exact using an integrating factor.

Here is an example of this type, based on (equation 6.51, page 554 of [K59]):

It is important to note that the solutions to fairly simple-looking nonlinear ODEs can be complicated. Verifying and applying the solutions in such cases is a difficult problem.

Higher-Order ODEs

Overview

The general form of an ODE with order is

As in the case of second-order ODEs, such an ODE can be classified as linear or nonlinear. The general form of a linear ODE of order is

If is the zero function, the equation is said to be homogeneous. This discussion is primarily restricted to that case.

Many methods for solving linear second-order ODEs can be generalized to linear ODEs of order , where is greater than 2. If the order of the ODE is not important, it is simply called a linear ODE.

Equations with Constant Coefficients

A linear ODE with constant coefficients can be easily solved once the roots of the auxiliary equation (or characteristic equation) are known. Some examples of this type follow.

The characteristic equation of this ODE has real and distinct roots: 4, 1, and 7. Hence the solution is composed entirely of exponential functions:
The characteristic equation of this ODE has two pairs of equal roots: and . The repeated roots give rise to the basis of the solutions, :
The characteristic equation for this ODE has two pairs of roots with nonzero imaginary parts: , , , and . Hence the solution basis can be expressed with trigonometric and exponential functions:
Finally, here is an example that combines all the previous kinds of solutions:

Higher-Order Euler and Legendre Equations

An Euler equation is an ODE of the form

The following is an example of an Euler equation:

The Legendre linear equation is a generalization of the Euler equation. It has the form

This is a Legendre linear equation:

Exact Higher-Order Equations

A linear ordinary differential equation of order

is said to be exact if

The condition of exactness can be used to reduce the problem to that of solving an equation of order .

This is an example of an exact ODE:
This verifies the condition for exactness:
This solves the equation:
This verifies the solution:

Further Examples of Higher-Order Equations

The solutions to many second-order ODEs can be expressed in terms of special functions. Solutions to certain higher-order ODEs can also be expressed using AiryAi, BesselJ, and other special functions.

The solution to this third-order ODE is given by products of Airy functions:
The solution to this third-order ODE is given by Bessel functions:
This plot shows the oscillatory behavior of the solutions on different parts of the real line:
The solution to this fourth-order linear ODE is expressed in terms of HypergeometricPFQ:
This verifies that the solution is correct using numerical values:

As for second-order linear ODEs, there are modern algorithms for solving higher-order ODEs with rational coefficients. These algorithms give "rational-exponential" solutions, which are combinations of rational functions and exponentials of the integrals of rational functions. These algorithms are combined with techniques such as reduction of order to produce a complete solution for the given ODE.

The general solution to this equation has a rational term and terms that depend on Airy functions. The Airy functions come from reducing the order of the equation to 2:

The equations considered so far have been homogeneous; that is, with no term free of or its derivatives. If the given ODE is inhomogeneous, DSolve applies the method of variation of parameters to obtain the solution.

Here is an example of this type. The exponential terms in the solution come from the general solution to the homogeneous equation, and the remaining term is a particular solution (or particular integral) to the problem:
This is the general solution to the homogeneous equation:
This particular solution is part of the general solution to the inhomogeneous equation:

Thus, the general solution for the inhomogeneous equation is the sum of the general solution to the homogeneous equation and a particular integral of the ODE.

The solution methods for nonlinear ODEs of higher order rely to a great extent on reducing the problem to one of lower order.

Here is a nonlinear third-order ODE with no explicit dependence on or . It is solved by reducing the order to 2 using a simple integration:

Systems of ODEs

Overview

Systems of ODEs are important in various fields of science, such as the study of electricity and population biology. Like single ODEs, systems of ODEs can classified as linear or nonlinear.

A system of linear first-order ODEs can be represented in the form

Here is a vector of unknown functions, is the matrix of the coefficients of the unknown functions, and is a vector representing the inhomogeneous part of the system.

In the two-dimensional case, the system can be written more concretely as

If all the entries of the matrix are constants, then the system is said to be linear with constant coefficients. If is the zero vector, then the system is said to be homogeneous.

The important global features of the solutions to linear systems can be clarified by considering homogeneous systems of ODEs with constant coefficients.

Linear Systems of ODEs

Here is a system of two ODEs whose coefficient matrix has real and distinct eigenvalues:
This solves the system. Note that the general solution depends on two arbitrary constants C[1] and C[2]:
Here is a plot of some particular solutions obtained by giving specific values to C[1] and C[2]. In this case, the origin is called a node:
In this system, the eigenvalues of the coefficient matrix are complex conjugates of each other:
This solves the system:
This plots the solution for various values of the arbitrary parameters. The spiraling behavior is typical for systems with complex eigenvalues:

Solving homogeneous systems of ODEs with constant coefficients and of arbitrary order is a straightforward matter. They are solved by converting them to a system of first-order ODEs.

This solves a homogeneous system of ODEs of order 3, with constant coefficients:
This verifies the solution:

In general, systems of linear ODEs with non-constant coefficients can only be solved in cases where the coefficient matrix has a simple structure, as illustrated in the following examples.

This first-order system has a diagonal coefficient matrix. The system is uncoupled because the first equation involves only and the second equation depends only on . Thus, each equation in the system can be integrated independently of the other:
The rows of the coefficient matrix for this system form an orthogonal set of vectors:
Here is a system of three first-order ODEs. The coefficient matrix is upper triangular:

As for single ODEs, there are sophisticated modern algorithms for solving systems of ODEs with rational coefficients.

This solves a system of two first-order ODEs with rational coefficients. Note that the solution is composed entirely of rational functions:
In the following example, the algorithm finds one rational solution for and . (The equation for is uncoupled from the rest of the system.) Using the rational solution, DSolve is able to find the remaining exponential solution for and :

The systems considered so far have all been homogeneous. If the system is inhomogeneous (that is, if there are terms free from any dependent variables and their derivatives), DSolve applies either the method of variation of parameters or the method of undetermined coefficients to find the general solution.

This solves an inhomogeneous system:

Particular solutions to the system can be obtained by assigning values to the constants C[1] and C[2].

Here is a plot of the solution for one choice of parameters:

Nonlinear Systems of ODEs

Following are two examples of nonlinear systems of ODEs that can be solved symbolically using DSolve.

The first three equations in this system of four nonlinear ODEs can be solved independently because none of their right-hand sides depend on , , , or :
This system of two nonlinear ODEs is autonomous, in the sense that the right-hand sides of the equations do not depend on :

The previous two examples demonstrate that the solutions to fairly simple systems are usually complicated expressions of the independent variable. In fact, the solution is often available only in implicit form and may thus contain InverseFunction objects or unevaluated Solve objects.

Nonlinear ODEs with Lie Symmetries

Around 1870, Marius Sophus Lie realized that many of the methods for solving differential equations could be unified using group theory. Lie symmetry methods are central to the modern approach for studying nonlinear ODEs. They use the notion of symmetry to generate solutions in a systematic manner. Here is a brief introduction to Lies approach that provides some examples that are solved in this way by DSolve.

A key notion in Lie's method is that of an infinitesimal generator for a symmetry group. This concept is illustrated in the following example.

Here is the well-known transformation for rotations in the - plane. This is a one-parameter group of transformations with parameter :

For a fixed value of , the point (in blue) can be obtained by rotating the line joining (in red) to the origin through an angle of in the counterclockwise direction.

A rotation through can be represented by the matrix

This shows that the set of all rotations in the plane satisfies the properties for forming a group:

The Lie symmetry method requires calculating a first-order approximation to the expressions for the group. This approximation is called an infinitesimal generator.

This expands the expressions for and in a series with respect to and around the origin 0 to obtain linear approximations:
The coefficients of the linear terms in are and , respectively. The infinitesimal generator for the rotation group in the plane is defined to be the following differential operator:
Starting from the infinitesimal generator, the original group can be recovered by integrating the fundamental system of Lie equations. For the group of rotations, the Lie equations are given by the first argument to DSolve shown here:

The rotation group arises in the study of symmetries of geometrical objects; it is an example of a symmetry group. The infinitesimal generator, a differential operator, is a convenient local representation for this symmetric group, which is a set of matrices.

An expression that reduces to 0 under the action of the infinitesimal generator is called an invariant of the group.

Here is an invariant for this group:
This states that the distance from the origin to , , is preserved under rotation:

In the following examples, these ideas are applied to differential equations.

This is an example of a Riccati equation, from page 103 of [I99]:
The equation is invariant under the following scaling transformation:
The infinitesimal generator for this one-parameter group of transformations is found as before:

Now, the Riccati equation depends on three variables: , , and . Hence, the infinitesimal generator must be prolonged to act on all three variables in this first-order equation.

It turns out that the required prolongation is as follows:
This shows that the expression for the Riccati equation in the coordinates is indeed invariant under prolongedv:

Depending on the order of the given equation, the knowledge of a symmetry (in the form of an infinitesimal generator) can be used in three ways.

  • If the order of the equation is 1, it gives an integrating factor for the ODE that makes the equation exact and hence solvable.
  • It gives a set of canonical coordinates in which the equation has a simple (integrable) form.
  • It reduces the problem of solving an ODE of order to that of solving an ODE of order , which is typically a simpler problem.

The DSolve function checks for certain standard types of symmetries in the given ODE and uses them to return a solution. Following are three examples of ODEs for which DSolve uses such a symmetry method.

Here is a nonlinear first-order ODE (equation 1.120, page 315 of [K59]):
This ODE has a symmetry with the following infinitesimal generator:
The presence of this symmetry allows DSolve to calculate an integrating factor and return the solution:
This verifies the solution:
Here is a second-order nonlinear ODE, based on equation 6.93 on page 213 of [K59]:
This equation is invariant under the following scaling transformation:
The presence of this scaling symmetry allows DSolve to find new coordinates in which the independent variable is not explicitly present. Hence the problem is solved easily:
This verifies the solution:
Finally, here is a system of two nonlinear first-order ODEs that can be solved by using a shift: . After the shift, the system becomes autonomous (it does not depend explicitly on ) and hence it can be solved by reduction to a first-order ODE for as a function of . The Solve::ifun message can be ignored; it is generated while inverting the expression for Exp[v] to give an expression in terms of Log:

This concludes the discussion of ordinary differential equations.