Chapter 08.01: Prerequisites to Numerical Methods for Solving Ordinary Differential Equations

Lesson: Why Do We Need Ordinary Differential Equations?

Learning Objectives

After successful completion of this lesson, you should be able to:

1) find why some mathematical models are given by ordinary differential equations

  

Introduction

Differential equations have applications in all areas of science and engineering. A mathematical formulation of most of the physical and engineering problems leads to differential equations. So, it is crucial for engineers and scientists to know how to set up differential equations and solve them.

An equation that consists of derivatives is called a differential equation, and they are of two types

- ordinary differential equations (ODE)

- partial differential equations (PDE)

An ordinary differential equation has only one independent variable. Examples of ordinary differential equations include

\[\frac{d^{2}y}{dx^{2}} + 2\frac{{dy}}{{dx}} + y = 0, \frac{{dy}}{{dx}}(0) = 2,\ y(0) = 4,\]

\[\frac{d^{3}y}{dx^{3}} + 3\frac{d^{2}y}{dx^{2}} + 5\frac{{dy}}{{dx}} + y = \sin x,\ \frac{d^{2}y}{dx^{2}}(0) = 12,\ \frac{{dy}}{{dx}}(0) = 2,\ y(0) = 4\]

where \(x\) is the independent variable, and \(y\) is the dependent variable.

Ordinary differential equations are classified in terms of order and degree. The order of an ordinary differential equation is the same as the highest derivative, and the degree of an ordinary differential equation is the power of the highest derivative. Thus the differential equation,

\[x^{3}\frac{d^{3}y}{dx^{3}} + x^{2}\frac{d^{2}y}{dx^{2}} + x\frac{{dy}}{{dx}} + xy = e^{x}\]

is of order 3 and degree 1, whereas the differential equation

\[\left( \frac{{dy}}{{dx}} + 1 \right)^{2} + x^{2}\frac{{dy}}{{dx}} = \sin x\]

is of order 1 and degree 2.

An engineer’s approach to differential equations is different from a mathematician. While the latter is interested in the mathematical solution, an engineer should interpret the result physically. So, an engineer’s approach can be divided into three phases:

- formulation of a differential equation from a given physical situation,

- solving the differential equation, and

- interpreting the results physically for implementation.

  

Formulation of differential equations

So the main question we have in this lesson is why we get differential equations in the first place. As discussed above, the formulation of a differential equation is based on a given physical situation.Let us illustrate it by a spring-mass-damper system.

Figure 1. Spring-mass damper system

Above is the schematic diagram of a spring-mass-damper system. A block is suspended freely using a spring. As most physical systems involve damping - viscous damping, dry damping, magnetic damping, etc., a damper or dashpot is attached to account for viscous damping.

Let the mass of the block be \(M\), the spring constant be \(K\), and the damper coefficient be \(b\). If we measure displacement from the static equilibrium position, we need not consider gravitational force as it is balanced by tension in the spring at equilibrium.

Below is the free-body diagram of the block at static and dynamic equilibrium. So, the equation of motion is given by

\[Ma = F_{S} + F_{D}\;\;\;\;\;\;\;\;\;\;\;\; (1)\]

where

\[F_{S}\ \text{is the restoring force due to spring.}\]

\[F_{D}\ \text{is the damping force due to the damper.}\]

\[a\ \text{is the acceleration.}\]

The restoring force in the spring is given by

\[F_{S} = - Kx\;\;\;\;\;\;\;\;\;\;\;\; (2)\]

as the restoring force is proportional to the displacement. The damping force in the damper is given by

\[F_{D} = - bv\;\;\;\;\;\;\;\;\;\;\;\; (3)\]

as the damping force is directly proportional to velocity.

Therefore, the equation of motion can be written as

\[Ma = - Kx - bv\;\;\;\;\;\;\;\;\;\;\;\; (4)\]

At this stage, Equation (4) is a simple equation, where if we know five of the six variables, we can calculate the sixth one. However, such an expectation is not suitable. Assuming that the physical constants, \(M,\ K,\) and \(b\) are fixed and known, we are still left with three variables \(a\),\(\ v,\) and \(x\). Now, again, if we now know two of the three variables, \(a\),\(\ v,\) and \(x\), we can calculate the unknown one. However, such an expectation is still not suitable. But you recognize that

\[v = \frac{{dx}}{{dt}}\]

\[a = \frac{d^{2}x}{dt^{2}}\]

and hence from Equation (4), we get

\[M\frac{d^{2}x}{dt^{2}} = - Kx - b\frac{{dx}}{{dt}}\]

\[M\frac{d^{2}x}{dt^{2}} + b\frac{{dx}}{{dt}} + Kx = 0\;\;\;\;\;\;\;\;\;\;\;\; (5)\]

Equation (5) is an ordinary differential equation of second order and degree one. We have reduced Equation (4) from three variables to one at the expense of converting it into an ordinary differential equation. Moreover, two initial conditions, one on \(x\) and another on \(\displaystyle v = \frac{{dx}}{{dt}}\) are expected to be available.

Lesson: Solving First-Order Ordinary Differential Equations Exactly

Learning Objectives

After successful completion of this lesson, you should be able to:

1) solve the linear ordinary differential equation of first order with fixed constants by using a classical solution technique.

  

Introduction

In this lesson, we will revisit the classical solution technique used to solve ordinary differential equations. Knowing this technique is a prerequisite to the course.

  

Classical Technique

The general form of a linear ordinary differential equation with constant coefficients is given by

