2ndOrderODEs_Week1
2ndOrderODEs_Week1
Contents
1. Reduction of order 2
2. Homogeneous linear equations 4
1
Second Order Ordinary Differential Equations
Main idea. A second order differential equation is a relation between an independent
variable x, an unknown function y(x), say, and its first two derivatives with respect to x,
(1) R(y ′′ , y ′ , y, x) = 0 ,
which may also include some explicitly given functions.
1. Reduction of order
Sometimes the problem of solving a second order ODE is short for ordinary differential
equation characterized by the presence of a single independent variable. can be effectively
reduced to solving a first order ODE.
Missing dependent variable. The more obvious case where this approach is possible
occurs if the dependent variable does not appear directly in the equation—only its first
and second derivatives appear. In this case, Eq. (1) takes the form
(2) R(y ′′ , y ′ , x) = 0 ,
Differential equations of this type can often be solved by rewriting them as first order
equations for the first derivative of the unknown function.
Example 1 (Constant acceleration). For a ∈ R constant, find the general solution of
d2 x
(3) = a.
dt2
Solution. Since x does not appear directly, we can treat the velocity, v := ẋ (a dot means
d
dt
) as a new dependent variable. The equation becomes
dv
=a
dt
which integrates to
v = at + v0 ,
with a constant of integration v0 given by the value of v at t = 0. Now we remember
that ẋ = v and integrate once more, to find
Z
x = v dt = 21 at2 + v0 t + x0 ,
The second equation implies that x0 = −1. With this, the first equation simplifies to
0 = C + log 1 = C.
This shows that the function
y(x) = log(x + 1)
is the solution to the initial value problem. ◁
As a check we can compute y ′ = (x+1)−1 and y ′′ = −(x+1)−2 which satisfy y ′′ = −(y ′ )2 ,
as required.
Missing independent variable. A similar approach works–in a slightly more subtle
way—for any autonomous ODE, i.e., whenever the independent variable does not appear
explicitly. This situation is another special case of Eq. (1)
(4) R(y ′′ , y ′ , y) = 0 ,
With x not being present, one can in fact remove every reference to it from the differential
dy
equation, simply by considering y to be a new independent variable and define u := dx to
be the new dependent variable. The crucial observation is to rewrite the second derivative
as follows:
d2 y du dy du du
(5) 2
= = =u ,
dx dx dx dy dy
which eliminates the derivatives with respect to x.
Example 3 (Constant acceleration, again). Equation (3) is also autonomous. It can also
be solved by this method. Assume a > 0.
Solution. Again use the velocity v = ẋ as dependent variable, but now write the equation
as
dv
a = ẍ = v .
dx
This is a separable differential equation since we have a dx = v dv. Integrating both sides
leads to so
dx p
a(x + A) = 21 v 2 or = v = ± 2a(x + A).
dt
This is another separable equation which implies
Z r
dx 2(x + A)
t=± p =B± .
2a(x + A) a
3
Algorithm 2
Autonomous Second Order ODE
(1) Define a new independent variable as the old dependent variable.
(2) Define a new dependent variable as the derivative of the old dependent variable.
(3) Rewrite the old second derivative in terms of these new variables as in Eq. (5).
(4) Solve the resulting first order equation.
(5) Rewrite the solution in terms of the original variables (giving another first order
ODE).
(6) Solve this.
Example 4. Solve
0 = y ′′ + y .
Solution. Define u := y ′ to rewrite the equation as 0 = u du
dy
+ y. Hence, we have
0 = y dy + u du so that y 2 + u2 = C1 ,
dy
p
with some constant C1 . Thus, dx = u = ± C1 − y 2 which implies that, for some range
of x and y, the solution is
Z
dy
x=± p
C1 − y 2
Z
dt −1 −1 y
=± √ = C2 ± sin t = C2 ± sin √ ,
1 − t2 C1
√
where we have introduced the variable t := y/ C1 . Solving for y, this gives
p
y = ± C1 sin(x − C2 ).
Using the angle addition formula for the sine, this function can also be written as
(6) y = A cos x + B sin x
√ √
where A := ∓ C1 sin C2 and B := ± C1 cos C2 . ◁
As can be readily checked, both expressions indeed solve the original differential equa-
tion. Taking the form in Eq. (6), for instance, we have y ′ = −A sin x + B cos x and thus
y ′′ = −A cos x − B sin x, so that finally y ′′ + y = 0.
It will sometimes be useful to give a name to the left side of Eq. (7), by writing
d2 y dy
(8) L[y] := 2
+ p(x) + q(x)y .
dx dx
The quantity L[·] (sometimes we’ll just write L) is known as a differential operator ; it is
a device that takes one function as an input and outputs another function. A solution of
Eq. (7) now is seen to be any function that is mapped to zero—or annihilated—by the
operator L, i.e., L[y] = 0 holds.
The operator L is also linear in the sense that L[y1 + y2 ] = L[y1 ] + L[y2 ] and for any
constant, A, L[Ay] = A L[y]. This has an immediate, nice consequence.
Proof. Let y1 and y2 be solutions of Eq. (7), and A and B be constants. If y = Ay1 + By2 ,
then
L[y] = L[Ay1 ] + L[By2 ] = A L[y1 ] + B L[y2 ] = 0 ,
therefore y is a solution of Eq. (7). □
So, if y1 and y2 are linearly independent solutions of (7), then the arbitrary linear
combination Ay1 + By2 is a two-parameter family of distinct solutions, and so it is the
general solution of Eq. (7).
These results carry over to homogeneous linear ODEs of order n, but in that case we
will need n independent solutions to construct the general solution.
Constant coefficients. Homogeneous linear, second order ODEs are in general impos-
sible to solve explicitly, so we now consider just autonomous ones — i.e., those with con-
stant coefficients. This situation corresponds to having constants instead of x-dependant
functions p(x) and q(x) in Eq. (8).
Example 5. Solve the first order homogeneous linear ODE with constant coefficients
given by
dy
+ ay = 0 ,
dx
with some constant a.
dy
Solution. This is separable, as y
= −a dx. Integrating gives
log y = −ax + c,
and hence the general solution reads
y = Ce−ax ,
depending on one free parameter C = ec . ◁
5
Before tackling second order equations with constant coefficients, let us mention an
important part of solving mathematical problems which is to use an educated guess that
we call an Ansatz.
Definition 2 (Ansatz). An ansatz is a guess for the form of the solution to a problem
such as a differential equation. Typically, the proposed solution includes one or more
free parameters. The idea is then to check whether the guess solves the problem for
particular values of the free parameters.
The most general second order, homogeneous linear ODE with constant coefficients
can be written as
(9) y ′′ + ay ′ + by = 0
Could we take some inspiration from Example 5, possibly solving Eq. (9) by an exponen-
tial function? In other words, we might try the exponential function y = eλx as an ansatz
for solving the homogeneous linear differential equation with constant coefficients. If we
do so, we obtain
0 = y ′′ + ay ′ + by
= λ2 eλx + aλeλx + beλx = (λ2 + aλ + b)eλx .
Since eλx ̸= 0, we see that the parameter λ must satisfy a constraint in order that the
ansatz be a solution,
(10) 0 = λ2 + aλ + b .
This equation is called the auxiliary equation (or auxiliary polynomial ) associated with
Eq. (9). The auxiliary equation can be obtained by replacing the nth derivativeThis recipe
works equally well for higher order linear equations with constant coefficients. of y with
the nth power of λ.
If the auxiliary equation (10) has different roots, then they give different solutions to
Eq. (9). Taking linear combinations of them results in the general solution of the original
equation.
Let us go through a number of explicit examples for some practice.
Example 6. Find the solution of
(11) y ′′ + y ′ − 2y = 0
with initial conditions y(0) = 0 and y ′ (0) = 1.
Solution. Assuming a solution of the form y = eλx we find the auxiliary equation
0 = λ2 + λ − 2 = (λ + 2)(λ − 1),
so e−2x and ex are solutions of the differential equation, and the linear combination
y = Ae−2x + Bex
is the general solution, depending on two constant A and B.
The first derivative is y ′ = −2Ae−2x + Bex , so the initial conditions require
0 = y(0) = A + B =⇒ B = −A
1 = y ′ (0) = −2A + B = −3A
therefore A = − 31 and B = 31 . Hence, the solution to the initial value problem is given
by
y(x) = − 13 e−2x + 31 ex . ◁
6
To verify this result we can compute the first two derivatives y ′ = 23 e−2x + 13 ex and
y ′′ = − 34 e−2x + 13 ex , to confirm that
y ′′ + y ′ − 2y = (− 34 e−2x + 13 ex ) + ( 23 e−2x + 13 ex ) + 2(− 13 e−2x + 13 ex ) = 0,
y(0) = − 13 + 1
3
= 0,
and that
y ′ (0) = 2
3
+ 1
3
= 1.
Example 7. Find the general solution of
y ′′ + y = 0,
again, now using an exponential function as an ansatz. [Recall that in Example 4 we
solved this another way.]
Solution. Taking y = eλx , the auxiliary equation becomes 0 = λ2 + 1. Its roots are
imaginary, λ = ±i, which means that the complex exponentials e±ix are solutions of
the differential equation. Their linear combination provides the desired general solution
y = Ceix + De−ix . ◁
While correct, the expression in terms of the exponentials e±ix is not always convenient
if we are interested in real For instance, it may be clear from the problem we are solving
that the solution must be real. solutions. However, we can write
y = C(cos x + i sin x) + D(cos x − i sin x)
= (C + D) cos x + i(C − D) sin x
= A cos x + B sin x ,
where A = C + D and B = i(C − D). The advantage of this formula is that y is real if
and only if A and B are real numbers.
In general, if α + iβ and α − iβ are roots of the auxiliary equation, then these give two
solutions of the differential equation:
e(α±iβ)x = eαx e±iβx = eαx (cos βx ± i sin βx).
We can combine them to obtain a pair of real linearly independent solutions, namely
(α+iβ)x
1
+ e(α−iβ)x = eαx cos βx
2
e
and
(α+iβ)x
1
− e(α−iβ)x = eαx sin βx.
2i
e
If the ODE has real coefficients then any complex roots of the auxiliary equation always
occur with their conjugate.
Example 8. Find the general solution of
y ′′ − 2y ′ + 2y = 0.
Solution. Assuming y = eλx we get the auxiliary equation 0 = λ2 − 2λ + 2, which has
roots λ = 1 ± i, so ex cos x and ex sin x are solutions of the differential equation.
Combining these two solutions gives the general solution,
y = Aex cos x + Bex sin x = ex (A cos x + B sin x). ◁
7
If we are solving a second order equation we expect there to be two unknown con-
stants in the general solution, corresponding to two linearly independent solutions of the
homogeneous equation.What happens if the auxiliary equation has repeated roots? In
that case, exponential functions on their own will not provide the necessary number of
solutions.
Example 9. Find the general solution of
(12) y ′′ − 2y ′ + y = 0.
Solution. Assuming y = eλx we obtain the auxiliary equation 0 = λ2 − 2λ + 1 = (λ − 1)2 ,
therefore y = ex is a solution, but there is no second, independent, exponential solution.