7. Differential equations: Part 1¶
The first lecture on differential equations consists of three parts, each with a video embedded in the paragraph:
 7.1. First examples of differential equations
 7.2. Theory of systems of firstorder differential equations
 7.3. Solving homogeneous firstorder differential equations with constant coefficients
Total video length: 1 hour 15 minutes 4 seconds
and at the end of the lecture notes, there is a set of corresponding exercises:
7.1. First examples of differential equations: Definitions and strategies¶
7.1.1. Definitions¶
A differential equation or DE is any equation which involves both a function and a derivative of that function. In this lecture, we will be focusing on Ordinary Differential Equations (ODEs), meaning that our equations will involve functions of one independent variable and hence any derivatives will be full derivatives. Equations which involve a function of several independent variables and their partial derivatives are called Partial Differential Equations (PDEs); they will be introduced in the followup lecture.
We consider functions and define , . An th order differential equation is an equation of the form:
Typically, . Such an equation will usually be presented with a set of initial conditions,
This is because to fully specify the solution of an th order differential equation, initial conditions are necessary (we need to specify the value of derivatives of and as well the value of the function for some ). To understand why we need initial conditions, look at the following example.
Example: Initial conditions
Consider the following calculus problem,
By integrating, one finds that the solution to this equation is
where is an integration constant. In order to specify the integration constant, an initial condition is needed. For instance, if we know that when then , we can plug this into the equation to get
which implies that .
Essentially, initial conditions are needed when solving differential equations so that the unknowns resulting from integration may be determined.
Terminology for Differential Equations
 If a differential equation does not explicitly contain the independent variable , it is called an autonomous equation.
 If the largest derivative in a differential equation is of the first order, i.e. , then the equation is called a first order differential equation.
 Often you will see differential equations presented using instead of . This is just a different nomenclature.
In this course, we will be focusing on Linear Differential Equations, meaning that we consider differential equations where the function is a linear polynomial function of the unknown function . A simple way to spot a nonlinear differential equation is to look for nonlinear terms, such as or .
Often, we will be dealing with several coupled differential equations. In this situation, we can write the entire system of differential equations as a vector equation, involving a linear operator. For a system of equations, denote
A system of first order linear equations is then written as
with the initial condition .
7.1.2. Basic examples and strategies for a (single) firstorder differential equation¶
Before focusing on systems of first order equations, we will first consider examplary cases of single firstorder equations with only one unknown function . In this case, we can distinguish important cases.
Type 1: ¶
The simplest type of differential equation is the type usually learned about in the integration portion of a calculus course. Such equations have the form,
When is an antiderivative of i.e. , then the solutions to this type of equation are
What is the antiderivative?
You may know the antiderivative of a function under a different name  it is the same as the indefinite integral: . Remember that taking an integral is essentially the opposite of differentiation, and indeed taking an integral means finding a function such that . In the context of differential equations we prefer to call this the antiderivative as solving the differential equation means essentially undoing the derivative.
Note that the antiderivative is only defined up to a constant (as is the indefinite integral). In practice, you will thus find some particular expression for through integration. To capture all possible solutions, don't forget the integration constant in the expression above!
Example
Given the equation
one finds by integrating that the solution is .
Type 2: ¶
The previous example was easy, as the function did not enter in the righthand side. A second important case that we can solve explicitly is when the righthand side is some function of :
This implies that . Let be the antiderivative of . Then, by making use of the chain rule:
From this, we notice that if we can solve for , then we have the solution! Having a specific form for the function can often make it possible to solve either implicitly or explicitly for the function .
Example
Given the equation
rewrite the equation to be in the form
Now, applying the same process which was shown through just above, let and be the antiderivative of the . Integrating allows us to find the form of this antiderivative.
Now, making use of the general solution we also have that . These two equations can be combined to form an equation for ,
where in the last line we defined a new constant . Given an initial condition, we could immediately determine this constant .
Type 3: ¶
So far we have considered onle DE's where the righthand side is either a function of or of . We can still solve a more generic case, if we can separate the two dependencies as:
This type of differential equation is called a first order differential equation with nonconstant coefficients. If is linear in then it is also said to be a linear equation.
This equation can be rewritten to isolate the coefficient function, g(t)
Now, define to be the antiderivative of , and to be the antiderivative of . Without showing again the use of chain rule on the left side of the equation, we have
Given this form of a general solution, the knowledge of specific functions would make it possible to solve for .
Example
Let us apply the above strategy to the following equation,
The strategy indicates that we should define and . As before, we can rearrange the equation into the form:
It is then necessary to find , the antiderivative of , or the left hand side of the above equation, as well as , the antiderivative of , or the right hand side of the previous equation.
By integrating, one finds
Accordingly then, the intermediate equation we have is
At this point, it is possible to solve for by rearrangement
where in the last line we have defined . Once again, specification of an initial condition would enable determination of directly. To see this, suppose . By inserting this into the equation for , we get
When solved for , with the choice of initial condition , the full equation for becomes
Example: First order linear differential equation with general nonconstant coefficient function
Let us apply the above strategy of dealing with nonconstant coefficient functions to the more general equation
This equation suggests that we first define and then find and , the antiderivatives of and , respectively. By doing so, we determine that
Follow the protocol subsequently, we arrive at the equation
Exponentiating and defining delivers the equation for ,
So far, we have only considered first order differential equations. If we consider extending the strategies which we have developed to higher order equations such as
with f(x) being a linear function, then our work will swiftly become more tedious. Later on, we will develop a general theory for linear equations which will enable us to tackle such higher order equations. For now, we move on to considering systems of coupled first order linear DE's.
7.2. Theory of systems of differential equations¶
An intuitive presentation of a system of coupled first order differential equations can be given by a phase portrait. Before demonstrating such a portrait, let us introduce a useful notation for working with systems of DE's. Several coupled DE's can be written down concisely as a single vector equation:
In such an equation, the vector is the rate of change of a vector quantity, for example; the velocity which is the rate of change of the position vector. The term describes a vector field, which has one vector per point . This type of equation can also be extended to include a time varying vector field, .
In the phase portrait below, the velocities of the cars are determined by the vector field , where their velocity corresponds to the slope of each arrow. The position of each of the little cars is determined by an initial condition. Since the field lines do not cross and the cars begin on different field lines, they will remain on different field lines.
Properties of a system of 1st order linear DEs
If is not crazy, for example  if it is continuous and differentiable, then it is possible to prove the following two properties for a system of first order linear DE's
 Existence of solution: For any specified initial condition, there is a solution.
 Uniqueness of solution: Any point is uniquely determined by the initial condition and the equation i.e. we know where each point "came from" .