\[\frac{d^{n}y}{dx^{n}} + k_{n}\frac{d^{n - 1}y}{dx^{n - 1}} + ......... + k_{3}\frac{d^{2}y}{dx^{2}} + k_{2}\frac{{dy}}{{dx}} + k_{1}y = F(x)\;\;\;\;\;\;\;\;\;\;\;\; (1)\]

The general solution contains two parts

\[y = y_{H} + y_{P}\;\;\;\;\;\;\;\;\;\;\;\; (2)\]

where

\[y_{H}\ \text{is the homogeneous part of the solution and}\]

\[y_{P}\ \text{is the particular part of the solution.}\]

You can skip to the examples if you are already familiar with the theory.

  

Homogenous Part of the Solution

The homogeneous part of the solution \(y_{H}\) is that part of the solution that gives zero when substituted in the left-hand side of the equation. So, \(y_{H}\) is the solution of the equation

\[\frac{d^{n}y}{dx^{n}} + k_{n}\frac{d^{n - 1}y}{dx^{n - 1}} + ......... + k_{3}\frac{d^{2}y}{dx^{2}} + k_{2}\frac{{dy}}{{dx}} + k_{1}y = 0\;\;\;\;\;\;\;\;\;\;\;\; (3)\]

Equation (3) can be symbolically written as

\[D^{n}y + k_{n}D^{n - 1}y + ................. + k_{2}{Dy} + k_{1}y = 0\;\;\;\;\;\;\;\;\;\;\;\; (4)\]

\[(D^{n} + k_{n}D^{n - 1} + ................. + k_{2}D + k_{1})y = 0\;\;\;\;\;\;\;\;\;\;\;\; (5)\]

where,

\[D^{n} = \frac{d^{n}}{dx^{n}}\]

\[D^{n - 1} = \frac{d^{n - 1}}{dx^{n - 1}}.\]

\[\vdots\]

operating on \(y\) is the same as

\[(D - r_{1}),(D - r_{2}),\ (D - r_{n})\]

operating one after the other in any order, where

\[(D - r_{1}),(D - r_{2}),............,(D - r_{n})\]

are factors of

\[D^{n} + k_{n}D^{n - 1} + ............... + k_{2}D + k_{1} = 0\;\;\;\;\;\;\;\;\;\;\;\; (6)\]

To illustrate

\[(D^{2} - 3D + 2)y = 0\]

is same as

\[(D - 2)(D - 1)y = 0\]

\[(D - 1)(D - 2)y = 0\]

Therefore

\[(D^{n} + k_{n}D^{n - 1} + .................... + k_{2}D + k_{1})y = 0\;\;\;\;\;\;\;\;\;\;\;\; (7)\]

is same as

\[(D - r_{n})(D - r_{n - 1})..................(D - r_{1})y = 0\;\;\;\;\;\;\;\;\;\;\;\; (8)\]

operating one after the other in any order.

  

Case 1: Roots are real and distinct

The entire left-hand side becomes zero if \(\left( D - r_{1} \right)y = 0\). Therefore, the solution to \(\left( D - r_{1} \right)y = 0\) is a solution to a homogeneous equation. \(\left( D - r_{1} \right)y = 0\) is called Leibnitz’s linear differential equation of first order, and its solution is

\[\left( D - r_{1} \right)y = 0\;\;\;\;\;\;\;\;\;\;\;\; (9)\]

\[\frac{{dy}}{{dx}} = r_{1}y\;\;\;\;\;\;\;\;\;\;\;\; (10)\]

\[\frac{{dy}}{y} = r_{1}{dx}\;\;\;\;\;\;\;\;\;\;\;\; (11)\]

Integrating both sides, we get

\[\ln y = r_{1}x + c\]

\[y = ce^{r_{1}x}\;\;\;\;\;\;\;\;\;\;\;\; (12)\]

Since any of the \(n\) factors can be placed before \(y\), there are \(n\) different solutions corresponding to \(n\) different factors given by

\[C_{n}e^{r_{n}x},C_{n - 1}e^{r_{n - 1}x},..............,C_{2}e^{r_{2}x},C_{1}e^{r_{1}x}\]

where

\[r_{n,}r_{n - 1},...........,r_{2},r_{1}\ \text{are the roots of Equation (12) and}\]

\[C_{n,}C_{n - 1},......,C_{2},C_{1}\ \text{are constants.}\]

We get the general solution for a homogeneous equation by superimposing the individual Leibnitz’s solutions. Therefore

\[y_{H} = C_{1}e^{r_{1}x} + C_{2}e^{r_{2}x} + ............. + C_{n - 1}e^{r_{n - 1}x} + C_{n}e^{r_{n}x}\;\;\;\;\;\;\;\;\;\;\;\; (13)\]

  

Case 2: Roots are real and identical

If two roots of a homogeneous equation are equal, say \(r_{1} = r_{2}\), then

\[(D - r_{n})(D - r_{n - 1})......................(D - r_{1})(D - r_{1})y = 0\;\;\;\;\;\;\;\;\;\;\;\; (14)\]

Let’s work at

\[(D - r_{1})(D - r_{1})y = 0\;\;\;\;\;\;\;\;\;\;\;\; (15)\]

If

\[(D - r_{1})y = z\;\;\;\;\;\;\;\;\;\;\;\; (16)\]

then

\[(D - r_{1})z = 0\]

\[z = C_{2}e^{r_{1}x}\;\;\;\;\;\;\;\;\;\;\;\; (17)\]

Now substituting the solution from Equation (17) in Equation (16)

\[(D - r_{1})y = C_{2}e^{r_{1}x}\]

\[\frac{{dy}}{{dx}} - r_{1}y = C_{2}e^{r_{1}x}\]

\[e^{- r_{1}x}\frac{{dy}}{{dx}} - r_{1}e^{- r_{1}x}y = C_{2}\]

\[\frac{d(e^{- r_{1}x}y)}{{dx}} = C_{2}\]

\[d(e^{- r_{1}x}y) = C_{2}{dx}\;\;\;\;\;\;\;\;\;\;\;\; (18)\]

Integrating both sides of Equation (18), we get

\[e^{- r_{1}x}y = C_{2}x + C_{1}\]

\[y = (C_{2}x + C_{1})e^{r_{1}x}\;\;\;\;\;\;\;\;\;\;\;\; (19)\]

Therefore, the final homogeneous solution is given by

\[y_{H} = \left( C_{1} + C_{2}x \right)e^{r_{1}x} + C_{3}e^{r_{3}x} + ... + C_{n}e^{r_{n}x}\;\;\;\;\;\;\;\;\;\;\;\; (20)\]

Similarly, if \(m\) roots are identical, the solution is given by

\[y_{H} = \left( C_{1} + C_{2}x + C_{3}x^{2} + ....... + C_{m}x^{m - 1} \right)e^{r_{m}x} + C_{m + 1}e^{r_{m + 1}x} + ... + C_{n}e^{r_{n}x}\;\;\;\;\;\;\;\;\;\;\;\; (21)\]

  

Case 3: Roots are complex

If one pair of roots is complex, say \(r_{1} = \alpha + i\beta\) and \(r_{2} = \alpha - {i \beta }\),

where

\[i = \sqrt{- 1}\]

then

\[y_{H} = C_{1}e^{\left( \alpha + {i \beta } \right)x} + C_{2}e^{\left( \alpha - {i \beta } \right)x} + C_{3}e^{r_{3}x} + ...... + C_{n}e^{r_{n}x}\;\;\;\;\;\;\;\;\;\;\;\; (22)\]

Since

\[e^{i \beta x} = \cos\beta x + i\sin\beta x,\ \text{and}\;\;\;\;\;\;\;\;\;\;\;\; (23a)\]

\[e^{- {i \beta x}} = \cos\beta x - i\sin\beta x\;\;\;\;\;\;\;\;\;\;\;\; (23b)\]

then

\[\begin{split} y_{H} &= C_{1}e^{{\alpha x}}\left( \cos\beta x + i\sin\beta x \right) + C_{2}e^{{\alpha x}}\left( \cos\beta x - i\sin\beta x \right) + C_{3}e^{r_{3}x} + .... + C_{n}e^{r_{n}x}\\ &= \left( C_{1} + C_{2} \right)e^{{\alpha x}}\cos\beta x + i\left( C_{1} - C_{2} \right)e^{{\alpha x}}\sin\beta x + C_{3}e^{r_{3}x} + .... + C_{n}e^{r_{n}x}\\ &= e^{{\alpha x}}\left( A\cos\beta x + B\sin\beta x \right) + C_{3}e^{r_{3}x} + .... + C_{n}e^{r_{n}x}\;\;\;\;\;\;\;\;\;\;\;\; (24) \end{split}\]

where

\[A = C_{1} + C_{2}\ \text{and}\]

\[B = i(C_{1} - C_{2})\;\;\;\;\;\;\;\;\;\;\;\; (25)\]

  

Particular Part of the Solution

Now, let us look at how the particular part of the solution is found. Consider the general form of the ordinary differential equation

\[\left( D^{n} + k_{n}D^{n - 1} + k_{n - 1}D^{n - 2} + .......... + k_{1} \right)y = F(x)\;\;\;\;\;\;\;\;\;\;\;\; (26)\]

The particular part of the solution \(y_{P}\) is that part of the solution that gives \(F(x)\) when substituted for \(y\) in the above equation, that is,

\[\left( D^{n} + k_{n}D^{n - 1} + k_{n - 1}D^{n - 2} + ...... + k_{1} \right)y_{P} = F(x)\;\;\;\;\;\;\;\;\;\;\;\; (27)\]

Examples of what the particular part of the solution looks like are given below.

1.  When

\[F(x) = e^{{ax}},\]

the particular part of the solution is of the form

\[Ae^{{ax}}.\]

We can find \(A\) by substituting

\[y_{P}\left( x \right) = Ae^{{ax}}\;\;\;\;\;\;\;\;\;\;\;\; (28)\]

in the left-hand side of the differential equation and equating coefficient of \(e^{{ax}}\).

2.  When

\[F(x) = \sin{bx}\ \text{or}\ \cos{bx}.\]

the particular part of the solution is of the form

\[A\sin{bx} + B\cos{bx}.\]

We can get \({A }\)and \(B\) by substituting

\[y_{P}\left( x \right) = A\sin{bx} + B\cos{bx}\;\;\;\;\;\;\;\;\;\;\;\; (29)\]

in the left-hand side of the differential equation and equating the coefficients of \(\sin{bx}\) and/or \(\cos{bx}\).

3.  When

\[X = e^{{ax}}\sin{bx}\ \text{or}\ e^{{ax}}\cos{bx},\]

the particular part of the solution is of the form

\[e^{{ax}}\left( A\sin{bx} + B\cos{bx} \right).\]

We can get \(A\) and \({B }\) by substituting

\[y_{P}\left( x \right) = e^{{ax}}(A\sin{bx} + B\cos{bx})\;\;\;\;\;\;\;\;\;\;\;\; (30)\]

in the left-hand side of the differential equation and equating coefficients of \(e^{{ax}}\sin{bx}\) and \(e^{{ax}}(A\cos{bx)}\).

The forms of the particular part of the solution for different forcing functions of ordinary differential equations are given below