7.2.1. Systems of linear first order differential equations¶
7.2.1.1. Homogeneous systems¶
Any homogeneous system of first order linear DE's can be written in the form
where is a linear operator. The system is called homogeneous because it does not contain any additional term which is not dependent on (for example an additive constant or an additional function depending only on t).
Linearity of a system of DEs
An important property of such a system is linearity, which has the following implications
 If is a solution ,then is a solution too, for any constant c
 If and are both solutions, then so is , where and are both constants.
These properties have special importance for modelling physical systems, due to the principle of superposition which is especially important in quantum physics, as well as electromagnetism and fluid dynamics. For example, in electromagnetism, when there are four charges arranged in a square acting on a test charge located within the square, it is sufficient to sum the individual forces in order to find the total force. Physically, this is the principle of superposition, and mathematically, superposition is linearity and applies to linear models.
General Solution
For a system of linear first order DE's with linear operator , the general solution can be written as
where are independent solutions which form a basis for the solution space, and are constants.
are a basis if and only if they are linearly independent for fixed :
If this condition holds for one , it holds for all .
7.2.2.2 Inhomogeneous systems¶
Compared to the homogeneous equation, an inhomogeneous equation has an additional term, which may be a function of the independent variable.
Relation between a solutions of a homogeneous and inhomogeneous equations
There is a simple connection between the general solution of an inhomogeneous equation and the corresponding homogeneous equation. If and are two solutions of the inhomogeneous equation, then their difference is a solution of the homogeneous equation
The general solution of the inhomogeneous equation can be written in terms of the basis of solutions for the homogeneous equation, plus one particular solution to the inhomogeneous equation,
In the above equation, form a basis for the solution space of the homogeneous equation and is a particular solution of the inhomogeneous system.
Strategy of finding the solution of the inhomogeneous equation
Now we need a strategy for finding the solution of the inhomogeneous equation. Begin by making an ansatz that can be written as a linear combination of the basis functions for the homogeneous system, with coefficients that are functions of the independent variable.

Ansatz:

Define the vector and matrix as

With these definitions, it is possible to rewrite the ansatz for ,

Using the Leibniz rule, we then have the following expanded equation,

Substituting the new expression into the differential equation gives,
In order to cancel terms in the previous line, we made use of the fact that solves the homogeneous equation .

By way of inverting and integrating, we can write the equation for the coefficient vector

With access to a concrete form of the coefficient vector, we can then write down the particular solution,
Example: Inhomogeneous first order linear differential equation
The technique for solving a system of inhomogeneous equations also works for a single inhomogeneous equation. Let us apply the technique to the equation
In this particular inhomogenous equation, the function . As discussed in an earlier example, the solution to the homogenous equation is . Hence, we define and make the ansatz
Solving for results in
Overall then, the solution (which can be easily verified by substitution) is
7.3. Solving homogeneous linear system with constant coefficients¶
The type of equation under consideration in this section looks like
where, throughout this section, will be a constant matrix. It is possible to define a formal solution using the matrix exponential, .
Definition: Matrix Exponential
Before defining the matrix exponential, recall the definition of the regular exponential function in terms of Taylor series,
in which it is agreed that . The matrix exponential is defined in exactly the same way, only now instead of taking powers of a number or function, powers of a matrix are calculated with
It is important to use caution when translating the properties of the normal exponential function over to the matrix exponential, because not all of the regular properties hold generally. In particular,
unless it happens that
The necessary condition for this property to hold, stated on the previous line, is called commutativity. Recall that in general, matrices are not commutative so such a condition is only met for particular choices of matrices. The property of noncommutativity (what happens when the condition is not met) is of central importance in the mathematical structure of quantum mechanics. For example, mathematically, noncommutativity is responsible for the Heisenberg uncertainty relations.
On the other hand, one property that does hold, is that is the inverse of the matrix exponential of .
Furthermore, it is possible to derive the derivative of the matrix exponential by making use of the Taylor series formulation,
Armed with the matrix exponential and it's derivative, , it is simple to verify that the matrix exponential solves the differential equation.
Properties of the solution using the matrix exponential:
 The columns of form a basis for the solution space.
 Accounting for initial conditions, the full solution of the equation is , with initial condition . (here is the identity matrix)