\(F(x)\) \(y_{P}\left( x \right)\)
\(a_{0} + a_{1}x + a_{2}x^{2}\) \(b_{0} + b_{1}x + b_{2}x^{2}\)
\(e^{{ax}}\) \(Ae^{{ax}}\)
\(\sin{(bx)}\) \(A\sin{(bx)} + B\cos{(bx)}\)
\(e^{{ax}}\sin{(bx)}\) \(e^{{ax}}\left( A\sin{(bx)} + B\cos{(bx)} \right)\)
\(\cos{(bx)}\) \(A\sin{(bx)} + B\cos{(bx)}\)
\(e^{{ax}}\cos{(bx)}\) \(e^{{ax}}\left( A\sin{(bx)} + B\cos{(bx)} \right)\)

  

Example 1

Solve

\[3\frac{{dy}}{{dx}} + 2y = e^{- x},\ y(0) = 5\]

Solution

The homogeneous solution for the above equation is given by

\[\left( 3D + 2 \right)y = 0\]

The characteristic equation for the above equation is given by

\[3r + 2 = 0\]

The solution to the equation is

\[r = - 0.666667\]

\[y_{H} = Ce^{- 0.666667x}\]

The particular part of the solution is of the form \(Ae^{- x}\)

\[3\frac{d\left( Ae^{- x} \right)}{{dx}} + 2Ae^{- x} = e^{- x}\]

\[- 3Ae^{- x} + 2Ae^{- x} = e^{- x}\]

\[- Ae^{- x} = e^{- x}\]

\[A = - 1\]

Hence the particular part of the solution is

\[y_{P} = - e^{- x}\]

The complete solution is given by

\[\begin{split} y &= y_{H} + y_{P}\\ &= Ce^{- 0.666667x} - e^{- x} \end{split}\]

The constant \(C\) can be obtained by using the initial condition \(y(0) = 5\)

\[y\left( 0 \right) = Ce^{- 0.666667 \times 0} - e^{- 0} = 5\]

\[C - 1 = 5\]

\[C = 6\]

The complete solution is

\[y = 6e^{- 0.666667x} - e^{- x}\]

  

Example 2

Solve

\[2\frac{{dy}}{{dx}} + 3y = e^{- 1.5x},\ y(0) = 5\]

Solution

The homogeneous solution for the above equation is given by

\[\left( 2D + 3 \right)y = 0\]

The characteristic equation for the above equation is given by

\[2r + 3 = 0\]

The solution to the equation is

\[r = - 1.5\]

\[y_{H} = Ce^{- 1.5x}\]

Based on the forcing function of the ordinary differential equations, the particular part of the solution is of the form \(Ae^{- 1.5x}\), but since that is part of the form of the homogeneous part of the solution, we need to choose the next independent solution, that is,

\[y_{P} = {Ax}e^{- 1.5x}\]

To find \(A\), we substitute this solution in the ordinary differential equation as

\[2\frac{d}{{dx}}({Ax}e^{- 1.5x}) + 3{Ax}e^{- 1.5x} = e^{- 1.5x}\]

\[2Ae^{- 1.5x} - 3{Ax}e^{- 1.5x} + 3{Ax}e^{- 1.5x} = e^{- 1.5x}\]

\[2Ae^{- 1.5x} = e^{- 1.5x}\]

\[A = 0.5\]

Hence the particular part of the solution is

\[y_{P} = 0.5xe^{- 1.5x}\]

The complete solution is given by

\[\begin{split} y &= y_{H} + y_{P}\\ &= Ce^{- 1.5x} + 0.5xe^{- 1.5x} \end{split}\]

The constant \(C\) is obtained by using the initial condition \(y(0) = 5\).

\[y\left( 0 \right) = Ce^{- 1.5(0)} + 0.5(0)e^{- 1.5(0)} = 5\]

\[C + 0 = 5\]

\[C = 5\]

The complete solution is

\[y = 5e^{- 1.5x} + 0.5xe^{- 1.5x}\]

Lesson: Solving Second-Order Differential Equations Exactly

Learning Objectives

After successful completion of this lesson, you should be able to:

1) solve linear ordinary differential equations of first-order with fixed constants by using classical solution techniques.

  

Applications

In this lesson, we revisit the classical solution technique used to solve ordinary differential equations of the second order. Knowing this technique is a prerequisite to the course.

  

Example 1

Solve

\[2\frac{d^{2}y}{dx^{2}} + 3\frac{{dy}}{{dx}} + 3.125y = \sin x,\ y(0) = 5,\ \frac{{dy}}{{dx}}(x = 0) = 3\]

Solution

The homogeneous equation is given by

\[(2D^{2} + 3D + 3.125)y = 0\]

The characteristic equation is

\[2r^{2} + 3r + 3.125 = 0\]

The roots of the characteristic equation are

\[\begin{split} r &= \frac{- 3 \pm \sqrt{3^{2} - 4 \times 2 \times 3.125}}{2 \times 2}\\ &= \frac{- 3 \pm \sqrt{9 - 25}}{4}\\ &= \frac{- 3 \pm \sqrt{- 16}}{4}\\ &= \frac{- 3 \pm 4i}{4}\\ &= - 0.75 \pm i \end{split}\]

Therefore the homogeneous part of the solution is given by

\[y_{H} = e^{- 0.75x}(K_{1}\cos x + K_{2}\sin x)\]

The particular part of the solution is of the form

\[y_{P} = A\sin x + B\cos x\]

\[2\frac{d^{2}}{dx^{2}}\left( A\sin x + B\cos x \right) + 3\frac{d}{{dx}}\left( A\sin x + B\cos x \right) + 3.125(A\sin x + B\cos x) = \sin x\]

\[2\frac{d}{{dx}}\left( A\cos x - B\sin x \right) + 3(A\cos x - B\sin x) + 3.125(A\sin x + B\cos x) = \sin x\]

\[2( - A\sin x - B\cos x) + 3(A\cos x - B\sin x) + 3.125(A\sin x + B\cos x) = \sin x\]

\[(1.125A - 3B)\sin x + (1.125B + 3A)\cos x = \sin x\]

Equating coefficients of \(\sin x\) and \(\cos x\) on both sides, we get

\[1.125A - 3B = 1\]

\[1.125B + 3A = 0\]

Solving the above two simultaneous linear equations, we get

\[A = 0.109589\]

\[B = - 0.292237\]

Hence

\[y_{P} = 0.109589\sin x - 0.292237\cos x\]

The complete solution is given by

\[y = e^{- 0.75x}(K_{1}\cos x + K_{2}\sin x) + (0.109589\sin x - 0.292237\cos x)\]

To find \(K_{1}\) and \(K_{2}\) we use the initial conditions

\[y(0) = 5,\ \frac{{dy}}{{dx}}(x = 0) = 3\]

From \(y(0) = 5\), we get

\[5 = e^{- 0.75(0)}(K_{1}\cos(0) + K_{2}\sin(0)) + (0.109589\sin(0) - 0.292237\cos(0))\]

\[5 = K_{1} - 0.292237\]

\[K_{1} = 5.292237\]

\[\begin{split} \frac{{dy}}{{dx}} &= - 0.75e^{- 0.75x}(K_{1}\cos x + K_{2}\sin x) + e^{- 0.75x}( - K_{1}\sin x + K_{2}\cos x)\\ & \ \ \ \ \ +0.109589\cos{x}+0.292237\sin{x} \end{split}\]

From

\[\frac{{dy}}{{dx}}(x = 0) = 3,\]

we get

\[\begin{split} 3 &= - 0.75e^{- 0.75(0)}(K_{1}\cos(0) + K_{2}\sin(0)) + \ e^{- 0.75(0)}( - K_{1}\sin(0) + K_{2}\cos(0))\\ & \ \ \ \ \ + 0.109589\cos(0) + 0.292237\sin(0) \end{split}\]

\[3 = - 0.75K_{1} + K_{2} + 0.109589\]

\[3 = - 0.75(5.292237) + K_{2} + 0.109589\]

\[K_{2} = 6.859588\]

The complete solution is

\[y = e^{- 0.75x}(5.292237\cos x + 6.859588\sin x) + 0.109589\sin x - 0.292237\cos x\]

  

Example 2

Solve

\[2\frac{d^{2}y}{dx^{2}} + 6\frac{{dy}}{{dx}} + 3.125y = \cos(x),\ y(0) = 5,\ \frac{{dy}}{{dx}}(x = 0) = 3\] Solution

The homogeneous part of the equations is given by

\[(2D^{2} + 6D + 3.125)y = 0\]

The characteristic equation is given by

\[2r^{2} + 6r + 3.125 = 0\]

\[\begin{split} r &= \frac{- 6 \pm \sqrt{6^{2} - 4(2)(3.125)}}{2(2)}\\ &= \frac{- 6 \pm \sqrt{36 - 25}}{4}\\ &= \frac{- 6 \pm \sqrt{11}}{4}\\ &= - 1.5 \pm 0.829156\\ &= - 0.670844, - 2.329156 \end{split}\]

Therefore, the homogeneous solution \(y_{H}\) is given by

\[y_{H} = K_{1}e^{- 0.670845x} + K_{2}e^{- 2.329156x}\]

The particular part of the solution is of the form

\[y_{P} = A\sin x + B\cos x\]

Substituting the particular part of the solution in the differential equation,

\[\begin{split} 2\frac{d^{2}}{dx^{2}}\left( A\sin x + B\cos x \right) &+ 6\frac{d}{{dx}}(A\sin x + B\cos x)\\ &+ 3.125(A\sin x + B\cos x) = \cos x \end{split}\]

\[\begin{split} 2\frac{d}{{dx}}(A\cos x - B\sin x) &+ 6(A\cos x - B\sin x)\\ &+ 3.125(A\sin x + B\cos x) = \cos x \end{split}\]

\[\begin{split} 2( - A\sin x - B\cos x) &+ 6(A\cos x - B\sin x)\\ &+ 3.125(A\sin x + B\cos x) = \cos x \end{split}\]

\[(1.125A - 6B)\sin x + (1.125B + 6A)\cos x = \cos x\]

Equating coefficients of \(\cos x\) and \(\sin x\) we get

\[1.125B + 6A = 1\]

\[1.125A - 6B = 0\]

The solution to the above two simultaneous linear equations are

\[A = 0.161006\]

\[B = 0.0301887\]

Hence the particular part of the solution is

\[y_{P} = 0.161006\sin x + 0.0301887\cos x\]

Therefore the complete solution is

\[y = y_{H} + y_{P}\]

\[y = (K_{1}e^{- 0.670845x} + K_{2}e^{- 2.329156x}) + 0.161006\sin x + 0.0301887\cos x\]

Constants \(K_{1}\) and \(K_{2}\) can be determined using initial conditions. From \(y(0) = 5\),

\[y(0) = K_{1} + K_{2} + 0.0301887 = 5\]

\[K_{1} + K_{2} = 5 - 0.0301887 = 4.969811\]

Now

\[\begin{split} \frac{dy}{dx}= &-0.670845K_1e^{-\left(0.670845\right)x}-2.329156K_2e^{-\left(2.329156\right)x}\\ &+ 0.161006\cos x - 0.0301887\sin x \end{split}\]

From

\[\frac{{dy}}{{dx}}(x = 0) = 3\]

we get

\[- 0.670845K_{1} - 2.329156K_{2} + 0.161006 = 3\]

\[0.670845K_{1} + 2.329156K_{2} = - 3 + 0.161006\]

\[0.670845K_{1} + 2.329156K_{2} = - 2.838994\]

We have two simultaneous linear equations with two unknowns

\[K_{1} + K_{2} = 4.969811\]

\[0.670845K_{1} + 2.329156K_{2} = - 2.838994\]

Solving the two simultaneous linear equations, we get

\[K_{1} = 8.692253\]

\[K_{2} = - 3.722442\]

The complete solution is

\[\begin{split} y = &(8.692253e^{- 0.670845x} - 3.722442e^{- 2.329156x})\\ &+ 0.161006\sin x + 0.0301887\cos x. \end{split}\]

  

Example 3

Solve

\[2\frac{d^{2}y}{dx^{2}} + 5\frac{{dy}}{{dx}} + 3.125y = e^{- x}\sin x,\ y(0) = 5,\ \frac{{dy}}{{dx}}(x = 0) = 3\]

Solution

The homogeneous equation is given by

\[(2D^{2} + 5D + 3.125)y = 0\]

The characteristic equation is given by

\[2r^{2} + 5r + 3.125 = 0\]

\[\begin{split} r &= \frac{- 5 \pm \sqrt{5^{2} - 4(2)(3.125)}}{2(2)}\\ &= \frac{- 5 \pm \sqrt{25 - 25}}{4}\\ &= \frac{- 5 \pm 0}{4}\\ &= - 1.25, - 1.25 \end{split}\]

Since roots are repeated, the homogeneous solution \(y_{H}\) is given by

\[y_{H} = (K_{1} + K_{2}x)e^{( - 1.25)x}\]

The particular part of the solution is of the form

\[y_{P} = e^{- x}(A\sin x + B\cos x)\]

Substituting the particular part of the solution in the ordinary differential equation

\[\begin{split} 2\frac{d^{2}}{dx^{2}}&{ e^{- x}(A\sin x + B\cos x)} + 5\frac{d}{{dx}}{ e^{- x}(A\sin x + B\cos x)}\\ &+3.125{e^{-x}(A\sin{x}+Bcos{x})}=e^{-x}\sin{x} \end{split}\]

\[\begin{split} &2\frac{d}{{dx}} \left\{- e^{- x}\left( A\sin x + B\cos x \right) + e^{- x}\left( A\cos x - B\sin x \right) \right\}\\ &+ 5\left\{- e^{- x}\left( A\sin x + B\cos x \right) + e^{- x}\left(A\cos x - B\sin x \right) \right\}\\ &+ 3.125e^{- x}\left( A\sin x + B\cos x \right)\end{split}\]

\[\begin{split} = e^{- x} &\sin x\ 2\{ e^{- x}(A\sin x + B\cos x) - e^{- x}(A\cos x - B\sin x) - e^{- x}(A\cos x\\ &-B\sin{x})-e^{-x}(A\sin{x}+Bcos{x})\\ &+ 5\{ - e^{- x}(A\sin x + B\cos x) + e^{- x}(A\cos x - B\sin x)\} + 3.125e^{- x}(A\sin x\\ &+ B\cos x) = e^{- x}\sin x \end{split}\]

\[- 1.875e^{- x}(A\sin x + B\cos x) + e^{- x}(A\cos x - B\sin x) = e^{- x}\sin x\]

\[- 1.875(A\sin x + B\cos x) + (A\cos x - B\sin x) = \sin x\]

\[- (1.875A + B)\sin x + (A - 1.875B)\cos x = \sin x\]

Equating coefficients of \(\cos x\) and \(\sin x\) on both sides, we get

\[A - 1.875B = 0\]

\[1.875A + B = - 1\]

Solving the above two simultaneous linear equations, we get

\[A = - 0.415224\ \text{and}\]

\[B = - 0.221453\]

Hence,

\[y_{P} = - e^{- x}(0.415224\sin x + 0.221453\cos x)\]

Therefore the complete solution is given by

\[y = y_{H} + y_{P}\]

\[y = (K_{1} + xK_{2})e^{- 1.25x} - e^{- x}(0.415224\sin x + 0.221453\cos x)\]

Constants \(K_{1}\) and \(K_{2}\) can be determined using initial conditions,

From \(y(0) = 5,\) we get

\[K_{1} - 0.221453 = 5\]

\[K_{1} = 5.221453\]

Now

\[\begin{split} \frac{dy}{dx}= &-1.25K_1e^{-1.25x}-1.25K_2xe^{-1.25x}+K_2e^{-1.25x}-\\ &e^{- x}(0.415224\cos x - 0.221453\sin x) + e^{- x}(0.415224\sin x + 0.221453\cos x) \end{split}\]

From \(\displaystyle \frac{{dy}}{{dx}}(0) = 3,\) we get

\[\begin{split} &- 1.25K_{1}e^{- 1.25(0)} - 1.25K_{2}(0)e^{- 1.25(0)} + K_{2}e^{- 1.25(0)}\\ &-e^0(0.415224\cos(0)-0.221453\sin(0))+e^0(0.415224\sin(0)+0.221453\cos(0)=3 \end{split}\]

\[- 1.25K_{1} + K_{2} + 0.221453 - 0.415224 = 3\]

\[- 1.25K_{1} + K_{2} = 3.193771\]

\[- 1.25(5.221453) + K_{2} = 3.193771\]

\[K_{2} = 9.720582\]

Substituting

\[K_{1} = 5.221453\ \text{and}\]

\[K_{2} = 9.720582\]

in the solution, we get

\[y = (5.221453 + 9.720582x)e^{- 1.25x} - e^{- x}(0.415224\sin x + 0.221453\cos x)\]

Lesson: Solving an Integral as a First-Order Ordinary Differential Equation

Learning Objectives

After successful completion of this lesson, you should be able to:

1) recall the two parts of the fundamental theorem of calculus

2) verify finding an exact integral using the exact solution of a first-order ordinary differential equation

  

Introduction

In this lesson, we recall the two parts of the fundamental theorem of calculus (sometimes called the first and second fundamental theorems of calculus) to be able to show that the solution to a definite integral

\[\int_{a}^{b}{f(x)dx}\]

can be posed as a solution to an ordinary differential equation. This ability to represent a definite integral as an ordinary differential equation plays a prominent role in showing how we can use numerical methods of ordinary differential equations to conduct numerical integration.

The first part of the fundamental theorem of calculus states that if \(f(x)\) is a real-valued and continuous function in the open interval D, and a is a point in the interval D, and if

\[F(x) = \int_{a}^{x}{f(t)dt}\;\;\;\;\;\;\;\;\;\;\;\; (1)\]

then

\[F^{\prime}(x) = f(x)\;\;\;\;\;\;\;\;\;\;\;\; (2)\]

at each point in D.

The second part of the fundamental theorem of calculus states that if \(f(x)\) is a real-valued function in the interval \(\lbrack a,b\rbrack\), and \(F(x)\) is the antiderivative of \(f(x)\) in \(\lbrack a,b\rbrack\), then

\[\int_{a}^{b}{f(x)dx} = F\left( b \right) - F\left( a \right)\;\;\;\;\;\;\;\;\;\;\;\; (3)\]

Hence we can write equation (1) as

\[\frac{{dF}}{{dx}} = f(x)\;\;\;\;\;\;\;\;\;\;\;\; (4)\]

and if we assume \(F\left( a \right) = 0\), then from Equation (3)

\[\int_{a}^{b}{f(x)dx} = F(b)\;\;\;\;\;\;\;\;\;\;\;\; (5)\]

So we can pose the value of \(\int_{a}^{b}{f(x)dx}\) as solving Equation (4) for \(F(b)\) with \(F\left( a \right) = 0\) as the initial condition. We use the example below to illustrate the equivalency.

  

Example 1

Let us suppose you are asked to find

\[\int_{3}^{9}{5x^{2}{dx}}\;\;\;\;\;\;\;\;\;\;\;\; (E1.1)\]

The exact integral using integral calculus is given as

\[\begin{split} \int_{3}^{9}{5x^{2}{dx}} &= \ \left\lbrack \frac{5x^{3}}{3} \right\rbrack_{3}^{9}\\ &= \frac{5{(9)}^{3}}{3} - \frac{5{(3)}^{3}}{3}\\ &= \ 1215 - 45\\ &= 1170\;\;\;\;\;\;\;\;\;\;\;\; (E1.2) \end{split}\]

Now, if one poses an ordinary differential equation

\[\frac{{dy}}{{dx}} = \ 5x^{2}\ ,\ y\left( 3 \right) = 0\;\;\;\;\;\;\;\;\;\;\;\; (E1.3)\]

then the solution using the classical solution technique is as follows

\[y = \ y_{H} + y_{P}\;\;\;\;\;\;\;\;\;\;\;\; (E1.4)\]

The homogeneous part of the solution, \(y_{H}\) is found by using the characteristic equation

\[m = 0\]

to give

\[\begin{split} y_{H} &= Ke^{0x}\\ &= K\;\;\;\;\;\;\;\;\;\;\;\; (E1.5) \end{split}\]

The particular part of the solution would be of the form of \(Ax^{2} + Bx + C\), but since the constant \(C\) is part of the homogeneous part of the solution, \(y_{H} = K\), we need to use the next independent solution.

\[\begin{split} y_{P} &= x\left( Ax^{2} + Bx + C \right)\\ &= Ax^{3} + Bx^{2} + Cx\;\;\;\;\;\;\;\;\;\;\;\; (E1.6) \end{split}\]

By substituting \(y_{P}\) in the ordinary differential equation, we get

\[\frac{d}{{dx}}\left( Ax^{3} + Bx^{2} + Cx \right) = 5x^{2}\]

\[3Ax^{2} + 2Bx + C = 5x^{2} + 0x + 0\]

giving

\[3A = 5\]

\[2B = 0\]

\[C = 0\]

and hence

\[A = \frac{5}{3}\]

\[B = 0\]

\[C = 0\]

So Equation (E1.6) gives

\[y_{P} = \frac{5}{3}x^{3}\;\;\;\;\;\;\;\;\;\;\;\; (E1.7)\]

The complete solution from Equation (E1.4) is

\[\begin{split} y &= \ y_{H} + y_{P}\\ &= \ K + \frac{5}{3}x^{3}\;\;\;\;\;\;\;\;\;\;\;\; (E1.8) \end{split}\]

To find \(K\), use the initial condition,

\[y(3) = 0\]

then from Equation (E1.8), we get

\[K + \frac{5}{3}{(3)}^{3} = 0\]

\[K + 45 = 0\]

\[K = - 45\]

Hence the solution by rewriting Equation (E1.8) is

\[y = \ - 45 + \frac{5}{3}x^{3}\;\;\;\;\;\;\;\;\;\;\;\; (E1.9)\]

From Equation (E1.9)

\[\begin{split} y(9) &= \ - 45 + \frac{5}{3}{(9)}^{3}\\ &= \ 1170 \;\;\;\;\;\;\;\;\;\;\;\; (E1.10) \end{split}\]

We could have chosen \(y\left( 3 \right)\) to be any finite number and the value \(y\left( 9 \right) - y\left( 3 \right)\) would still turn out to be \(1170\).

Why do these values from Equations (E1.2) and (E1.10), one being an integral and another being the solution of an ordinary differential equation, turn out to be the same value \(1170\). It is not a coincidence. It is because of the second fundamental theorem of calculus, and it states

\[\frac{d}{{dx}}\int_{a}^{x}{f\left( t \right)dt = f(x)}\;\;\;\;\;\;\;\;\;\;\;\; (E1.11)\]

Choosing

\[f\left( t \right) = 5t^{2}\ \text{and}\ a = 3\]

\[\frac{d}{{dx}}\int_{3}^{x}{5t^{2}\ dt = 5x^{2}\ }\;\;\;\;\;\;\;\;\;\;\;\; (E1.12)\]

Calling

\[y\left( x \right) = \int_{3}^{x}{5t^{2}\ {dt}\ }\]

\[\frac{{dy}}{{dx}} = 5x^{2}\]

By posing the ordinary differential equation as

\[\frac{{dy}}{{dx}} = 5x^{2},\ y(3) = 0\;\;\;\;\;\;\;\;\;\;\;\; (E1.13)\]

and finding\(\ y(9)\), we have

\[y\left( 3 \right) = \int_{3}^{3}{5t^{2}\ dt = 0\ }\]

\[y\left( 9 \right) = \int_{3}^{9}{5t^{2}\ {dt}}\]

Hence solving

\[\frac{{dy}}{{dx}} = 5x^{2},\ y(3) = 0\]

for \(y\left( 9 \right)\) is the value of the integral

\[\int_{3}^{9}{5t^{2}\ {dt}.\ }\]

Multiple Choice Test

(1). The ordinary differential equation \(\displaystyle 2\frac{{dy}}{{dx}} + x^{2}y = 2x + 3,\ y\left( 0 \right) = 5\) is

(A) linear

(B) nonlinear

(C) linear with fixed constants

(D) undeterminable to be linear or nonlinear

  

(2). A differential equation is considered to be ordinary if it has

(A)  one dependent variable

(B)  more than one dependent variable

(C)  one independent variable

(D)  more than one independent variable

  

(3). Given

\[\displaystyle 2\frac{{dy}}{{dx}} + 3y = \sin 2x,\ y\left( 0 \right) = 6\]

\(y\left( 2 \right)\) most nearly is

(A) \(0.17643\)

(B) \(0.29872\)

(C) \(0.32046\)

(D) \(0.58024\)

  

(4). The form of the exact solution to

\[\displaystyle 2\frac{{dy}}{{dx}} + 3y = e^{- x},\ y\left( 0 \right) = 5\]

is

(A) \(Ae^{- 1.5x} + Be^{- x}\)

(B) \(Ae^{- 1.5x} + Bxe^{- x}\)

(C) \(Ae^{1.5x} + Be^{- x}\)

(D) \(Ae^{1.5x} + Bxe^{- x}\)

  

(5). The following nonlinear differential equation can be solved exactly by separation of variables.

\[\displaystyle \frac{{d\theta }}{{dt}} = - 10^{- 6}\left( \theta^{2} - 81 \right),\ \theta\left( 0 \right) = 1000\]

The value of \(\theta\left( 100 \right)\) most nearly is

(A) \(- 99.99\)

(B) \(909.10\)

(C) \(1000.32\)

(D) \(1111.10\)

  

(6). A solid spherical ball taken out of a furnace at \(1200\) K is allowed to cool in air. Given the following,

radius of the ball \(= 2{\ cm}\)

density of the ball \(= 7800\frac{{kg}}{m^{3}}\)

specific heat of the ball \(= 420\frac{J}{{\ kg-K}}\)

emmittance\(= 0.85\)

Stefan-Boltzman constant \(= 5.67 \times 10^{- 8}\frac{J}{{s-}{m}^{2}{-}{K}^{4}}\)

ambient temperature \(= 300{\ K}\)

convection coefficient to air \(= 350\frac{J}{{s-}{m}^{2}{-K}}\)

the differential equation governing the temperature \(\theta\) of the ball as a function of time t is given by

(A) \(\displaystyle \frac{{d\theta }}{{dt}} = - 2.2067 \times 10^{- 12}\left( \theta^{4} - 81 \times 10^{8} \right), \theta(0)=1200\)

(B) \(\displaystyle \frac{{d\theta }}{{dt}} = - 1.6026 \times 10^{- 2}\left( \theta - 300 \right), \theta(0)=1200\)

(C) \(\displaystyle \frac{{d\theta }}{{dt}} = 2.2067 \times 10^{- 12}\left( \theta^{4} - 81 \times 10^{8} \right) + 1.6026 \times 10^{- 12}\left( \theta - 300 \right), \theta(0)=1200\)

(D) \(\displaystyle \frac{{d\theta }}{{dt}} = - 2.2067 \times 10^{- 12}\left( \theta^{4} - 81 \times 10^{8} \right) - 1.6026 \times 10^{- 2}\left( \theta - 300 \right), \theta(0)=1200\)

 

For complete solution, go to

http://nm.mathforcollege.com/mcquizzes/08ode/quiz_08ode_background_solution.pd