Next, we will discuss how to determine a solution in practice, beyond the formal solution just presented.
Case 1: is diagonalizable¶
For an matrix , denote the distinct eigenvectors as . By definition, the eigenvectors satisfy the equation
Here, we give consideration to the case of distinct eigenvectors, in which case the eigenvectors form a basis for .
Strategy for finding solution when is diagonizable
 To solve the equation , define a set of scalar functions and make the following ansatz:

Then, by differentiating,

The above equation can be combined with the differential equation for , to derive the following equations,
where in the second last line, we make use of the fact that is an eigenvector of .

The obtained relation implies that
This is a simple differential equation, of the type dealt with in the third example.

The solution is found to be
with being a constant.

The general solution is found by adding all of the solutions ,
and the vectors form a basis for the solution space since (the eigenvectors are linearly independent).
Example: Homogeneous first order linear system with diagonalizable constant coefficient matrix
Define the matrix and consider the DE
To proceed by following the solution technique, we determine the eigenvalues of ,
By solving the characteristic polynomial, one finds the two eigenvalues .
Focusing first on the positive eigenvalue, we can determine the first eigenvector,
A solution to this eigenvector equation is given by , , altogether implying that
As for the second eigenvalue, , we can solve the analogous eigenvector equation to determine
Hence, two independent solutions of the differential equation are:
Before we can obtain the general solution of the equation, we must find coefficients for the linear combination of the two solutions which would satisfy the initial condition. To this end, we must solve:
The second row of the vector equation for implies that . The first row then implies that .
Overall then, the general solution of the DE can be summarized
Case 2: by is defective¶
In this case, we consider the situation where has a root with multiplicity 2, but only one eigenvector .
Example: Matrix with eigenvalue of multiplicity 2 and only a single eigenvector. (Part 1)
Consider the matrix
The characteristic polynomial can be found by evaluating
Hence, the matrix has the single eigenvalue with multiplicity 2. As for finding an eigenvector, we solve
These equations, and imply that and can be chosen arbitrarily, for example as . Then, the only eigenvector is
What is the problem in this case? Since there are equations to be solved and an linear operator , the solution space for the equation requires a basis of solutions. In this case however, there are eigenvectors, so we cannot use only these eigenvectors in forming a basis for the solution space.
Strategy for finding a solution when by is defective

Suppose that we have a system of coupled equations, so that is a matrix, which has eigenvalue with multiplicity . As in the previous section, we can form one solution using the single eigenvector ,

To determine the second linearly independent solution, make the following ansatz:

With this ansatz, it is then necessary to determine an appropriate vector such that is really a solution of this problem. To achieve that, take the derivative of ,

Also, write the matrix equation for ,

Since must solve the equation , we can combine and simplify the previous equations to write

With this condition, it is possible to write the general solution as
Example: Continuation of the example with defective (Part 2)
Now, our task is to apply the condition derived just above in order to solve for ,
Hence, and is undetermined, so may be taken as . Then,
Overall then, the general solution is
Bonus case 3: Higher multiplicity eigenvalues¶
In this case, we consider the situation where the matrix has an eigenvalue with multiplicity , and only one eigenvector corresponding to , . Notice here that must be at least an matrix.
To solve such a situation, we will expand upon the result of the previous section and define the vectors through by
Then, the subset of the basis of solutions corresponding to eigenvalue is formed by the vectors
To prove this, first take the derivative of ,
Then, for comparison, multiply by
Notice that in the second last line we made use of the relations .
This completes the proof since we have demonstrated that is a solution of the DE.
7.4. Problems¶

[] Solve:
(a)
(b)

[] Solve, subject to the initial condition :
(a)
(b)
(c)

[] Solve, subject to the given initial condition:
(a) , subject to .
(b) , subject to .
Hint: it is fine if you use a computer algebra program to solve the integrals for these problems.

[] Solve the following equation and list all possible solutions:
Hint:

[] Identify which of the following systems of equations is linear.
Note that you do not need to solve them!
(a)
(b)
(c)

[] Take the system of equations:
Show that
and
constitute a basis for the solution space of this system of equations. To this end, first verify that they are indeed solutions and then that they form a basis.

[] Take the system of equations:
Rewrite this system of equations into the general form
and then find the general solution. Specify the general solution for the following initial conditions
(a)
(b)

[] Find the general solution of
Then, specify the solution for the initial conditions
(a)
(b)

[] Find the general solution of the system of equations: