0% found this document useful (0 votes)
301 views

Differential Equations A Problem Solving Approach Based On MATLAB by P. Mohana Shankar

Uploaded by

jonathan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
301 views

Differential Equations A Problem Solving Approach Based On MATLAB by P. Mohana Shankar

Uploaded by

jonathan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 459

Differential Equations

A Problem Solving Approach Based on MATLAB®

www.TechnicalBooksPDF.com
www.TechnicalBooksPDF.com
Differential Equations
A Problem Solving Approach Based on MATLAB®

P. Mohana Shankar
Drexel University
Department of Electrical & Computer Engineering
Philadelphia, Pennsylvania, USA

p,
p,
A SCIENCE PUBLISHERS BOOK
A SCIENCE PUBLISHERS BOOK

www.TechnicalBooksPDF.com
MATLAB® and Simulink® are trademarks of The MathWorks, Inc. and are used with permission. The
MathWorks does not warrant the accuracy of the text or exercises in this book. This book’s use or
discussion of MATLAB® and Simulink® software or related products does not constitute endorsement or
sponsorship by The MathWorks of a particular pedagogical approach or particular use of the MATLAB®
and Simulink® software.

CRC Press
Taylor & Francis Group
6000 Broken Sound Parkway NW, Suite 300
Boca Raton, FL 33487-2742

© 2018
2017 by Taylor & Francis Group, LLC
CRC Press is an imprint of Taylor & Francis Group, an Informa business

No claim to original U.S. Government works

Printed on acid-free paper


Version Date: 20171219
20170119

978-1-1385-0160-7 (Hardback)
International Standard Book Number-13: 978-1-4987-4799-8

This book contains information obtained from authentic and highly regarded sources. Reasonable efforts have been
made to publish reliable data and information, but the author and publisher cannot assume responsibility for the
validity of all materials or the consequences of their use. The authors and publishers have attempted to trace the
copyright holders of all material reproduced in this publication and apologize to copyright holders if permission to
publish in this form has not been obtained. If any copyright material has not been acknowledged please write and let
us know so we may rectify in any future reprint.

Except as permitted under U.S. Copyright Law, no part of this book may be reprinted, reproduced, transmitted,
or utilized in any form by any electronic, mechanical, or other means, now known or hereafter invented, includ-
ing photocopying, microfilming, and recording, or in any information storage or retrieval system, without written
permission from the publishers.

For permission to photocopy or use material electronically from this work, please access www.copyright.com
(http://www.copyright.com/) or contact the Copyright Clearance Center, Inc. (CCC), 222 Rosewood Drive, Danvers,
MA 01923, 978-750-8400. CCC is a not-for-profit organization that provides licenses and registration for a variety
of users. For organizations that have been granted a photocopy license by the CCC, a separate system of payment
has been arranged.

Trademark Notice: Product or corporate names may be trademarks or registered trademarks, and are used only for
identification and explanation without intent to infringe.

Library of Congress Cataloging-in-Publication Data

Names: Shankar, P. M., author.


Title: Differential equations : a problem solving approach based on MATLAB /
P. Mohana Shankar, Drexel University, Department of Electrical & Computer
Engineering, Philadelphia, Pennsylvania, USA.
Description: Boca Raton, FL : CRC Press, Taylor & Francis Group, 2018. | "A
science publishers book." | Includes bibliographical references and index.
Identifiers: LCCN 2017057524 | ISBN 9781138501607 (hardback : alk. paper)
Subjects: LCSH: Differential equations--Numerical solutions--Data processing.
| MATLAB.
Classification: LCC QA371.5.D37 S45 2018 | DDC 515/.350285536--dc23
LC record available at https://lccn.loc.gov/2017057524

Visit the Taylor & Francis Web site at


http://www.taylorandfrancis.com

and the CRC Press Web site at


http://www.crcpress.com

www.TechnicalBooksPDF.com
Dedicated to my parents, Padmanabharao and
Kanakabai, who were school teachers

www.TechnicalBooksPDF.com

www.TechnicalBooksPDF.com

Preface

This book grew out of instructional material and notes the author created while teaching
courses in Linear Algebra and Differential Equations to undergraduate engineering
students. Starting from simple demos prepared for instructing students, all aspects
associated with the first order differential equations, linear second and higher order
differential equations with constant coefficients and coupled first order differential
equations were incorporated into several modules for obtaining solutions to any
exercise. Taking the pulse of the students to determine what they felt was essential
for their understanding, these modules were constantly updated and put in to a final
from where they display solutions to differential equations with a simple input in
textual form. The solutions are displayed as figures such that they provide theoretical
aspects, explanations, step-by-step generation of solutions, solutions using multiple
approaches, including verification through numerical techniques. The examples in the
book capture this holistic approach to problem solving. MATLAB® (version 2016a)
with its symbolic toolbox provided the appropriate software for the creation of the
solutions in this format.
The book provides theoretical background containing a large number of examples,
far exceeding what is seen in typical textbooks and a substantial number of exercises.
The goal of the book has been the creation of materials that provide the theory, ample
examples to cover the diverse theoretical concepts in each chapter, and multiple ways
of solving problems providing the pedagogy in terms of verification of solutions, etc.
The solutions manual is available separately.
This book has been a family project with the support and encouragement from
my wife Raja and daughter Raji. Their assistance in the preparation of materials was
crucial to the timely completion of the project. I want to thank my editor Mr. Vijay
Primlani for his support during this endeavor. The support provided by the staff at
CRC press is also greatly appreciated.

www.TechnicalBooksPDF.com

www.TechnicalBooksPDF.com
Contents

Dedication v
Preface vii
1. Introduction 1
2. First Order Differential Equations 5
3. Linear Second Order Differential Equations with Constant Coefficients 81
4. Linear Higher Order Differential Equations with Constant Coefficients 181
5. First Order Coupled Differential Equations with Constant Coefficients 236
Appendices 383
Suggested Readings 445
Index 447

www.TechnicalBooksPDF.com
www.TechnicalBooksPDF.com

CHAPTER 1

Introduction

In the sciences, engineering, social sciences, business and other areas that impact
our lives, changes take place continuously. This dynamic behavior can be easily
demonstrated, studied and critically analyzed through modeling carried out by
examining how changes take place in time. This time dependent or temporal behavior
leads us to the notion of derivatives and differential equations. Therefore, a study of
differential equations, their solutions, and interpretation of the solutions is essential
for the proper understanding of systems operating in all walks of life.
Consider a phenomenon where the observable quantity is identified by y. If changes
are taking place in time, it is obvious that y will be a function of time t, expressed as
y(t). If we take the first order derivative of y (differentiation once with respect to the
independent variable t) and equate it to another function f(y,t), we obtain a first order
differential equation expressed as
dy
= f ( y, t ) . (1.1)
dt

It should be noted that f(y,t) may be a constant, a function of time, a function of y
(implicit dependence on t) or a function of y and t. For example, we may have
dy
= f ( y, t ) = y + y 2 t + t 2 + 2. (1.2)
dt

If f(y,t) only depends on y, the first order differential equation is an autonomous one
as in the case of
dy
= f= ( y, t ) h ( y ) . (1.3)
dt

In eqn. (1.3) h(y) is a linear or nonlinear function of y only.
It is possible to take the derivative of eqn. (1.1) once more. In this case, we get
a second order differential equation. We may also take higher order derivatives. The
order of the differential equation is determined by the highest order derivative existing
in the equation. In addition to differential equations in a single variable of the first or
higher orders, it is also possible that there may be two or more observables such as y1(t),
y2(t),.., in which case, we may have interconnected or coupled differential equations.

www.TechnicalBooksPDF.com
2  Differential Equations: A Problem Solving Approach Based on MATLAB

In this book, we study all these differential equations starting from a single first
order differential equation, followed by second order and higher order differential
equations and culminating in coupled first order differential equations. If the differential
dy dy n
equations only contain terms in y, , ,…, or d y , the differential equations are
dt dt dt n
linear. An example of a 4th order linear differential equation is
d4y d2y
a (t ) 4
+ b (t ) 2 + c (t ) y =h ( t ). (1.4)
dt dt
If a(t), b(t) and c(t) in eqn. (1.4) are constants (no dependence on t), the differential
equation is identified as a linear differential equation with constant coefficients.
An example of a second order linear differential equation with constant coefficients
(A, B, and, C) is
d2y dy
A h ( t ). (1.5)
+ B + Cy =
dt 2 dt

Additionally, if h(t)=0, eqn. (1.5) will be a homogeneous differential equation
while a non-homogeneous differential equation will have h(t)≠0. Note that h(t) may
be number (not equal to zero) in a non-homogeneous differential equation.
Chapter 2 is devoted to the study of first order differential equations with special
emphasis on autonomous systems to develop an appreciation and understanding of the
equilibrium conditions of associated systems. The chapter starts with the method of
integrating factors and the method of separable functions for obtaining the solution of
first order differential equations. A description of D-fields is provided to offer a pictorial
description of the behavior of the system. All aspects necessary to understand an
autonomous system are presented and well supported by an extensive set of examples.
The examples are annotated to provide insights into the form of the solution, type
of equilibrium as well as verification of the solution through additional approaches
including use of dsolve(.) in MATLAB®, along with plots if and when necessary.
The second order differential equations are studied in Chapter 3. The differential
equations are limited to linear ones with constant coefficients. Starting with the
homogeneous differential equations, the concept of the characteristic equation or
polynomial is introduced and the evolution of the solution from the roots of the
characteristic equation is described. Solutions are also obtained using Laplace
transforms and the state of the system is examined using the phase portraits to ensure
that the analytical solution and their properties match the conclusions that can be
drawn from phase portraits. An additional approach for obtaining the solution based
on converting the second order equation into a pair of coupled first order differential
equations is also offered as yet another level of verification of the solutions along
with numerical solution obtained using Runge-Kutta methods. Finally, examples are
provided which encompass every aspect of the solution with necessary equations,
annotations, explanations and verification. Non-homogeneous differential equations
are studied next in Chapter 3 by offering two methods for obtaining the particular
solutions, namely the method of undetermined coefficients and the method of variation
of parameters. The particular solutions obtained using both methods are compared
offering a comprehensive view of the solutions to the non-homogeneous differential

www.TechnicalBooksPDF.com
Introduction 3

equations. The Laplace transform based approach and Runge-Kutta method are used
to provide verification. Numerous examples are provided to cover diverse forcing
functions and annotations in figures that clearly illustrate steps in the generation of the
particular solutions, e.g., the need to scale the initial guess by t or t2 as the case may be.
The examples are fully annotated including steps taken to evaluate unknown constants
when the initial conditions are given along with the background theoretical aspects.
Higher order differential equations are studied in Chapter 4. The solution to the
homogeneous differential equation is obtained using the roots of the characteristic
polynomial and issues with the diversity of relationships among the multiple roots are
discussed. Based on this, the characteristic polynomial is used only for differential
equations up to the 4th order. The Laplace transform method is used for all orders.
The particular solution is obtained using the method of variation of parameters (up
to the 4th order). The Runge-Kutta method is used as a means to verify the results.
Once again, the examples are annotated with theoretical aspects, relationships among
the roots (if they exist), formulation of the solution, determination of the unknown
constants (initial conditions given), and, plots of the theoretical and numerical solutions.
Chapter 5 is devoted to coupled first order systems. A pair of coupled equations
is studied first. The use of eigenvectors and eigenvalues in obtaining the solution to
the homogeneous set is presented. The notion of defective matrices and the need for
generalized eigenvectors is described. Another method based on the conversion of a
pair of first order equations into a single second order equation is also presented along
with the method based on Laplace transforms, as additional means for verification.
The Runge-Kutta method is used as an extra step of verification. Phase portraits are
used to justify conclusions about the stability of the system based on the solution
obtained analytically. The concept of the fundamental matrix is invoked to obtain
the particular solution when forcing functions are present. The fundamental matrix
is used to obtain solutions when multiple coupled differential equations are present.
Taking note of the existence of defective matrices, the analysis is limited to coefficient
matrices of size [4 x 4] for the use of eigenvalues and eigenvectors. For larger matrices,
only the Laplace transform based method (which is used throughout regardless of the
size of the coefficient matrix) and the Runge-Kutta method are used for verification.
The examples are annotated by displaying eigenvalues and eigenvectors, identifying
defective matrices (algebraic and geometric multiplicities), degenerate eigenvalues,
generalized eigenvectors, etc.
Appendices provide in depth coverage of topics such as numerical methods for
solving differential equations (Euler’s and Runge-Kutta methods), theory of Laplace
transforms and applications to differential equations and phase plane analysis. In all
cases, theoretical aspects are enunciated with appropriate examples to demonstrate
the relevance to the issues presented in the main body of the book. The final appendix
(Appendix D) is devoted to concepts of linear algebra that are absolutely essential for
gaining a better understanding of the methods employed to find solutions to differential
equations. These include properties of matrices, solution of a set of equations using
row reduced echelon forms, Cramer’s rule if applicable, matrix inversion if permitted
and most importantly, the topic of eigenvalues and eigenvectors of square matrices.
An expanded view of defective matrices and generalized eigenvectors is presented to

www.TechnicalBooksPDF.com
4  Differential Equations: A Problem Solving Approach Based on MATLAB

illustrate how they play an important role in obtaining solutions to a set of first order
coupled differential equations.
A common thread throughout this book is the use of MATLAB (version 2016a)
for the creation of the displays associated with every example. In every chapter,
MATLAB scripts for solving example problems, creating phase plots, obtaining
Laplace transforms, etc. are given for the benefit of the reader. Through the use of
LaTex conversion and extensive use of symbolic toolbox, the displays of the examples
and solutions provide equations, explanations, sketches, plots, etc. reproducing the
class room work by an instructor. MATLAB is used not merely as a means to verify
the solution. It is also used to create a step-by-step solution matching the theory in
every respect and thus providing a pedagogical element which is a unique feature of
this book. Even though it is not possible to assure the absolute accuracies, every effort
has been made to ensure that the MATLAB scripts (written in version 2016a) and the
results provided are correct.
As indicated in the preface, the book is the culmination of the author’s participation
in teaching courses in Linear Algebra and Differential Equations to engineering
students. The books used during that period of instruction and a number of journal
publications by the author that came out of the preliminary work are listed below.

Bibliography
Books
Brannan, J. R. and W. E. Boyce. Differential Equations: An Introduction to Modern Methods and
Applications, 2nd Edition, John Wiley, NJ. 2011.
Farlow, J., J. E. Hall, J. M. McDill and B. H. West. Differential Equations and Linear Algebra, 2nd Edition,
Pearson, NY, 2007.
Lay, D. C. Linear Algebra and Its Applications, 5th Edition, Pearson, NY, 2015.
Nagle, R. K., E. B. Saff and A. D. Snider. Fundamentals of Differential Equations, 8th Edition, Person,
NY 2012.

Publications
Shankar, P. M. A MATLAB workbook on the pedagogy of generalized eigenvectors. Computer Applications
in Engineering Education, Vol. 25, No. 3, pp. 411–419, March 2017. doi:10.1002/cae.21808
Shankar, P. M. Pedagogy of Cramer’s Rule and beyond: A MATLAB workbook. Mathematics & Computer
Education, Fall 2016, Vol. 50 Issue 3, pp. 207–215, December 2016.
Shankar, P. M. Pedagogy of autonomous differential equations and equilibria using a MATLAB workbook.
Mathematics & Computer Education. Winter 2016, Vol. 50 Issue 1, pp. 57–72.
Shankar, P. M. Pedagogy of second order homogeneous differential equations: A holistic approach using
a MATLAB workbook. Computer Applications in Engineering Education, Vol. 24, No. 1, January
2016, pp. 114–121.
Shankar, P. M. Pedagogy of solutions to a set of linear equations using a MATLAB workbook. Computer
Applications in Engineering Education, Vol. 25, No. 3, pp. 345–351, March 2017. doi:10.1002/
cae.21803

www.TechnicalBooksPDF.com

CHAPTER 2

First Order Differential Equations

2.1 Introduction 5
2.2 D-field Plots 6
2.3 Methods of Solving First Order Differential Equations 9
2.3.1 Method of integrating factors 9
2.3.2 Separable differential equations 17
2.4 Additional Examples on D-field Plots 26
2.5 Autonomous Differential Equations 31
2.5.1 A general example 35
2.5.2 An example using MATLAB® and the script 44
2.5.3 Additional examples 46
2.6 Summary 77
2.7 Exercises 77

2.1 Introduction
Most physical and chemical phenomena involve changes taking place with respect to
one or more parameters. This means that in its simplest form, systems responsible for
these phenomena can be modeled in terms of an independent parameter (or variable)
and a dependent parameter (or variable). Since changes take place over time, the
easiest way to represent the system is through an expression describing the variation
of a parameter (temperature, pressure, concentration of a chemical, force, pressure,
etc.) in time. Variations are often represented in terms of derivatives resulting in first
and higher order differential equations to model these systems.
Differential equations of first order are characterized by the existence of the
derivative of the first order in an equation containing an independent variable (t) and
a dependent variable (y) such as
dy
= f ( t , y ). (2.1)
dt

In eqn. (2.1), f(.) is generally taken to be a function of two variables, even though
f(.) may be a function of y or t alone. It is also possible that f(.) is a constant. If
f(t,y) does not depend on t, the differential equation in eqn. (2.1) is identified as an
autonomous differential equation. If f(t,y) only contains terms that are linear in y,

www.TechnicalBooksPDF.com
6  Differential Equations: A Problem Solving Approach Based on MATLAB

eqn. (2.1) becomes a first order linear differential equation. If f(t,y) can be separable
and written as the product of two functions h(t) and g(y), a function of t and a function
of y, the differential equation is a separable one.

2.2 D-field Plots
Considerable insight into the systems described through eqn. (2.1) can be gained by
examining the behavior of the differential equation through the use of plots known as
directional field plots or D-field plots. They rely on the fact that eqn. (2.1) also is the
slope of y, describing how y varies with time t. Consider a simple differential equation
dy
= 6 − y . (2.2)
dt

If a value of y=6 is chosen, the slope is 0. For y=0, the slope is 6. If there is a way
to indicate the values of the slope at various values of y by short arrows on a plot of
t vs. y, the pattern created will provide information on how the solution varies with
time and what is likely to happen when t goes up or down. The plot so generated is
called the directional field or D-field plot. The plot can be generated with MATLAB
using the quiver(.) command which draws small arrows. The simple code is given
below and the resulting display is shown in Figure 2.1.
clear;clc
y=0:10; % pick values of y
t=0:.4:8; % pick values of t
[tt,yt]=meshgrid(t,y); % create a 2-d array of samples of t and y
dy=6-yt; % create dy/dt
dt=ones(size(dy)); % create corresponding time coordinates
figure, quiver(tt,yt,dt,dy,1.,‘b’) % quiver displays the directional arrows
xlabel(‘time’),ylabel(‘y(t)’), axis tight
title(‘dy/dt=6-y’)
hold on
plot(t,6*ones(length(t)),‘-r’,’linewidth’,2)
CC=[-5:5];% values of C
% now plot the solution
tt=t;
clear t
syms y(t) C
ys=dsolve(diff(y,t)==6-y); % get the symbolic solution
vars=symvar(ys);% find the symbolic variables
ys=subs(ys,vars(1),C); % replace the unknown constant with C
yss=MATLABFunction(ys); % create in-line function for plotting the solution
for k=1:length(CC)
C=CC(k);
ysS=yss(C,tt);
plot(tt,ysS)
end;
A solution to eqn. (2.2) can easily be found by rewriting it as
dy
= dt (2.3)
( − y)
6

www.TechnicalBooksPDF.com
First Order Differential Equations 7

Figure 2.1  D-field of dy/dt=6-y.

The solution is obtained by integrating both sides of eqn. (2.3) as


y ( t )= 6 + Ce − t . (2.4)

Regardless of the value of the unknown constant C, it can be seen that as t→∞,
the solution approaches a stable value of 6. This can be observed from the plot. If a
second step is undertaken to plot the solution for several values of C [for example,
ranging from 0 to 5] and displayed on the same D-field plot, the solutions (shown by
continuous lines) will follow the field directions arrows as shown in Figure 2.1. If an
analytical solution is unavailable, numerical techniques (Appendix A) can be used to
superimpose the samples of solutions as shown.
While eqn. (2.2) was autonomous, a slightly different case is that of a non-
autonomous linear differential equation
dy
= y + 5 − 3t . (2.5)
dt

Proceeding as before and taking an additional note of the existence of t by choosing
values of t along with values of y, the D-field can be plotted. The MATLAB script
appears below and results are shown in Figure 2.2.
clear;clc;close all
y=-5:.5:5; % pick values of y
t=0:.25:5; % pick values of t
[tt,yt]=meshgrid(t,y); % create a 2-d array of samples of t and y
dy=yt+5-3*tt; % create dy/dt
dt=ones(size(dy)); % create corresponding time coordinates
figure,
quiver(tt,yt,dt,dy,1.5,‘b’) % quiver displays the directional arrows

www.TechnicalBooksPDF.com
8  Differential Equations: A Problem Solving Approach Based on MATLAB

xlabel(‘time’),ylabel(‘y(t)’), axis tight


hold on
t1=t;
clear t
syms y(t) C
ys=dsolve(diff(y,t)==y+5-3*t); % obtain the symbolic solution
vars=symvar(ys); % find the symbolic variables
ys=subs(ys,vars(1),C); % replace the constant with C
ys1=MATLABFunction(ys);% create in-line function for plotting the solution
CC=[-2:.25:2];% values of C
for k=1:length(CC)
C=CC(k);
yss=ys1(C,t1);
plot(t1,yss),ylim([-5,5])
end;
title(‘dy/dt=y+5-3*t’)

Figure 2.2  D-field of dy/dt=5+y-3t.

Unlike the example in eqn. (2.2), the contours seem to diverge indicating that
the system represented in eqn. (2.5) is unstable. This can be established by getting
the solution of eqn. (2.5) as (methods of obtaining solutions are discussed in the next
section)
y ( t ) = 3t − 2 + Cet. (2.6)

The theoretical plots are superimposed (continuous lines). The benefits of D-field
patterns are clearly evident in terms of the directional arrows providing information on
whether the system is likely to attain a stable value once the system starts functioning
and how the behavior is likely to change with time, without actually knowing the
solution.
Additional examples of D-field plots are given in Section 2.4 following the
discussion of methods for finding solutions of first order differential equations.

www.TechnicalBooksPDF.com
First Order Differential Equations 9

2.3 Methods of Solving First Order Differential Equations


While D-field patterns provide useful information, it is necessary to have access to
solutions of the differential equations. Solutions may be obtained analytically and if
analytical solutions do not exist, solutions may be obtained numerically. Numerical
techniques are discussed in Appendix A and the two different methods of solving first
order differential equations analytically are given next. These are based on the method
of integrating factors and the concept of separable functions.

2.3.1 Method of integrating factors


First order linear differential equations can be solved using the concept of integrating
factors. Consider a first order linear differential equation with a dependent variable
y(t) and independent variable t given by
a ( t ) Dy + p ( t ) y =
g ( t ). (2.7)

In eqn. (2.7), a(t), p(t) and g(t) are either constants or functions of time and
dy
Dy = . (2.8)
dt

Equation (2.7) is rewritten as
p (t ) g (t )
Dy + y= . (2.9)
a (t ) a (t )
It is understood from eqn. (2.9) that
a ( t ) ≠ 0 . (2.10)

Rewriting eqn. (2.9) as


Dy + q ( t ) y ( t ) =
h ( t ). (2.11)

The integrating factor µ(t) is a function of time that satisfies the following relationship
d
 µ (=
t ) y ( t )  µ ( t )  Dy + q ( t ) y ( t )  (2.12)
dt 

Multiplying eqn. (2.11) by µ(t) leads to
µ ( t ) Dy + µ ( t ) q ( t ) y ( t ) =
µ ( t ) h ( t ). (2.13)

Comparing eqns. (2.12) and (2.13), the second term on the left hand side of eqn.
(2.13) yields
d
µ ( t ) = µ ( t ) q ( t ). (2.14)
dt

www.TechnicalBooksPDF.com
10  Differential Equations: A Problem Solving Approach Based on MATLAB

Equation (2.14) can be solved for µ(t) by writing


d µ (t )
= q ( t ) dt. (2.15)
µ (t )
Integrating both sides leads to the solution for the integrating factor µ(t) as
p (t )
∫ q ( t ) dt ∫ a (t ) dt
µ ( t ) e=
= e (2.16)

Equation (2.13) can now be rewritten as


d
 µ ( t ) y ( t )  = µ ( t ) h ( t ) . (2.17)
dt 

Integrating both sides of eqn. (2.17) results in
t

µ (t ) y (t )
= ∫ µ ( z ) h ( z )dz + C (2.18)
t0

Note that t0 is arbitrary (usually taken as 0) and C is an unknown constant. Rewriting


eqn. (2.18), leads to the solution to the differential equation in eqn. (2.7) as

1 
t  1 
t
g (z) 
y (t )  µ (=z ) h ( z )dz + C  ∫ µ ( z )
µ ( t )  t∫0
= dz + C  . (2.19)
 µ ( t )  t0 a(z) 

If the initial conditions are given, the unknown constant C can be determined and an
exact solution can be obtained.
MATLAB is a perfect vehicle to solve these problems through the use of the
Symbolic Toolbox. A few examples (including one where no analytical solution exists
appear below). All these were done in MATLAB to incorporate appropriate theory
and results as well as explanations if necessary such as the case where no analytical
solutions exist. The results are verified using dsolve(.) in MATLAB. It is noted that
the constants created with the integrating factor based approach will be different from
the unknown constants displayed in the solution obtained using dsolve(.). If the initial
condition y(t0)=y0 with t0=0 or the boundary condition with y(t0)=y0, t0≠0, the unknown
coefficients can be evaluated and an exact solution can be obtained. If the analytical
solution to the differential equation is available, the implicit solution in eqn. (2.19)
can be plotted by choosing a few values of C.
If the example falls in a special category such as the availability of the exact or
particular solution, unavailability of analytical solution, etc. these are indicated in the
displays created in MATLAB.

www.TechnicalBooksPDF.com
First Order Differential Equations 11

Example # 2.1

www.TechnicalBooksPDF.com
12  Differential Equations: A Problem Solving Approach Based on MATLAB

Example # 2.2 Boundary conditions given. An exact solution is available.

www.TechnicalBooksPDF.com
First Order Differential Equations  13

Example # 2.3

1" ...... , dl"-'-ntlM MjUltlon: Solution ullno Inltogr.tin{l Fletor


I~ OiI....... "' fq.oo""' .. Dy _ t _ 311 + e-"
The Differential Equation ocj. n(!)Oy + p(t)II _ g(t )
Integrati ng factor ~ p (t ) '"' ef $, .
)
Gene ral. Solution ' [1'.. i' (~ );;wa.
=- 1.'(1) '"';(ij ~. + C 1
art) '* I 1'(1) '* 3 g(t )"* t + e- f '

" . . . . . "' ,..... 1'(1) .. el '


a.-. _Ion (1nIog""" fIcOorj .. I/(t) '"' i + e-:' + C ..-so - ~

...... ......... _ _ might _ .....TCH . .. . .... _ of _ , ooI"'..... ~


•,.
o ••••••• ------------- --- ---
.,.

..:.-----;.:.------:-----:,.:-----~,:-----,~.;-----!,
,

www.TechnicalBooksPDF.com
14  Differential Equations: A Problem Solving Approach Based on MATLAB

Example # 2.4
," ",do r dm.r.n~" eq ... , Ion: 601_ ",1"11 ""-IIr.~"9 F. cto<
' ..... ~~Iion . Dy _ 2y + tt,{l '
TIle Different ial Eiluation =- Q(t)Dy + p(t)y _ get )
In~ating factor .... I,(t ) ,. tf $i.
General Solution .... y(t) ,. M • [1'.. ~. ) + C1
"($)~ds

a(t).... 1 p(!).... -2

">' ("+~c)
11 1" ,. ,

~-(- "' -I '" 11 t ,. "'("+~8)


II ,

_ " . . tho """ ...... mig'" _ .....TCH lor , he <_ 01 _110100_11

!IO , _________-J""""~-;;.~'I~~~~~"~'~c_------_,
I'
1"It,
.','.
, "
• "
',"', , ", , ", ,
. ',,, • , I'

• ,' f .., '"'.


-"",""
'."",'
,,-,,i,, ,'" ,
. _, ,, I , .'

. """'"
_"""',It,, ',
~';""
" ,
.. '- ," " , ,""' ,
~""'",
, ,
" I

• I IllI- ==::
--_
~~ -, - ""- " I

." --..... -" .. -


i~:::--
""
__ -' : "
- " '" ,
,,
I

, ,".. , ,' ,

www.TechnicalBooksPDF.com
First Order Differential Equations 15

Example # 2.5
1" ....... , d_ntlal '"'!uallon: Solution u.lng ..,..Un" Factor
I..... OiI......IaIE_ _ .. Th.
~,
= ~
, _ ,
11

The Differentia.! Equation -} a(/jOy + p(t)y 9(1)


Ink'grating factor =- p(t) = ef $I.
)
General Solution '* lI(t) - ~ [ll'(')~ds + c]
art ) '* t p(t) '* 2 g(t ) '* sin{t)

".
y( t)
'.
".
"',.
",.-
", ...
,,,",

,"'''
tI,"''''
..

.. , ,

www.TechnicalBooksPDF.com
16  Differential Equations: A Problem Solving Approach Based on MATLAB

Example # 2.6 Boundary condition available.

Integrating factor =* /-,(t ) =


GCJ>JnII Solution ' [f' 1'(0),,-I
.... vlt) - 1,(1 ) ~ a(.)d. I
+C
a(t) =* t' P{t} =* 2t g(t} =* O)s(t)
Inlagrnting factor 1'(1) ... /2
Gtn .... IOlllon (hIOIl""inII factor) ... lI(t) = ~
Gfn .... SoI ..... n(d'".""., MoIabI lI(t) = _ 8_;,"'1
_aryrordl""", ... lO E h v( ~)~O

... ~ B."..,.,. eo.w;o,_ .. C= 0 B = 0


P....... ,-..""'~~ .. ""...,"') .. y(t) = ~
P.......' - . _ (d_. ;o ........ j y(t) = ~

.., , ,

www.TechnicalBooksPDF.com
First Order Differential Equations 17

Example # 2.7 In this case, the analytical solution is not available for plotting because
it is given in terms of the error function of a complex input. The MATLAB script
displays this information.

Note that erf(ix) in the display is


z
2
erfi ( x ) =
−i erf ( ix ) = ∫ e dt
t2
(2.20)
π 0

2.3.2 Separable differential equations


While the method of integrating factors is applicable only to linear first order differential
equations, linear and non-linear first order differential equations may be solved using
the method of separable differential equations. This method takes advantage of the
form of the differential equation when the derivative is expressed as the product of
two functions of y (dependent variable) and x (independent variable) as in
dy
= f ( x ) h ( y ). (2.21)
dx

Rewriting eqn. (2.21),
dy
= f ( x ) dx . (2.22)
h( y)

www.TechnicalBooksPDF.com
18  Differential Equations: A Problem Solving Approach Based on MATLAB

Integrating both sides,


dy
∫ h( y)
= ∫ f ( x ) dx − C . (2.23)

Consider the example of


dy 4 x 2
= 2 . (2.24)
dx y

The differential equation in eqn. (2.24) can be expressed as
dy
= f ( x ) h ( y ) (2.25)
dx

f ( x ) = x2
4 (2.26)
h( y) =
y2
The integration of the separable equations leads to
y2
∫ 4 dy − ∫ x dx + C =
2
0 . (2.27)

The solution in implicit form will be,
y 3 x3
− +C = 0. (2.28)
12 3

Often it might not be possible to get an explicit solution for y in the form
y = G ( x, C ). (2.29)

In other words, it is easy to get an implicit solution of the form in eqn. (2.28) and
it may or may not be possible to get a solution in explicit form as in eqn. (2.29) where
G(.) is only a function of x and C. The implicit solutions can be plotted by choosing
a range of values of the unknown constant C. The plotting can be done using the
ezplot(.) command available in the symbolic toolbox in MATLAB. It should be noted
that the method based on separable functions will provide an implicit solution, while
the use of dsolve(.) in MATLAB leads to explicit solutions and these may involve
complex functions. Use of dsolve(.) may also lead to implicit solutions expressed in
the form containing phrases ‘RootOf’, suggesting that a simple representation of the
solution is not possible.
A few examples are given below demonstrating the various aspects of the approach
described above. All these were created in MATLAB and keeping up with the theme
of the book, the displays provide the theoretical aspects, steps involved, solution
obtained using the approach and the solution (if it exists) using dsolve(.). Note that the
unknown constants in the solutions obtained using the method of separable differential
equations and dsolve(.) in MATLAB may be different.

www.TechnicalBooksPDF.com
First Order Differential Equations 19

Example # 2.8 Explicit solution available using dsolve(.) as seen by the three separate
solutions for y, with two of them being complex.

.'m o.-<kr St-panble Ditferontial Equation ... :: _ f(z)h(~)


0iII_....
~....
<1M , ..
dz - Y
s-_ f(xl;. X 2
Font1i>.. >=> h() •
Y = ~

/ ht,j dP " Ii
$oIutioo ... / ht,) <41 - f /(z)dz + C• 0

SoUiOn~ r';
S-_E~ + i'.! + C = 0
-"3
y(Z) = 31 (if + B) l

,{.)_ 3' (-! +"I') ('I'+8)'


II{X) _ _ 3 1 (H 4J) (!J! +B)I
-~+~+c= o
. ,-------~~~~~~
~y---<

• . ' _ __ ;~"d
.,;;;"1'
, ----, ',',
, I,i,-, ,- -- _"I,','.'
II. , _',
" I " I ,

• I" I ",
y

",,'
I,.
I
", " ,
".'
,.,'
""
- ;, 1
" ' -.-_.'
I.,' ,
........
"II " , ' _ ___ '
"'" 1,- '
.:"1 2 J!I
001-3·2 •

.~--~--~--~--~--~--~
~ 0 2 •
~ $ ~

www.TechnicalBooksPDF.com
20  Differential Equations: A Problem Solving Approach Based on MATLAB

Example # 2.9 Explicit solution available using dsolve(.).

www.TechnicalBooksPDF.com
First Order Differential Equations 21

Example # 2.10 Explicit solution available using dsolve(.).

www.TechnicalBooksPDF.com
22  Differential Equations: A Problem Solving Approach Based on MATLAB

Example # 2.11 Explicit solution (complex) available using dsolve(.).

First Order Sepo.ro.ble Oiffur<!ntioJ Equatioh ... :: _ !\ %)h{~)


~... dll ~
e~"" .u - (r- 2)

s-_ I (x) = :r3 + X


F<roc1b.. "* hi) ,
11 = t;:i)'
J J{z }d:< ... r'(z;+2)
J- '- <4< ...
h\~)
11=£
~

C-("I·2·' 0 , 2 31
."-~----~--------------~
~ 0 2
~ 4 8 ~

www.TechnicalBooksPDF.com
First Order Differential Equations  23

Example # 2.12 Explicit solution unavailable using dsolve(.) as seen by the presence
of the phrase ‘RootOf’ in the MATLAB generated solution.

Fi", Ord<:r ~ Di!ferentio.l EAJuatioo ... ;;: _ f(z)hM


~"'" d~ _ fr:r'
E",*,", .u +8

~_ !(x)= 4x-x 3
' ''''''- ~ h(y ) = rh
jf(Z)iU" _ :r'(~-3) jh~)4" '(",,+32)

SoIut ioo .. f h(~)4 - j f(z}dz + C - 0

::""_~ c + ,(" :32) + Z'(Z;_8) = 0

--.
.. ~-...~ lI(r) "" RootOf(zl ' + 32z1 -
Roo .. camot be found
4B + il (z2 - 8), zl )

____~c:.~·~(=yi,=":I~='=(]':-:.I~-:~~----1
+ + 4 4 -

•r

,
• •

Co("l_i!-1 0 , 2 JI
' L-~~~~~~~~~~~~
~ ~ ~ 0 2 • 6

www.TechnicalBooksPDF.com
24  Differential Equations: A Problem Solving Approach Based on MATLAB

Example # 2.13 Explicit solution available using dsolve(.).

Pint Order Separable Differ_ial Equation • : - /(zlhM


0;"_101 d~ _ e- ' (;,; + c- ~)
e."", "'"
~ I(x) = ;t; + e-r
* h(y) = e- r

j h(~) d~ - Jf(z)<h: + C -
--
Solution ... 0

5, _E __ C+c-z+dI-t= O

,--
"""'" dooI¥O(.) 11(2:) - log(B - e- ' + f)

C+e-"+~-;' = o
.r-----~~~~~~----~


,
-
~ ~~-::~~ ~
--"',,,
,-,-", ",
>, ,',','""
"",,,
" , ,,", ' "
"
•, , , "
"

•• C-l"~·'
" ", , ,
• • •

www.TechnicalBooksPDF.com
First Order Differential Equations 25

Example # 2.14 Explicit solution unavailable using dsolve(.) as seen by the presence
of the phrase ‘RootOf’ in the MATLAB generated solution.

Solo.1m _I h{lr ) dv - 11(z}<it: + C - ()

~.":.,~ C _ ~(z'3m) _ r(~-3) = 0

,--
..... dooI¥o(.) ~(%) _ RootO£(zl~ - 3z1 + h
Rootl camot t. found
(:.2 + 12) - 3B, zl)

www.TechnicalBooksPDF.com
26  Differential Equations: A Problem Solving Approach Based on MATLAB

2.4 Additional Examples on D-field Plots


As seen in Section 2.2, D-field plots are useful in understanding the behavior of the
system modeled using a first order differential equation. The plots can be generated
using numerical integration based on the Runge-Kutta method (Appendix A), implicit
solutions generated using the separable function method or explicit solutions obtained
using dsolve(.) in MATLAB. The Runge-Kutta method requires the choice of initial
conditions (a single line of plot for each initial condition) which makes this approach
a little bit more difficult than the plotting the implicit solutions (choice of the unknown
constants needed). The explicit solutions also pose problems because the implicit
solution might be an equation in the form of yn (n>1). This means that explicit solutions
require plots of both solutions when n=2, all three when n=3. This also might pose
problems if the explicit solutions are complex. The following examples illustrate
the issues related to D-field plots created using numerical and analytical solutions.
While example # 2.15 compares the D-field plots generated using numerical and
analytical solutions, example # 2.16 compares D-field plots generated using numerical
and analytical solutions (implicit and explicit). The results clearly demonstrate the
advantage of creating the plots using the implicit solution. It should be noted that the
plots created using the quiver(.) command in MATLAB without plots of the solutions
can provide all the necessary information on the state of the equilibrium.
Example # 2.15 Numerical and simple analytical solutions of dy/dt=1-y.
close all;
syms t y Dy ff C
dy_dt=‘(1-y)’;
ff=[‘Dy=’,char(dy_dt)];% create the differential equation Dy=f(t,y)
V = odeToVectorField(ff);% vector field for creation of in-line Function
F = MATLABFunction(V,‘vars’, {‘t’,‘Y’});% inline function
t1=0:.5:5;y1=-5:.5:5;
[tt,yt]=meshgrid(t1,y1);
LT=length(t1);LY=length(y1);
for k=1:LT
for kk=1:LY
dy(kk,k)=F(t1(k),y1(kk));
end;
end;
dt=ones(size(dy));
dtn=dt./sqrt(dt.^2+dy.^2); % normalize the length of the arrows
dyn=dy./sqrt(dt.^2+dy.^2);% normalize the length of the arrows
quiver(tt,yt,dtn,dyn,1,’b’)
xlabel(‘time’),ylabel(‘y(t)’), axis tight
hold on
F = MATLABFunction(V,’vars’, {‘t’,‘Y’});% inline function
y0=[-20:2:20];
tspan=[0,5];
for k=1:length(y0)
[T,yode]=ode45(F,tspan,y0(k));%
plot(T,yode,‘color’,‘r’,‘linewidth’,2)
end;

www.TechnicalBooksPDF.com
First Order Differential Equations 27

xlim([0,5]),ylim([-5,5])
title(‘Directional Field of dy/dt=1-y: Numerical solution’)
figure
quiver(tt,yt,dtn,dyn,1,‘b’)
xlabel(‘time’),ylabel(‘y(t)’), axis tight, hold on
yy=dsolve(ff); % get the symbolic solution
vr=symvar(yy); % determine the existing symbolic variable
yy=subs(yy,vr(1),C); % replace the constant MATLAB outputs to C
CC=[-20:2:20]; % choose a number of unknown constants
for k=1:length(CC)
ffr=subs(yy,C,sym(CC(k)));
p1 = ezplot(ffr);
set(p1,‘Color’,‘red’, ‘LineWidth’, 2)
hold on
end;
title(‘Directional Field of dy/dt=1-y: Analytical solution’)
ylim([-5,5]),xlim([0,5])
hold off

www.TechnicalBooksPDF.com
28  Differential Equations: A Problem Solving Approach Based on MATLAB

Example # 2.16 Numerical, implicit and explicit solutions of dy/dt=(3t2+4t)/(y-1).


clear;close all
syms y(t) Dy ff C B fx fy
fun=(3*t^2+4*t)/(y-1);
ff=[diff(y,t)==fun];% create the differential equation Dy=f(t,y)
V = odeToVectorField(ff);% vector field for creation of in-line Function
F = MATLABFunction(V,‘vars’, {‘t’,‘Y’});% inline function
t1=1:.25:3;y1=-5:.5:5;
[tt,yt]=meshgrid(t1,y1);
LT=length(t1);LY=length(y1);
for k=1:LT
for kk=1:LY
dy(kk,k)=F(t1(k),y1(kk));
end;
end;
dt=ones(size(dy));
dtn=dt./sqrt(dt.^2+dy.^2); % normalize the length of the arrows
dyn=dy./sqrt(dt.^2+dy.^2);% normalize the length of the arrows
figure,quiver(tt,yt,dtn,dyn,1,‘b’)
xlabel(‘time’),ylabel(‘y(t)’), axis tight
hold on
F = MATLABFunction(V,‘vars’, {‘t’,‘Y’});% inline function
y0=[-4,-2,0,2,4];
tspan=[0 3];
for k=1:length(y0)
[T,yode]=ode45(F,tspan,y0(k));%

www.TechnicalBooksPDF.com
First Order Differential Equations 29

plot(T,yode,‘color’,‘r’,‘linewidth’,2)
end;
xlim([1,3]),ylim([-5,5])
tit1=‘$$ \frac{dy}{dt}=\frac{3t^2+4t}{y-1} $$’;
title(tit1,‘interpreter’,‘latex’,‘color’,‘b’)
text(2.2,1,‘[numerical solution]’,‘color’,‘r’,‘fontweight’,‘bold’)
%title(‘dy/dt=(3t^2+4t)/(y-1): Numerical solution’)
figure
quiver(tt,yt,dtn,dyn,1,‘b’)
xlabel(‘time’),ylabel(‘y(t)’), axis tight, hold on
yy=dsolve(ff); % get the symbolic solution
vr=symvar(yy); % determine the existing symbolic variable
yy=subs(yy,vr(1),C); % replace the unknown constant to C
% use of dsolve leads to two separate solutions and they need to be
% plotted separately. See the next cell on how to avoid this issue by
% seeking the implicit solution
yy1=yy(1);
yy2=yy(2);
CC=[-20:4:16]; % choose a number of unknown constants
for k=1:length(CC)
ffr=subs(yy1,C,sym(CC(k)));
p1 = ezplot(ffr);
set(p1,‘Color’,‘red’, ‘LineWidth’, 2)
hold on
end;
xlim([1,3])
for k=1:length(CC)
ffr=subs(yy2,C,sym(CC(k)));
p1 = ezplot(ffr);
set(p1,‘Color’,‘black’,‘Linestyle’,‘--’, ‘LineWidth’, 2)
hold on
end;
tit2=’$$ \frac{dy}{dt}=\frac{3t^2+4t}{y-1} $$’;
title(tit2,‘interpreter’,‘latex’,‘color’,‘b’)
text(1.8,1,{‘[explicit solution # 1 (continuous lines)]’;‘[explicit solution # 2 (dotted
lines)]’},...
‘color’,‘r’,‘fontweight’,‘bold’)
xlim([1,3]),ylim([-5,5])
figure
quiver(tt,yt,dtn,dyn,1,‘b’)
xlabel(‘time’),ylabel(‘y(t)’), axis tight, hold on
% in this case, the method of separable equations is used.
clear y(t)
syms y t % define y and t as symbolic variables
fy=int(y-1,y);
fx=int((3*t*t+4*t),t);
fq=[fy-fx+B==0]; % create an implicit solution B is the unknown constant
CC=[4:2:16]; % choose a number of unknown constants
for k=1:length(CC)
ffr=subs(fq,B,sym(CC(k)));

www.TechnicalBooksPDF.com
30  Differential Equations: A Problem Solving Approach Based on MATLAB

p1 = ezplot(ffr);
set(p1,‘Color’,‘red’, ‘LineWidth’, 2)
hold on
end;
tit3=’$$ \frac{dy}{dt}=\frac{3t^2+4t}{y-1} $$’;
title(tit3,‘interpreter’,‘latex’,‘color’,‘b’)
xlim([1,3]),ylim([-5,5])
ylabel(‘y(t)’),xlabel(‘time t’)
text(2.2,1,‘[implicit solution]’,‘color’,‘r’,‘fontweight’,‘bold’)

www.TechnicalBooksPDF.com
First Order Differential Equations  31

2.5 Autonomous Differential Equations


As mentioned in Section 2.1, a first order differential equation with no explicit
dependence on the independent variable is called an autonomous differential equation.
A typical autonomous first order differential equation can be expressed as
dy
y'
= = f ( y ) . (2.30)
dt

The right hand side of eqn. (2.30) depends only on the dependent variable y
and has no explicit dependence on the independent variable t. These differential
equations occur in the modeling of growth, decline, decay, or expansion of biological,
chemical, physical or other systems that exhibit temporal (time dependent) changes. An
autonomous eqn. such as the one in eqn. (2.30) plays an important role in understanding
the stability of the system such as whether the system is likely to be stable as time
passes or unstable as time passes. An example of the former might be the case of a
spread of a disease that slows down with time. An example of the latter may be the
unimpeded growth of nuclear radiation in the event of a nuclear disaster. One way to
understand this behavior is to examine what happens to the system when equilibrium
conditions are achieved. Equilibrium occurs when
dy
y'
= = 0. (2.31)
dt

The resulting solutions (y=y0), namely the values of y that satisfy eqn. (2.31)
are classified as equilibrium solutions, equilibrium points or critical points of the
system represented by the differential equation in eqn. (2.30). These identifications
of the solutions to eqn. (2.31) merely reflect the fact that they correspond to absence
of variation in y when t varies.

www.TechnicalBooksPDF.com
32  Differential Equations: A Problem Solving Approach Based on MATLAB

As an example to illustrate the significance of the critical points or equilibrium


points, we consider the case of population growth modeled using the Gompertz’s law.
The first order differential equation describing growth is

dy K
= ry log e   . (2.32)
dt  y

Because the quantity modeled is growth, the function y is always positive. The
two constants r and K are also positive. To understand the stability of the system
described through the differential equation in eqn. (2.32), the first step is to examine
a plot of the differential equation expressed as
dy
f ( y) = . (2.33)
dt
The function f(y) is plotted in Figure 2.15 for K=4 and r=2.
The plot of f(y) in Figure 2.15 shows two critical points, one at y=0 and the other
one at y=4 (value of K). These critical points can be obtained by solving f(y)=0 and
invoking L’Hospital’s rule for limits if necessary. Figure 2.15 also shows the plots of
df/dy. The value of df/dy at y=0 is positive while the value of df/dy at y=4 is negative.
The reasons for this classification of the two critical points become obvious if one
examines the direction fields given in Figure 2.16.
It can be seen that around y=4, the solutions are converging while around
y=0 the solutions are diverging, justifying the classification of the critical points as
asymptotically stable (y=K=4) and unstable (y=0).
Critical points may also be classified as semi-stable. Consider the system described
in terms of the following autonomous differential equation,
dy
f ( y) = = ( y − 1) ( y + 1)
2
(2.34)
dt
Figure 2.17 shows the plot containing f(y) and df/dy. There are two critical points,
one at y=–1 and the other one at y=1. Notice that df/dy is positive at y=–1 making
the EQM at y =–1 an example of the unstable equilibrium. On the other hand, df/dy
is exactly equal to 0 at y=1 and it goes from positive to negative on either side of the
equilibrium. This equilibrium point at y=1 is identified as semi-stable and the reasons
for this classification are seen in Figure 2.18 containing the directional field. While
fields move away from y=–1 indicating unstable conditions, the field shows unique
characteristics around y=1. On one side of y=1, field moves towards the equilibrium
point while on the other side, they move away from the equilibrium point. This is the
characteristic property that separates the semi-stable equilibrium from the stable and
unstable equilibrium conditions.
One can now state the rules for classifying the critical points, y=y0, as the following:
If df/dy at y=y0 is positive, the equilibrium point y0 is unstable.
If df/dy at y=y0 is negative, the equilibrium point y0 is asymptotically stable.
If df/dy at y=y0 is zero and df/dy goes from +ve to –ve or –ve to +ve on either
side of y=y0, the equilibrium point y0 is semi-stable.

www.TechnicalBooksPDF.com
First Order Differential Equations  33

Figure 2.15  Plot of f(y) and df/dy associated with Gompertz’s Equation.

t
Figure 2.16  D-field plot of the Gompertz’s equation.

www.TechnicalBooksPDF.com
34  Differential Equations: A Problem Solving Approach Based on MATLAB

There is another interesting class of autonomous systems which produce real and
complex values for the roots of the equation f(y)=0. Consider the case of an autonomous
system described by the differential equation
dy
f ( y) = = ( y − 1) ( y 2 + y + 1) (2.35)
dt
The roots of f(y)=0 are

1 3
=y 1, ± j . (2.36)
2 2

In addition to a real root at y=1, there is a pair of roots that form a complex
conjugate pair. Figure 2.19 gives a plot of f(y) and df/dy.
The absence of equilibrium state associated with the complex roots seen in
Figure 2.19 is further verified by examining the directional fields associated with the
differential equation shown in Figure 2.20. The reasons for the classification of the
critical point at y=1 is unstable is also seen from Figures 2.19 and 2.20.
The example shown in eqn. (2.35) also illustrates another interesting aspect
associated with autonomous systems that there is no state of equilibrium associated
with those systems with complex solutions of f(y)=0.

Figure 2.17  Plots of f(y) and df/dy vs. y for the autonomous system described by f(y)=(1–y)2(1+y).

www.TechnicalBooksPDF.com
First Order Differential Equations  35

Figure 2.18  Directional field associated with the autonomous differential equation f(y)=(1–y)2(1+y).

2.5.1 A general example


An example that can illustrate all these form of equilibria can be built on an autonomous
first order differential equation such as a quadratic equation,
dy
f ( y) == ay 2 + by + c. (2.37)
dt
Depending on the values of a, b, and c, the autonomous system described in
eqn. (2.37) will encompass all the three types of critical points as well as absence of
equilibrium (complex roots of f(y)). The various cases arising out of the different values
of a, b, and c are shown below. For each case, two displays are provided, one containing
the plots of f(y) and df/dy with the stability state clearly marked and the other one
containing the D-field plot with the stability values shown. The D-field plots can be
compared to the plots of f(y) vs. y and df/dy vs. y showing the matching descriptions
of the state of equilibrium associated with the autonomous system described by the
differential equation in eqn. (2.37).

www.TechnicalBooksPDF.com
36  Differential Equations: A Problem Solving Approach Based on MATLAB

Figure 2.19  Showing the critical point at y=1. The complex roots are not seen.

t
Figure 2.20  Directional field associated with the autonomous differential equation
f(y)=(1+y)(1+y+y2).

www.TechnicalBooksPDF.com
First Order Differential Equations  37

Case 1 a=–1, b=–1, c=0: One asymptotically stable (y=0) and one unstable solution
(y=–1)

,
._-
m~~ -

i

j <•
.,
., <.• •
·' .5
-,

., 'I

.,

www.TechnicalBooksPDF.com
38  Differential Equations: A Problem Solving Approach Based on MATLAB

Case 2 a= –1, b= –1, c=1: One asymptotically stable (y=0.62) and one unstable solution (y= –1.62)

i 0.5
~---
' • EQIoI,-


;;

.,
., •• • ,
·'.5
~ . "

>·,1--+--1-'/,

., • , • • •

www.TechnicalBooksPDF.com
First Order Differential Equations  39

Case 3 a=–1, b=0, c=0: a single semi-stable solution (y=0)


f IJI) .. - ;-


, ,,
,,
,,
,,
~ ---
• E(H._

i •••
, ,,
,<,
'._.,
,,
,
•• • ,

S ,,
,,
j ~~ ,,
,,
,,
,,
.,
, •• •• •• ., •
.
~ .
~ ~ .. ..
,
..••
••

..,

.,
••
••
••.,
• • • • ., •, , , • •

www.TechnicalBooksPDF.com
40  Differential Equations: A Problem Solving Approach Based on MATLAB

Case 4 a=–1, b=0, c=1: One asymptotically stable (y=1) and one unstable solution
(y=–1)

, , ,,
,
" ,,
~
--

..
EOM. _

,
(Y _l~ '_----~

• , " "
] "
• " ,,
,,
j -45
" ,,
,,
., ,
-1 .5 ., ., "
,

>

www.TechnicalBooksPDF.com
First Order Differential Equations 41

Case 5 a=–1, b=1, c=0: One asymptotically stable (y=1) and one unstable solution
(y=0)

.,
,
. • ,
,,----mT

,.. 0_5

www.TechnicalBooksPDF.com
42  Differential Equations: A Problem Solving Approach Based on MATLAB

Case 6 a=–1, b=1, c=1: One asymptotically stable (y=1.62) and one unstable solution
(y=–0.62)
f{.J - - r' + . + !
,
---
~
- EQw. -

>
i



,-.
•• , , , , ,

, ,,
" ,,
,-'"
I ,
" ,,
j .. ,,
,,
,
.,
, ..
., •• • , " ,
~

www.TechnicalBooksPDF.com
First Order Differential Equations  43

Case 7 a=1, b=–1, c=1: Equilibrium conditions do not exist


f ( y ) = y2 − y +1
In this case, the two roots form a complex pair
1± i 3
.
2

For this set of values of a, b, and c, no equilibrium conditions exist for the autonomous
system.
Case 8 a=1, b=0, c=0: A single semi-stable solution (y=0)

www.TechnicalBooksPDF.com
44  Differential Equations: A Problem Solving Approach Based on MATLAB

Case 9 a=1, b=0 and c=1: No equilibrium solutions


f(y) = 1+ y2
In this case, the two roots form a complex pair
0 ± i .
For this set of values of a, b, and c, no equilibrium conditions exist for the autonomous
system.
Case 10 a=1, b=1, c=1 No equilibrium solutions
f(y) = y2 + y + 1

In this case, the two roots form a complex pair

−1 ± i 3
.
2

For this set of values of a, b, and c, no equilibrium conditions exist for the autonomous
system.

2.5.2 An example using MATLAB and the script


Before additional examples are given, a short MATLAB script and results for the case
of an autonomous first order differential equation, dy/dt=(1+y)(1–y), are provided.
close all; clear
syms y(t)
dy_dt=‘(1+y)*(1-y)’;
fy=eval(dy_dt); % creates fy=(1+y(t))*(1-y(t));
ff=[diff(y,t)==fy];% create the differential equation Dy=f(t,y)
V=odeToVectorField(ff);% vector field for creation of in-line Function
F=MATLABFunction(V,‘vars’, {‘t’,‘Y’});% inline function
% create the data needed for the D-field plot
t1=-2:.2:2;y1=-2:.2:2;
[tt,yt]=meshgrid(t1,y1);
LT=length(t1);LY=length(y1);
for k=1:LT
for kk=1:LY
dy(kk,k)=F(t1(k),y1(kk));
end;
end;
dt=ones(size(dy));
dtn=dt./sqrt(dt.^2+dy.^2); % normalize the length of the arrows
dyn=dy./sqrt(dt.^2+dy.^2);% normalize the length of the arrows
clear y(t)
% generate plots of f(y) and df/dy
syms y t fy f(y) C
fy=eval(dy_dt); % create a symbolic function again: fy=(1+y)*(1-y)
ffy=[f(y)==fy];% create the equation for display (LaTex format
fdy=diff(fy,y); % differentiate f(y)=dy/dt w.r.t y
fin=MATLABFunction(fy); %create in line functions

www.TechnicalBooksPDF.com
First Order Differential Equations 45

fdn=MATLABFunction(fdy); %create in line functions


solF=[int(1/fy,y)-t+C==0]; %implicit solution using separation of equations
% plot everything
yn1=-2:.2:2;
plot(yn1,fin(yn1),‘r-’,yn1,fdn(yn1),‘--k’)
legend(‘f(y)’,‘df/dy’)
hold on
plot(yn1,zeros(1,length(yn1)),‘color’,‘b’,‘linewidth’,1.5)%line through y=0
xlabel(‘y’),ylabel(‘f(y) or df/dy’)
title([‘$’ latex(ffy) ‘$’],’interpreter’,‘latex’,‘color’,‘b’)
fs=solve(fy==0,y); % get the solutions of f(y)=0; EQM points
plot(double(fs(1)),0,‘*g’,double(fs(2)),0,‘*g’) % mark the EQM points
text(double(fs(1))-.3,-.3,...
[‘EQM Point=’,num2str(double(fs(1)))]) % label EQM points
text(double(fs(2))-.3,-.3,...
[‘EQM Point =’,num2str(double(fs(2)))])
text(-.8,3.1,‘Implicit Solution’)
text(-1,2.5,[‘$’ latex(solF) ‘$’],‘interpreter’,‘latex’,...
‘color’,‘b’,‘fontweight’,‘bold’,‘fontsize’,16) % display solution
figure, quiver(tt,yt,dtn,dyn,.75,‘k’)
xlim([-2,2])
xlabel(‘time t’),ylabel(‘y(t)’), axis tight
title([‘$’ latex(ffy) ‘$’],‘interpreter’,‘latex’,‘color’,‘b’)

www.TechnicalBooksPDF.com
46  Differential Equations: A Problem Solving Approach Based on MATLAB

2.5.3 Additional examples
Several additional examples are now provided. These MATLAB based examples cover
all aspects of the study of equilibrium displaying results as the analysis proceeds.
1. Provide details on the definitions of the three forms of stability.
2. Obtain the equilibrium points by discarding complex ones if complex and real
roots exist. If duplicate real roots exist, remove them from the plots.
3. In the absence of equilibrium conditions in a specific case, state the reason (non-
autonomous equation or equation with all roots complex).
4. Verification and multiple formats of displaying the points of equilibrium (plots
of the differential equation, its derivative and the D-field plot) and indicate the
equilibrium points with the state.
5. Justify the state of the equilibrium.
6. Obtain analytical solution (implicit solution using the method of separation of
functions) if it exists and display it on the D-field plot.

www.TechnicalBooksPDF.com
First Order Differential Equations 47

7. If analytical solution is unavailable, use numerical techniques to obtain the D-field


plot and indicate the absence of the analytical solution.
8. In every example, the first display provides the ‘rules’ while the last display
provides a summary of the analysis.
dy_dt=‘y*(1-y/2)*(1-y/3)’

www.TechnicalBooksPDF.com
48  Differential Equations: A Problem Solving Approach Based on MATLAB

Equlllbr1um PoInu.nd Stllbillty

,,
,,
>
,, ,
,,
,
,,., .. ,",~
~ 0.5
,
,
bo(l~
~ ,
----- --....

!
j ..

- -
.,
. . . -..
, , •
--- , , ~
~
,
• EOIo'._

" •

>

www.TechnicalBooksPDF.com
First Order Differential Equations 49

dy_dt=‘y^2+y+1’

www.TechnicalBooksPDF.com
50  Differential Equations: A Problem Solving Approach Based on MATLAB

dy_dt=‘(y-1)*(y^3+1)’;

www.TechnicalBooksPDF.com
First Order Differential Equations 51

Equil ibri um PoI nt(s) & Shlbility

Inpul fo<¥<II .. I(,)~ (>'+ 1) (, -1)

l'(y)=4y3 - 3y2 + 1
Gel r<UI bt,) 01 ~q: RE.O.L roo" 110) ... Ihe EOM Point.
[-I«li l«li O~.o_871 O_~ .871J

2014 <0<11. REAl 110 ~ E"''''''. <lI'<1y'' 1 · Yo b ' '-1)1


EOM_10 " [-1 I~ _ d_f<VCIoornpIU"'_

E _ I I ;"otiI1 EOM", y··I " _jMpI<Itic:a.,._ d~dy " ...


S"tIiIl)r EOM "' 1 · 1 is .....!ohlo; dII<1)r is . ..

Equilibrium PoIntJo.nd Stobllity

,
,
.1.5 ., •
~
--..,
'-- ,
~,

www.TechnicalBooksPDF.com
52  Differential Equations: A Problem Solving Approach Based on MATLAB

dy_dt=‘y^2*(y^2-1/25)’;

www.TechnicalBooksPDF.com
First Order Differential Equations  53

St.obllity of "'IIIonomout Sr t~""

.....--..... Sy ...... .. : = J(t,y) ii f(y)

_Iot,""_ .. : - J(y) - O,*f(y,) - O

EIJliIjbrIum _ . b'O) "" ... opood., R100l R-.


H_I"",,~_ .. ioI . _d~o.-
E_ bo_ fA dJ"'I. o od ..... 00:1 he E",I<wIIrn - . . . (y.)

"dy) ...
o
10....., ..,_
drdy) ... 10 _ :_)'mIII<II~._

o
~ 0 0 .. """'Yi"...,. gooo I""", .~ .. '" ~'''"' ........s~
o 0

_. . .. Equilibrium PoInt(,) .. St.obillty

GoO """'" ()'~ .. (toOl: REAL ""'" " °1 ...... EOM-'"


_b',I " [4 .2 0 0 02]
~_,, __ (j.~_~.,.,.lof~

EOM_,o " ].0.2 0 021 .... '_ngd_lO.


~ l»1tIIj< EOM.,· 42 ;' .. ~IooIy"'1IIo: dJ"'I ;. _
SIOOMy [OM ",oU;. ..". ._~0(1 ' _'- "_~~_
EOM.'·O.2 ;. ....._:~;._

www.TechnicalBooksPDF.com
54  Differential Equations: A Problem Solving Approach Based on MATLAB

""''',.'------'',

."'','.. .,,,.,.,.,..,,----,,-----,
".,.".,.,.,-,,.,
,,
, ,,,
.
>
~ ,

~o
,
,,

:L ,, ,
L
z ,,
,,,
,

www.TechnicalBooksPDF.com
First Order Differential Equations 55

For the remaining examples, the display of the rules has been suppressed.
dy_dt=‘2*y-sqrt(y)’;

www.TechnicalBooksPDF.com
56  Differential Equations: A Problem Solving Approach Based on MATLAB

E""lIIbo1um PoI""'.nd SIoIbil1ty

,
>
ij 0_5
--

~
l,o(IYf,~2$l
"'.'<4-',,;',,--=
...,,, -- -----------------
,,
,,
., ~
--* ""'
E<lM. _
,
•• o

....
"" 0.'

0'

.,
.,
• • • , .,

www.TechnicalBooksPDF.com
First Order Differential Equations 57

dy_dt=‘(1+y)*(y-1)^2’;

www.TechnicalBooksPDF.com
58  Differential Equations: A Problem Solving Approach Based on MATLAB

EquillbriumPoi _ _nd Stability

,,

, ..
,,
• ,,
~ ,, ,,
~

~

,,
b'~' 1

--
,
' -' , ----- ----ly ·'1 /
l ~.-

j .(I~
.,
., ., -,• .. ~
-.-:;.-
.. ,
< _1.5

www.TechnicalBooksPDF.com
First Order Differential Equations 59

dy_dt=‘(y-1)*(y^2+y+1)’;

www.TechnicalBooksPDF.com
60  Differential Equations: A Problem Solving Approach Based on MATLAB

Equilibrium Palm. ..<1 $tobility

, ,,
, ,,
,,

••
>
0.'
, -'
_",.,r
~
< -.- - - - -- ,

~
j .,
0

-
.,
0 ., . .. . - , " U
---
~
...""',..... ,
.. ..
,
,.
...
,..
,.,
> ,
O.

"
••
.,

0
• • ~ ., 0 , , • •

www.TechnicalBooksPDF.com
First Order Differential Equations 61

dy_dt=‘-2*atan(y)/(1+y^2)’;

www.TechnicalBooksPDF.com
62  Differential Equations: A Problem Solving Approach Based on MATLAB

Equlllbr1um PoInts.nd Bhlbliity

>
~ 0.5
rn
--..,
• EQM,_

,,
., ,
' -~
,,
., ~,e 4$ ~ 42 0 U OA M O~ ,

, -
DI 110M! F'-Id"'" 1m loll"" I IEu...... 14{l prox. Ie u......




~\\~\\=\\\\\\\
~\~\\\\\\\\\\\\\\\\\\\\\\\\
•, r'l\\\'0\'0\\'0\1\\~\\\\\\~\
0
I; ,. ".". I '" ,..

..•• -+
., v,f;IIII!III!!!!J1I!!!I!JIA
f-~ Ifl/M!lllll/mll!////!
••, 1,111'/// ,/@!!I//!~II/I/;.
.

www.TechnicalBooksPDF.com
First Order Differential Equations  63

dy_dt=‘2*y-3*sqrt(y)’;

www.TechnicalBooksPDF.com
64  Differential Equations: A Problem Solving Approach Based on MATLAB

Equilibrium PoIn .. _nil Stability

--..,'
~ • EClM. _

i> 0.5

~ , ,
[1~1

i
1-4.5
.,
•• , , , , •

,
",
>
,..
,
,.
,
., .,
• • • <

www.TechnicalBooksPDF.com
First Order Differential Equations  65

dy_dt=‘2-3*sqrt(y)’;

www.TechnicalBooksPDF.com
66  Differential Equations: A Problem Solving Approach Based on MATLAB

,, ,.";" - ------- ----


,
,,,•
,


••

www.TechnicalBooksPDF.com
First Order Differential Equations  67

dy_dt=‘y+2*y^2’;

www.TechnicalBooksPDF.com
68  Differential Equations: A Problem Solving Approach Based on MATLAB

Equilibrium PoInts.nd Swbility

.,
·1 -O.a -O.a -0.. -0.2 0 ,
DI...,tIoMI FlooId _ I

., • , , • ,

www.TechnicalBooksPDF.com
First Order Differential Equations  69

dy_dt=‘exp(y)-1’;

www.TechnicalBooksPDF.com
70  Differential Equations: A Problem Solving Approach Based on MATLAB

Equillbrtum PoIn", and Stability

,
>

, --- ------
~ M

~

!
i ~5

-
.,
., •• •• •• , • .- . . . . ~,
--...,
• EOM _ _

"

., ~~~~
-&"'-3-2·1012J~5
,

www.TechnicalBooksPDF.com
First Order Differential Equations 71

dy_dt=‘y*(1-y)^2’;

www.TechnicalBooksPDF.com
72  Differential Equations: A Problem Solving Approach Based on MATLAB

E'I"lIIbo1um PoInt..nd SUlbillty

,,
,

-
.,
~,
--..,
• EQI,O. -

• "

www.TechnicalBooksPDF.com
First Order Differential Equations  73

dy_dt=‘2*(1-y/3)*y-y’;

www.TechnicalBooksPDF.com
74  Differential Equations: A Problem Solving Approach Based on MATLAB

Equlllbrl ..... PoI_.owI Stllbllit)'

., • , " ,
"

www.TechnicalBooksPDF.com
First Order Differential Equations 75

dy_dt=‘y-abs(y)/y’;

www.TechnicalBooksPDF.com
76  Differential Equations: A Problem Solving Approach Based on MATLAB

EquUlb.tum PoIn .. and Stability

,
i> 0.5

~

.,
_1.& ., .. ~
--""

,
EQM. _

DI_tionaI Fiel d lind

_1 '.

www.TechnicalBooksPDF.com
First Order Differential Equations 77

2.6 Summary
First order differential equations have been discussed in this chapter. Differential
equations may be classified as linear, nonlinear, or autonomous. Solutions can be
found using the method based on integrating factors or the method on the separation
of functions. Solutions may be obtained using the dsolve(.) command in MATLAB
for numerical approaches based on Runge-Kutta methods (when initial conditions are
available). Even when analytical solutions are available, dsolve(.) and the Runge-
Kutta methods can provide means for the verification of the results. Particular attention
is paid to obtaining exact solutions using the method of integrating factors when the
first order differential equation is linear (depends only on the independent variable y)
and use of the separable function approach when the first order differential equation
is linear or nonlinear. The D-field patterns which can provide insight into the behavior
of the system described by the first order differential equation, are also explored. The
analysis of autonomous systems is carried out in detail. The method of separable
functions is used to obtain implicit solutions (in the absence of exact solutions, use
of Runge-Kutta methods) and multiple ways of understanding the three forms of
equilibria associated with these systems are provided.
A number of descriptive and self-contained examples are given providing a
broader view of the topics covered through multiple ways of verification of the results.

2.7 Exercises
1. Newton’s Law of cooling
a) A metal rod that has been heated to 180°F is brought to a room with an ambient
temperature of 70°F. If y represents the temperature of the rod, the rate at
which the rod is cooling can be expressed as

www.TechnicalBooksPDF.com
78  Differential Equations: A Problem Solving Approach Based on MATLAB

dy
−k ( y − R )
=
dt
The constant R is the ambient temperature in the room (70°F) and k a constant
(units of t-1) that depends on the room and its characteristics. It will determine how
fast or how slow the rod cools. Note that y(0)= 180°F. Analyze the equilibrium
conditions if k=0.25°F/min.
b) Often cooling does not flow a continuous decrease with time. If the rate of
cooling is expressed as (k1=5)
dy   π 
=−k  y − R − k1 sin  2 t  
dt   10  
2. In a rural area with a population of 3000, the population fluctuates due to births,
deaths and influx of a few people who enjoy the scenic areas. The population
growth is proportional to its population size at any given time. If 30 people move
into the area every year, the overall growth in population is
dy y
= 30 +
dt k

The population at any given time is y(t) and y(0)=3000. Obtain an expression for the
population at any given time. Use k=20;
3. Obtain the integrating factors and solutions for the following first order differential
equations. Verify your results in MATLAB. Note that Dy=dy/dt.

Dy =t + y − 4
Dy= y + 4

Dy =
4t + y, y (0) =
−1

y + sin ( t ) + cos ( t ) + 5
Dy =

Dy= y + cosh ( t )

sinh ( t ) − y
Dy =
t
sinh ( t ) y
=Dy −
t t2
1
Dy
= 2y +
1+ t2

4. For the following differential equations, obtain solutions using the method of
separation of functions. Verify your results in MATLAB.
dy
= 4 x2 y 2
dx

www.TechnicalBooksPDF.com
First Order Differential Equations 79

dy
=( x − 1)( y + 3)
dx

dy x 3 − x 2
=
dx 2y

dy x 3 + x −1
=
dx ( y − 2 )2

dy 4 x − x 3
= 3
dx y −8

dy 2 ( x + 4 )
2

=
dx 1− y2

5. For the following autonomous differential equations, identify the state of
equilibrium that might exist and verify your conclusions using appropriate plots
of the D-fields.

dy y
= −y
dt y
dy
= y ( y − 1)( y + 1)
dt
dy
= 1− ey
dt
6. For the following differential equation, examine the state of equilibrium for the
set of values (combinations) of b and c
dy
= y 2 + by + c, b =[−3, −2, 0, 2,3], c =[ −3, −2, 2,3]
dt

7. Bacterial growth
The bacterial growth might often be characterized by the fact that the growth
factor depends on the square of the bacteria present at any time while the bacteria
is growing at a rate proportional to its current strength. This means that
dy
= k ( y=
2
)y (r y
1
2
+ r) y
dt
8. Effect of antibiotics and elimination of bacteria
The effect of antibiotics can be modeled as the case where the rate of elimination
is proportional to the amount of bacterial as well as time.
dy
=− ry − kt
dt

www.TechnicalBooksPDF.com
80  Differential Equations: A Problem Solving Approach Based on MATLAB

9. Effect of antibiotics and elimination of bacteria. It is also possible to have the


model where elimination is modeled as
dy
= −kyt 2
dt
10. Effect of antibiotics and elimination of bacteria. Another model will be
dy
−ky 2 + ry
=
dt
Obtain an expression for the level of bacteria at any given time.

www.TechnicalBooksPDF.com

CHAPTER 3

Linear Second Order Differential


Equations with Constant
Coefficients

3.1 Introduction 81
3.2 Homogeneous Differential Equations 82
3.2.1 Solution from the roots of the characteristic equation 83
3.2.2 Solution using Laplace transforms 84
3.2.3 Solution using Runge-Kutta methods 84
3.2.4 Solution using decomposition into a pair of first order differential 85
equations
3.2.5 Interpretation of the solution of the homogeneous differential 88
equation
3.2.6 Additional examples 99
3.3 Non-homogeneous Differential Equations: Particular Solutions and 119
Complete Solutions
3.3.1 Particular solution 119
3.3.2 Complete solution 121
3.3.3 Additional examples 126
3.4 Summary 177
3.5 Exercises 178

3.1 Introduction
Second order differential equations occur in the study of models such as those that
describe the behavior of mechanical, electrical, chemical, transportation systems, etc.
For example, the best way to describe the motion of a pendulum, the characteristics
of the current or voltage in electric circuits, or the flow of chemicals, etc. is through
the use of second order differential equations. If the dependent variable is y and the
independent variable is t, a general second order system can be expressed in functional
form F(.) as

www.TechnicalBooksPDF.com
82  Differential Equations: A Problem Solving Approach Based on MATLAB

 dy d 2 y 
F  y, , 2 , t  = 0 . (3.1)
 dt dt 

Equation (3.1) will be a linear second order differential equation (or system) if it only
contains terms in y, y’ and y’’. A linear second order differential equation is
d2 d
a (t ) y ( t ) + b ( t ) y ( t ) + c ( t ) y ( t=
) g (t ) , a (t ) ≠ 0 . (3.2)
dt 2 dt
The function g(t) on the right hand side in eqn. (3.2) is the forcing function. If a(t),
b(t) and c(t) have no time dependence and are expressed as a, b, and c, respectively, the
differential equation in eqn. (3.2) becomes a linear second order differential equation
with constant coefficients. The analysis here is limited to such differential equations.
A second order differential equation with constant coefficients in eqn. (3.2) can
be expressed using primes as the notation for the derivatives as
g ( t ) . (3.3)
ay ''+ by '+ cy =

If g(t) is zero, the differential equation in (3.3) is homogeneous and if g(t)≠0, the
differential equation is of a non-homogeneous type. It is also implied that y=y(t).

3.2 Homogeneous Differential Equations


A second order homogeneous differential equation with constant coefficients is
= 0, a ≠ 0 . (3.4)
ay ''+ by '+ cy

The starting point of the analysis is the assumption that a solution to a linear
differential equation with constant coefficients will be of the form ert, with r being a
constant to be determined. By substituting y = ert in eqn. (3.4), the differential equation
in eqn. (3.4) becomes

 ar 2 + br + c  e rt =
0. (3.5)

Because ert cannot be zero, eqn. (3.5) leads to


ar 2 + br + c =0 . (3.6)
Equation (3.6) is referred to as the characteristic equation or the characteristic
polynomial associated with the differential equation in eqn. (3.4). It is also called the
auxiliary equation. The roots of the characteristic equation are

−b + b 2 − 4ac
r1 =
2a
. (3.7)
−b − b 2 − 4ac

r2 =
2a
Depending on whether the discriminant b 2 − 4ac is positive, zero or negative,
the roots will have the following characteristics

www.TechnicalBooksPDF.com
Linear Second Order Differential Equations with Constant Coefficients 83

b 2 − 4ac > 0 → r1 ≠ r2 ( real )



2
b − 4ac = 0 → r1 = r2 = r ( real ) . (3.8)
2
b − 4ac < 0 → r1,2 =r± =α ± j β ; (α , β real )

3.2.1 Solution from the roots of the characteristic equation


Based on the nature roots of the characteristic equation in eqn. (3.8), the general
solution to the differential equation in eqn. (3.4) can be written using the superposition
principle (general solution must be the weighted sum of the two possible solutions) as

yh ( t ) = c1e r1t + c2 e r2t ⇒ r1 ≠ r2 ( real )



yh ( t ) =c1e rt + c2 te rt ⇒ r1 =r2 =r ( real ) . (3.9)
yh ( t ) =e c1 cos ( β t ) + c2 sin ( β t )  ⇒ r1 =
αt
α + j β , r2 =α − j β ( conjugate pair )
If the initial conditions y(0) and y’(0) are given, the constants c1 and c2 can be
evaluated and the exact solution to the differential equation can be obtained. Otherwise,
the solution in eqn. (3.9) is identified as the general solution to the homogeneous
differential equation in eqn. (3.4). The subscript h on the left hand side of eqn. (3.9)
merely is an indicator of the fact that the solution is associated with a homogeneous
differential equation (or a homogeneous system). The solution with the subscript h is
also identified as the homogeneous solution.
A second order equation that requires a special mention is

y '' ( t ) = 0 . (3.10)

It is clear that the roots of the characteristic equation are both 0’s and this case
can be handled either from the simple observation of the differential equation or using
the general solution in eqn. (3.9) with r=0 resulting in a solution of the form

y (t =
) c1 + c2t . (3.11)

Thus, if b=c=0, roots of the characteristic equation will be identical and equal to
zero and the solution will be a polynomial of t of order 1 (absence of any exponential
terms in t).
If on the other hand, b ≠ 0, c = 0 the characteristic equation becomes

ar 2 + br= r ( ar + b )= 0 . (3.12)

Equation (3.12) results in one of the roots being a zero.


For the case of b = 0, c > 0, a > 0 , the characteristic equation becomes
ar 2 + c =0 . (3.13)
Equation (3.13) leads to purely imaginary values and the solution will consist of only
sine(.) and cosine(.) terms as seen in eqn. (3.9). As stated earlier, for other specific

www.TechnicalBooksPDF.com
84  Differential Equations: A Problem Solving Approach Based on MATLAB

combinations of a, b and c, roots may be complex or real. For all the analysis presented
here, a ≠ 0.
If the initial conditions are given, two additional possibilities exist for obtaining
the solution to the differential equation. The first approach is based on the use of
Laplace transforms and the second one is based on Runge-Kutta methods resulting in
a numerical solution. The Laplace transform based method is discussed first.

3.2.2 Solution using Laplace transforms


If we take the Laplace transform (Appendix B) of the differential equation in
eqn. (3.4), we get
a  s 2Y ( s ) − sy0 − y1  + b  sY ( s ) − y0  + cY ( s ) =
0 (3.14)

In eqn. (3.14),
y0 = y ( 0 )
y1 = y ' ( 0 ) . (3.15)
Y ( s ) = L  y ( t ) 
Note that L[y(t)] represents the Laplace transform of y(t). Solving for Y(s), the
expression for the Laplace transform of y(t) becomes

( as + b ) y0 + ay1
Y (s) = . (3.16)
as 2 + bs + c
Notice the similarity of the denominator in eqn. (3.16) to the characteristic equation
in eqn. (3.6). The solution y(t) is obtained by taking the inverse Laplace transform
of eqn. (3.16).

3.2.3 Solution using Runge-Kutta methods


As described in Appendix A, the Runge-Kutta methods are available to solve a set of
first order differential equations. This means that the differential equation in (3.4) needs
to be converted into a set of two first order coupled differential equations (specific
details of coupled first order differential equations are given in Chapter 5). The first
step in that process is to define
dy
z (t ) =
. (3.17)
dt
Using eqn. (3.17), the homogeneous differential equation in eqn. (3.4) becomes
0 . (3.18)
az ' + bz + cy =
A set of coupled first order differential equations can be written from eqns. (3.17)
and (3.18) as

www.TechnicalBooksPDF.com
Linear Second Order Differential Equations with Constant Coefficients 85

dy
=z
dt
. (3.19)
dz c b

= − y− z
dt a a
Using the matrix notation, eqn. (3.19) becomes
 dy 
 dt   0 1 
  y ' 
=
 
− c b =z ⇒ X AX (3.20)
 dz  −  

 a a 
 dt 

In eqn. (3.20) A is the coefficient matrix and X is the vector given as

 0 1 
A= c  b
− − 
 a a 
  y (t )   y 
= X =    . (3.21)
 y ' ( t )  z 

  y ( 0 )   y0 
=X ( 0 ) =   
 y ' ( 0 )   y1 

Equation (3.21) contains the initial conditions in vectorial form X ( 0 ) .
The approach seen with the decomposition of the second order differential equation
into a pair of coupled first order equations in eqn. (3.19) offers another possibility of
obtaining the solution for the homogeneous second order differential equation.

3.2.4 Solution using decomposition into a pair of first order


differential equations
The discussion of the linear second order homogeneous differential equation will be
incomplete without describing another analytical means to solve the eqn. (3.4) using
the concept of a pair of coupled differential equations (Chapter 5). The approach
used in solving the differential equation in this format is drawn from the Runge-Kutta
method in Section 3.2.3.
The second order homogeneous differential equation expressed in matrix form is

 dy   dy 
 dt   dt   0 1 
 y ( t )
=   b  
=
  c  . (3.22)
 dz 
2
d y  − −  z (t ) 


 dt 2   a a
 dt 
One can see that the two sets of equations embedded in eqn. (3.22) correspond to
y(t) and y’(t) which represent the two coupled variables (Chapter 5). The coefficient
matrix A is

www.TechnicalBooksPDF.com
86  Differential Equations: A Problem Solving Approach Based on MATLAB

 0 1 
A= c b  . (3.23)
− − 

 a a 
The eigenvalues of the matrix are given by (Appendix D)
0 . (3.24)
det A − λ I 2 =

Expanding the determinant in eqn. (3.24), the eigenvalues will be solutions of

aλ 2 + bλ + c =0 . (3.25)

Therefore, the eigenvalues are identical to the roots of the characteristic equation

defined in eqn. (3.6). The corresponding eigenvectors ν are obtained by solving

[ A − λ I 2 ]ν =0. (3.26)

A solution of eqn. (3.22) resulting in y(t) and y’(t) can be obtained using the
concept of eigenvalues and eigenvectors described in Appendix D. If the eigenvalues
are distinct and real, the solution y(t) and its derivative y’(t) are given by

 y (t )  λ1t  v11  λ2 t  v12 


=
  c1e   + c2 e   . (3.27)
 y ' ( t ) v21  v22 
In eqn. (3.27), the eigenvalues are λ1 and λ2 and the corresponding eigenvectors are
 
ν 1 and ν 2
  v11   v 
=ν 1 =  , ν 2  12  . (3.28)
 v21   v22 
Note that the interest in the present case is only in y(t). Thus, the solution for y’(t) can
be ignored and the solution for the differential equation becomes
y ( t ) c1v11eλ1t + c2 v12 eλ2t .
= (3.29)

The analysis becomes further simpler because A11 of the coefficient matrix A in eqn.
(3.23) . is zero. This leads to
 1  1 
= ν 1 =  , ν 2 λ  . (3.30)
λ1   2
Using the eigenvectors in eqn. (3.30), eqn. (3.29) becomes
( t ) c1eλ1t + c2 eλ2t . (3.31)
y=

If the eigenvalues are equal (λ), the eigenvectors will be equal resulting in
 1   1 
= ν 1 =  , ν 2 λ  . (3.32)
λ   
Using the condition for equal eigenvalues from eqn. (3.8), the coefficient matrix A
can be rewritten as

www.TechnicalBooksPDF.com
Linear Second Order Differential Equations with Constant Coefficients 87

 0 1 
A =  b2 
b . (3.33)
− − 

 4a 2 a 
The eigenvalue (equal) is
b
λ= −
. (3.34)
2a

It is clear from eqn. (3.32) that the coefficient matrix A is defective because
there is only a single unique eigenvector. Therefore, we need to use the concept of
generalized eigenvectors described in Appendix D. For a [2 x 2] matrix, the generalized
eigenvectors will be
 1   0 
= ν g1 =  , ν g 2   . (3.35)
0 1 
Following the procedure described in Appendix D, the solution set can be written in
terms of a basic solutions set
 b 
  1   1   1 + t 2a 
) eλt ( vg1 + t [ A − λ I 2 ] vg1=) eλt    + t [ A − λ I 2 ]  = eλt 
  
x1 ( t= 
 0 0 
2
 b 
−t
 4a 2 
(3.36)
 t 
 0 0 
) eλt ( vg 2 + t [ A − λ I 2 ] vg 2=) eλt    + t [ A − λ I 2 ]  = eλt 
  
x2 ( t= b 
 1 1   1− t 
 2a 
In eqn. (3.36), I2 is the 2 x 2 identity matrix. The solution y(t) and its derivative can
now be written as the weighted sum of the two basic solutions:
 b 
1 + t 2a   t 
 y (t )      . (3.37)
 =c1 x1 ( t ) + c2 x2 ( t ) =c1e 
λt
 + c2 eλt

 ( )
y ' t  −t  c 1 − t b 
  2a 
a 
The solution y(t) can now be written as
 b 
y (t ) =c1eλt 1 + t  + c2 teλt =( b1 + b2t ) eλt (3.38)
 2a 
In eqn. (3.38), b1 and b2 are two constants and it is seen that eqn. (3.38) matches the
form of the solution for equal roots given in eqn. (3.9).
Consider the case when the eigenvalues form a conjugate pair
λ±= α ± j β . (3.39)

In this case, the eigenvectors will be


  1    1 
=ν 1 =  , ν 2 α − j β  . (3.40)
α + j β   

www.TechnicalBooksPDF.com
88  Differential Equations: A Problem Solving Approach Based on MATLAB

Using eqn. (3.27), the solution set becomes


 y (t )  αt  cos ( β t )  αt  sin ( β t ) 
=  c1e   + c2 e   . (3.41)
 y ' ( t )  α cos ( β t ) − β sin ( β t )  α sin ( β t ) + α cos ( β t ) 
Separating the solution y(t) in eqn. (3.41) leads to

=y ( t ) eα t c1 cos ( β t ) + c2 sin ( β t )  . (3.42)

The solutions obtained using the decomposition match, those obtained directly
in eqn. (3.9). While acknowledging the fact that decomposition is the basis for the
Runge-Kutta method, there is no specific advantage in using this approach to obtain
the analytical solution of a second order differential equation. It must be noted that
the approach based on eigenvalues and eigenvectors also requires an extra step when
the coefficient matrix is defective.

3.2.5 Interpretation of the solution of the homogeneous differential


equation
The state of equilibrium associated with the system described by the homogeneous
differential equation can be understood from the behavior of the solution when t → ∞.
If the non-zero roots of the characteristic equation are real and positive, the system is
unstable. The system is unstable even if one root is positive and other one is negative.
The system is also unstable if the roots form a complex conjugate pair and the real part
is positive. The system is asymptotically stable if both values are distinct and negative.
The system is asymptotically stable when the roots are a conjugate pair with the real
part being negative. If the roots are complex and the real part is zero, the system is
purely oscillatory. When one of the roots is zero and the other root is negative, the
system can be considered to reach a stable state when t → ∞. If both eigenvalues are
0’s as with the case of the differential eqn. in eqn. (3.10), the system is unstable.
The state of the stability is seen by observing the trajectory of the plots of y(t)
vs. dy/dt w.r.t. the critical point of the system. The critical point is the solution to the
matrix equation
 0 1 
=

Ay = c b  y 0  . (3.43)
− 0
−   

 a a 
It can be easily seen that the critical point will be the origin, [0,0]. If one of the
roots of the characteristics is zero, the critical points will lie along the line through
the origin.
The state of equilibrium of the system represented by the second order differential
equation and its relationship to the roots of the characteristic equation is summarized
in Table 3.1.

www.TechnicalBooksPDF.com
Linear Second Order Differential Equations with Constant Coefficients 89

Table 3.1  Relationship between the roots of the characteristic equation and stability.

Properties of the Roots of the Stability


Characteristic Equation

r1, r2 >0 Unstable

r1, r2 < 0 Asymptotically stable

r1< 0 < r2 Unstable

r1 = r2 >0 Unstable

r1 = r2 <0 Asymptotically stable

r1 = 0, r2 < 0 Stable

r1 = 0, r2 > 0 Unstable

r1 = r2 = 0 Unstable

r1, r2 = α ± j β, α > 0 Unstable

r1, r2 = α ± j β, α < 0 Asymptotically stable

r1, r2 = α ± j β, α = 0 Oscillatory

As stated earlier, these conclusions can be visualized and understood by displaying


the phase portrait showing how y(t) and y’(t) vary. This plot is obtained by varying
the values of c1 and c2. The phase portrait as discussed in Appendix C can also be
obtained using the quiver(.) command in MATLAB®. The second order differential
equation is broken down to two first order differential equations, one in y and the
other one in y’ as in eqn. (3.22). An example of the phase plot creation along with the
MATLAB script is given below.
Example # 3.1 The differential equation y ''+ 2 y '+ 3 =0 . It has the roots, - 1 ± i 2 .
clear;close all;
% y”+2y’+3y=0
a=1;b=2;c=3;
roots([1,2,3])
A=[0,1;-c/a,-b/a];
[x1,x2]=meshgrid(-4:.5:4,-4:.5:4);
DX1=A(1,1)*x1+A(1,2)*x2;
DX2=A(2,1)*x1+A(2,2)*x2;
quiver(x1,x2,DX1,DX2,1),xlabel(‘y(t)’),ylabel(‘dy(t)/dt’)
hold on
syms y t
y=dsolve(‘D2y+2*Dy+3*y=0’);
dy=diff(y,t);
fy=MATLABFunction(y);
fdy=MATLABFunction(dy);
tt=0:.1:.5;
C=-4:1:4;
L=length(C);
for k1=1:L

www.TechnicalBooksPDF.com
90  Differential Equations: A Problem Solving Approach Based on MATLAB

for k2=1:L
plot(fy(C(k1),C(k2),tt),fdy(C(k1),C(k2),tt))
end;
end;
xlim([-4,4]),ylim([-4,4])
-1.0000 + 1.4142i
-1.0000 - 1.4142i

It can be seen that the roots are complex with the real part being negative and leading
to a stable equilibrium as seen by the direction of the arrows pointing to the origin.
The phase portrait is shown in Figure 3.1.

Figure 3.1  Phase portrait associated with the differential equation in Example # 3.1. The directional
arrows are moving towards the center, demonstrating that the system is asymptotically stable as suggested
in Table 3.1 (complex roots with real part being negative).

All the cases listed in Table 3.1 have been simulated through solving the differential
equation ay”+by’+cy=0 by choosing pairs of values of b and c. The selected displays
from the output of the MATLAB run are displayed below showing all eleven cases.
Three cases deserve special mention. These correspond to cases where either one
of the roots is zero or both roots are zeros. In all these three cases, the notion of the
critical point is less obvious. In fact, it can be seen that when one of the roots is zero,
the solutions move away from a line through the origin, dy/dt=0 (unstable equilibrium)
or move towards a line through the origin, dy/dt=0 (stable). When both roots are zero,
solutions appear parallel to the line dy/dt=0, moving in opposite directions.
For all the other cases, the critical or equilibrium point is [0,0] and the solutions
either move towards it (stable) or move away from it (unstable). The only exception is

www.TechnicalBooksPDF.com
Linear Second Order Differential Equations with Constant Coefficients 91

the case when the roots are purely imaginary in which case, the orbits or the trajectories
are circles or ellipses suggesting oscillatory behavior.

~-F'~~"~:~-~ .. ... .•
-~'~.'~'~-~
-_......
'"
,
,
, , , , , , , ,
.'
\ \ \
~
• , , \ , , ,
\ \ , \ \

~~~.~~,~~,~~~,~.
," _..........
, IIIIIIIIIII
! ! ! ! ! ! ! ! ! ! !
I I / I ! I I I / I I

.'
/ / / / ! / / / / / /
~
• I / / / I I I / / / /
.,

~U-L.~~,~,~~-L,~.

'"
www.TechnicalBooksPDF.com
92  Differential Equations: A Problem Solving Approach Based on MATLAB

, •• I ••••• <00:_ .. !to21 1-21

www.TechnicalBooksPDF.com
Linear Second Order Differential Equations with Constant Coefficients 93

0'

0' • , ,
~,

bo .............

, rr7;I-;T :/,;,,""1,/'7''"''''1.'-""I.r
' "'7' " ';'7'. "'--/.--'3;""":;0-/-,-,
f
, Ie / / ! I I / / / /
! !
! / I I / / / _
I I I / ! ! ! ! •

,
,,
1 f
,
I , t

,
,
)
,
I I I I J
0' ! ! ! / / ; I I
I I I
- - / / / I I I
, / / / / / I I I I I, 0/
,, / / / I I J j j 'j 'jf/
, , ,
0' ,,.•

www.TechnicalBooksPDF.com
94  Differential Equations: A Problem Solving Approach Based on MATLAB

...,.........
, • ·' . • ·".·!:toOb ... [..... U21 , .. .s.'·124 o ._

,"
,
,

.,

~-
~~~~~~~~~~~
3-2·10123
,0)

www.TechnicalBooksPDF.com
Linear Second Order Differential Equations with Constant Coefficients 95

,
, - -
, ,
I , ,
\ , ,
\ , , ,
,,,--/ /
, ..... _ / //

L:~'~-=-=-.~,~~~/~.~/~~>L~,-L_ ,
~ y~)

, " , . • • , . • • 2,,_ .. [..2,"]

,
,

www.TechnicalBooksPDF.com
96  Differential Equations: A Problem Solving Approach Based on MATLAB

, • - . .• -,;.. -2:, - ", (2 . '1


-_
- ...

H H ~
I / / /
, f. I / ,
-
f t
I I I
I I I
I
I
, ,
,
/ ,
,

I I I , , ,
'.
••
I
, I
I I
., , , , J
, , I II I
I I I j
-
/
< , I I

~H
/ I
,, / /

<
/ I
.,
I
I

H, ,
,"
, '..... ...."'- ,'. • • 1: _ .. [0 . 11
-~~

,
, 1- - - - - - - -
- - - - - - - - - - -
- -- --
• - - - - - - - - - - -
, - - - - - - - - - - --
. • , ,
,"

www.TechnicalBooksPDF.com
Linear Second Order Differential Equations with Constant Coefficients 97

Consider a homogeneous linear second order differential equation with constant


coefficients (Example # 3.2)
y '' ( t ) + 5 y ' ( t ) + 6 y ( t )= 0, [ y ( 0 )= 1, y ' ( 0 )= 0]. (3.44)

The coefficients a, b, and c respectively are 1, 5 and 6, resulting in the characteristic


equation
r 2 + 5r + 6 =0. (3.45)
The roots of the characteristic equation are
r1 =
−3 r2 =
−2 . (3.46)

The phase plane plot associated with the differential equation in eqn. (3.44) is
shown in Figure 3.2. It is clear that both roots are negative and the system is therefore
asymptotically stable as seen by the direction of the arrows that move towards the
origin, the equilibrium, or the critical point [0,0]. Figure 3.2 also displays the state of
equilibrium along with the roots.

Figure 3.2 Phase portrait associated with the differential equation in Example # 3.2. The asymptotic
stability of the system is seen.

The general solution to the homogeneous differential equation is obtained as


y ( t ) c1e −3t + c2 e −2t . (3.47)
=
Applying the two initial conditions appearing alongside the differential equation
in eqn. (3.44) to eqn. (3.47) and its derivative, two linear equations are obtained as

www.TechnicalBooksPDF.com
98  Differential Equations: A Problem Solving Approach Based on MATLAB

c1 + c2 =
1
. (3.48)
−3c1 − 2c2 =
0

The values of the constants can be obtained from eqn. (3.48) as


c1 = −2
. (3.49)
c2 = 3
The solution in eqn. (3.47) can now be written as
y (t ) =
−2e −3t + 3e −2t (3.50)

A component plot of t vs. y(t) and a phase plot obtained as y(t) vs. y’(t) are shown
in Figure 3.3.

Figure 3.3  Component plots associated with the differential equation in Example # 3.2.

The solution may also be obtained using inverse Laplace transforms. Taking the
Laplace transform of the differential equation, the Laplace transform of the differential
equation Y(s) can be expressed as
s+5 3 2
Y (s)
= = − . (3.51)
( s + 2 )( s + 3) ( s + 2 ) ( s + 3)
Taking the inverse transform, the solution is obtained as
y (t ) =
−2e −3t + 3e −2t . (3.52)

Several additional examples are now given providing more details and verification
using Runge-Kutta methods.

www.TechnicalBooksPDF.com
Linear Second Order Differential Equations with Constant Coefficients 99

3.2.6 Additional examples
A number of examples are now provided. In each case, the solution generated in
MATLAB provides the theory first, followed by the details of the solution. The
input is the set of values of a, b, c. If the initial conditions are given, the input set is
[a,b,c,y(0),y’(0)]. The results consist of the following displays:
1. Theory of Second Order Homogeneous Equations with constant coefficients.
2. Phase plane plot indicating the roots of the characteristic equation and the state
of stability.
3. The characteristic equation, its roots, properties of the roots, explanation on the
type of equilibrium.
4. If no initial conditions are provided (determined by the number of input values),
statement appears indicating the absence.
5. If initial conditions are given, the unknown constants are evaluated (with all the
steps shown).
6. Theory of Laplace transform based solution, inverse Laplace transform of y(t)
and Laplace transform based solution shown.
7. Comparison of all results including those obtained using dsolve(.) in MATLAB
and numerical techniques shown. The stability status is again indicated.
8. Plots of the solution (component plot and phase plot) are also provided.
Example # 3.3
abc=[1,-4,0];

www.TechnicalBooksPDF.com
100  Differential Equations: A Problem Solving Approach Based on MATLAB

Example # 3.4
abc=[1,0,9,1,-1];

www.TechnicalBooksPDF.com
Linear Second Order Differential Equations with Constant Coefficients 101

_ d cr.""",'O<1S1ie E~

'"
'" Eiganval.-
h' - 4ac > O, T,t r:.{ual,ooI. )
h' - 4ac _ 0, n - r:. _ '" (nul ,001 )
c=O. r,=O,r:.tOOTr,tO,r:.~O
h' - 4ac<O, T,, - ,~ - <> ± jtJ
[' , > 0 '" '1 > 0] '" ('. 2: 01 or (" > OJ, .... ",tIIe
[', <0 ..... '2 <01 '" I'. <OJ '" I" <01 ... ymploticol)o .1IIbl&
[' I - 0"2 <01"' 1'. <O· '1 · 0~ ._
[" • OJ. 00<iI0I0r';

,, T I •
"(I ) +9~I ) _0

, - . , . . , . . )'II1Om wlh """": - ,


,, •
(3i
• - 3i • ) , · , \ \ I
, I I , · , \ \
•, r I , , II \
f I , Pl. to.OI
I
" , "
Crip!
, I Ij
••
,
i
, ,
f
f
\ \
I
I ,
,
,
·
·
,
,
, I j
i j
I I
••.2.5 -2 " .5 •• .(1,5 0 0.5 .,5 2 2.5
,01

www.TechnicalBooksPDF.com
102  Differential Equations: A Problem Solving Approach Based on MATLAB

,..(' )+ 9 ,(' )- 0
0.. · ' E.,.- ..'+9 _ 0

(3 1 - 3i)
~ m.~ ·" u -"' jS; -' , .........
- - Go_ Sok.Ciat\ ~Iho _ r(I) - , c,CCII(IlI) · ; lft(:'JI) ) -
yet ) _ CI 008{3t) - C, sin{3t)

..
( -3." __, I ) --~ ( ". ,)
." -I

yet) = oos(3t) - ~
"'(1)+9,(1)- 0 ( rfO) - ' ."(fO) - . I ]

.,
-"
,I~"'"

(1. . . . 1, . ..,"'" udt ) = <X'>S(3 t) _ .~3t)


- . "" ..... pago

Y/{t ) = oos(3 t) - ~


,
......
M

/ 1-. ::"'1

, ..... . •

~


,
.,
.;
,
,.,•

www.TechnicalBooksPDF.com
Linear Second Order Differential Equations with Constant Coefficients 103

Example # 3.5
abc=[1,4,4,1,0];

For the remaining examples, the first display consisting of the theory is not provided.

www.TechnicalBooksPDF.com
104  Differential Equations: A Problem Solving Approach Based on MATLAB

V'( t) + .tu'(t) + .t v(t) • 0

( - 2 - 2)
E....,oI _ , RXlIS (r ,. r1 • r): - . _,..,PIOIiaOIIY ."''* oyshIm
-- G._, SoUiDn .-g Ifle ""* y~) ••n Ie, +°1'1--
yet) = e- 1 ' (Cz + C, t)

...
( c,-2e,.O ) .-~ ( "")
e,. 1

y(t ) = e- U (2t+ l )
~ ( I) + 4 11'(1) + 4v(1) _ 0

- .. ._
_on
~ T'_b",,) udt) = e- t t (2 t + l )

!U(t ) '"' e- 2I (2t + 1)

comp ....... tplot


, .... . e
••
..!------:~
0 0.5
,OJ

www.TechnicalBooksPDF.com
Linear Second Order Differential Equations with Constant Coefficients 105

Example # 3.6
abc=[1,-4,8,1,0];

www.TechnicalBooksPDF.com
106  Differential Equations: A Problem Solving Approach Based on MATLAB

v"(I) - 4 V(I) + 6v(l ) - 0


~E",*iOn r' - 4r +8 _ 0

_<'," .) (2 + 2i 2 - 2i)
_ P. . ol _ . ve; ",2." ± III ; ...... bleoy ......
- - - Go .... , Sok.CiOn "'""" u...- )'(I) • •~. [.,COOWI) -,,:!"i'o{IJI) J--
y(t) = _ e21 (I>.! sin(2t) - C, caI(2!))

y(t) = e2' (C06(U) - sin(U»

--"""""'- --
v"(I) - 4 V(I) + 8 ~ I) _ 0

(I."""" f_I)"") yt(t) = ..;z cu;;(2 t + !) <il'

,V.i(t) - ..;z COS(2t + n <il'

• r;omp_
x l0" , plot x 10' phoI .. pice

• , g
0
~ ;::
• ;:::
.,. ~
. •

.,
• , • • • ...
- •
'"
• •
x.o"

www.TechnicalBooksPDF.com
Linear Second Order Differential Equations with Constant Coefficients 107

Example # 3.7
abc=[1,0,-9,-1,1];

www.TechnicalBooksPDF.com
108  Differential Equations: A Problem Solving Approach Based on MATLAB

"'(I)-II,(t)_ O
",,"_ _ E~ r' - II - 0
( -, ')
o...c.o" _ :• -..;,,_ .)'11 ......
- - a._SGIuIico'I..w..gIhlO_ r(I) .c,e',' . cle'.'-
!I(t) _ CI e-l' + C:l el'

c, +c,,-- I )
( 3c,,-3c, - 1

- SGIuIico'I_ ............ ee, ' e,,)'" "'(/enIr._ -


2~4t,.o'
11( t) = - -,- -,-
"'(t)-IIP(I ) _ O

- ... _OJ' ......

I l . . . . T,. . bfm) lId t)


-"" .... P"""
= ,
..... , (~'+2)

,
...., (~'+Z)

, • ' 0 10 . . . H .....

,
~_1

"~
.,, •
,
• • • •." •
"'" .oJ >< 10'

www.TechnicalBooksPDF.com
Linear Second Order Differential Equations with Constant Coefficients 109

Example # 3.8
abc=[1,6,2,1,0];

www.TechnicalBooksPDF.com
110  Differential Equations: A Problem Solving Approach Based on MATLAB

"(I) + e ,(1) + 2 ,(1) _ 0 1rIO) " 1. flOl " 01


O. ..~ . '+ 8.+2 _ 0
( - v"i - ' v"i - ')
_p_aI' ....., . ..:.,"'I':' ..,_.,.....
- - - - ....... - 1'fI1".,.',' ·0,.','-
ritl - to e-'("..,·I) +tlze'(""'-I)

- - - _ ...... - "', . 0,1 .. ... _ .. - -

"-(1) +e,(I) + 2r(j) _ 0

.~ Ilibio or .....

= r,_tlfm) IIL (I) - e-"-v"f, (~+ '''11'''' - ¥l +~)


_,(v"f_S)
w (t) - e
(1.<1 I) _~·,(,I!· ·) (3J'1'-7)
14+ 14

compOMntplot
,
~. ,:' ••• r=;;;iI
L!..-"'-.J
~
.,
, , • • .,,
... M

,"

www.TechnicalBooksPDF.com
Linear Second Order Differential Equations with Constant Coefficients 111

Example # 3.9
abc=[1,-3,2];

www.TechnicalBooksPDF.com
112  Differential Equations: A Problem Solving Approach Based on MATLAB

Example # 3.10
abc=[1,-2,1,1,0];

www.TechnicalBooksPDF.com
Linear Second Order Differential Equations with Constant Coefficients 113

VO( I) - 2V(I) +v{t) - 0

( ' ' )
E~ RMlfOOta(f,"2 . f): +".; ....... IM .........
_ _ Go ...... ,SoIWonuoinglfle_ )'(I) • •~ "',+e,~-­

y(t)=e' (Ol+C,t )
DiIhoon .... )'!~".ppIy _ catdt. . . 0 0 > I y{Il) _ 1.1'(0) _ 0 I

--> ( " --' ) ":I - I

__ SoIWon_outIItwliOn«:, I e,)" NgonorfilOOlWon __

y(t) = -e' (t - 1)

-.-"" . . P. ---
VOlt) - 2V(t) + v{t) _ 0

IIdt) = -e' (t - 1)

-.
~T,....b",,)

(d-')
1I~(t) = - e' (t - 1)

, 10' COI'IIf'_plot o ,10' ~ .. plot

'L
• ., • :,,0lI)'l 1
'\ :>
~.,

>
~.,
, /
••
-• • • •• > ., • ,
", x 10'

www.TechnicalBooksPDF.com
114  Differential Equations: A Problem Solving Approach Based on MATLAB

Example # 3.11
abc=[1,-2,0,1,1];

www.TechnicalBooksPDF.com
Linear Second Order Differential Equations with Constant Coefficients 115

y"(t) - 2v' (t) - O


01...:1_ Equal"" r2 - 2r _ 0

_ . . • ..... r_ ',00".'0: ,"",Mable ....lIom


- - - 0:;.. ...... , SoIWon uoing Ir\e rooIO I'l'). (C, *'7-'.')--
yet) = c, +eze'l'

.-~ ( "'" -
-I)

'
() ="2+2
yt
. ,
y"(t) - 2v'(t) _ 0

-
O-~ T'...."'rm)

_on"..' _

,
.-
" F""[''--J''''''"M~-pIo~'~.'.=;;l
."

.~-::-'!'"'~
.L 2 ~ 8
.... • ,
y(l)
. .,, '0'

www.TechnicalBooksPDF.com
116  Differential Equations: A Problem Solving Approach Based on MATLAB

Example # 3.12
abc=[1,4,0,1,1];

www.TechnicalBooksPDF.com
Linear Second Order Differential Equations with Constant Coefficients 117

v"( I) + 41/' (1) .. 0


cr......,_.. E(JJOI ....

_(', &'2 1 (0 -4)


_ . . . ..,., Of %lito;, \ -0 ',.'0:IlitH oyotem
__ Ge-..ISdut .... uoIngtn.to<* Y~l. Ic, · c,.','l--
Y( ! )=CI +"l e- 4 '

( 0'+0 -' )
- 4 .". _ 1 .-~
0, - 1 )
( 00--1

. ~,
y(t)=~­ -,-
~(I) H i(l) .. 0

-
(UpIICO T, _ _ )

-"""'''-
Ydt) - ~ - ~

.., component plot



.., I, ..,
• . ..
;:-
•£ •
~
u

•• ,
- • • • • •••
'"
u

www.TechnicalBooksPDF.com
118  Differential Equations: A Problem Solving Approach Based on MATLAB

Example # 3.13

abc=[1,0,0];

www.TechnicalBooksPDF.com
Linear Second Order Differential Equations with Constant Coefficients 119

3.3 Non-homogeneous Differential Equations: Particular Solutions


and Complete Solutions
Methods to solve the nonhomogeneous differential equation in eqn. (3.3) can now be
described. The solution to the nonhomogeneous differential equation can be expressed
as

y ( t ) yh ( t ) + y p ( t ) . (3.53)
=
In eqn. (3.53), yh(t) is the solution to the homogeneous part given in eqn. (3.9)
and yp(t) is identified as the particular solution of the nonhomogeneous differential
equation in eqn. (3.3). Before examining the two approaches to finding the particular
solution yp(t), it should be noted that the homogeneous solution can be expressed as
a linear combination of two solutions y1(t) and y2(t) as

 y (t ) 
yh ( t ) =c1 y1 ( t ) + c2 y2 ( t ) =[ c1 c2 ]  1  . (3.54)
 y2 ( t ) 
The two solutions y1(t) and y2(t) can be obtained from eqn. (3.9) as
  e r1t 
  r2t  ⇒ r1 ≠ r2 ( real )
e 

  y1 ( t )    e rt 
y ( t ) =  =  rt  ⇒ r1 =r2 =r ( real ) . (3.55)
 y2 ( t )   te 
 cos β t 
eα t  ( )  ⇒ r = α + j β , r = α − j β
  sin ( β t )  1 2

The representation of the primary (or basic or basis) solutions (also known as the
fundamental solutions), y1(t) and y2(t), formed from the roots of the characteristic
equation play a crucial role in obtaining the particular solution.
Two different approaches exist for obtaining the particular solution. The first
one is the method of undetermined coefficients and the second one is the method of
variation of parameters and both methods rely on y1(t) and y2(t). There are advantages
and disadvantages and limitations to each of these methods. These methods are
described in the next section along with a comparison and approaches for obtaining
the complete solution of a non-homogeneous differential equation. We will start with
the particular solution before exploring methods to obtain the complete solution to
the differential equation expressed as the sum of the solution to the homogeneous
differential equation and the particular solution as given in eqn. (3.53).

3.3.1 Particular solution
3.3.1.1 Method of undetermined coefficients
This method relies on an initial guess of the particular solution by examining the
relationship of the roots of the characteristic function and the forcing function g(t),

www.TechnicalBooksPDF.com
120  Differential Equations: A Problem Solving Approach Based on MATLAB

thus indirectly exploring its relationship to the primary solutions y1(t) and y2(t). The
initial guess is made on the basis of hypothesizing the possible forms of the solutions
that can satisfy the differential equation and then creating a linear combination of
these. Once the initial guess is chosen, unknown constants that are used to combine
the various possible solutions are determined by substitution of the particular solution
in the differential equation and solving for them. The limitation of this method arises
from the approach itself, which is based on the association between the solution of
the homogeneous differential equation (more precisely the roots of the characteristic
equation) and the forcing function. Because the homogeneous solutions always appear
as functions of sin(.), cos(.), t and exp(rt) only, the method is applicable only when
the forcing function g(t) takes one of the two forms

g ( t ) = Ct m eqt (3.56)

Ct m e µt cos (ωt )


g ( t ) =  m µt (3.57)
Ct e sin (ωt )
In eqns. (3.56) and (3.57), C is a constant and m is an integer. This suggests that the
method of undetermined coefficients is not applicable for forcing functions of the type
h(t)/f(t), tan(t) or non-integer powers in t. Note that it is possible to consider cases
where g(t) contains a power series in t as

t m → an t n + an −1t n −1 +  a0 , n =
0,1, 2,.. . (3.58)

The method of undetermined coefficients provides the particular solution for the case
in eqn. (3.56) as
y p ( t ) = t s  Am t m + Am −1t m −1 +  A0  e qt . (3.59)

The value of s in eqn. (3.59) is


0, q ≠ r1 ≠ r2

=s =
1, q r1= or q r2 . (3.60)
2, =
 q r=, r1 r2 ( double root )
The particular solution for the case in eqn. (3.57) is
y p ( t ) = Am t m + Am −1t m −1 +  A0  t s e µt cos (ωt ) +
. (3.61)
 Bm t m + Bm −1t m −1 +  B0  t s e µt sin (ωt )

Equation (3.61) can be written using two unknown constants P and Q in a slightly
more compact form as
y p ( t ) = Am t m + Am −1t m −1 +  A0  emµt t s  P cos (ωt ) + Q sin (ωt )  . (3.62)

The value of s in eqn. (3.61) is


0, µ + jω ≠ α + j β
s= (3.63)
1, µ + jω =α + j β

www.TechnicalBooksPDF.com
Linear Second Order Differential Equations with Constant Coefficients 121

All the unknown constants can be determined by inserting yp(t) for y(t) in eqn. (3.3)
and solving for them.
If the initial conditions are given, a complete solution can be obtained by solving
for c1 and c2 in eqn. (3.53).

3.3.1.2 Method of variation of parameters


As mentioned in the previous section, the method of variation of parameters is not
limited to specific forms of the forcing function. It relies on the Wronskian W associated
with the differential equation, given by
 y (t ) y2 ( t ) 
W =  1' . (3.64)
 y1 ( t ) y2' ( t ) 
The particular solution is given by

y p ( t ) =  y1 ( t ) y2 ( t )  ∫ v ( t ) dt. (3.65)

The vectorial function v ( t ) in eqn. (3.65) is related to the inverse of the Wronskian as
 0 
 −1  .
v (t ) = W
 g (t ) 
(3.66)
 a 
While the particular solution from both approaches match, it should be noted
that the method of variation of parameters even works when the forcing function is
of the type h(t)/f(t). The limitation of the method arises from the fact that explicit
integration is required (which might not be possible in all cases), while the method
of undetermined coefficients only requires algebraic manipulation and substitution.

3.3.2 Complete solution
The complete solution to a non-homogeneous equation can be obtained from the
homogeneous and particular solutions. If initial conditions are given, solution can
also be obtained using Laplace transforms and Runge-Kutta methods.

3.3.2.1 Complete solution from homogeneous and particular solutions


The complete solution of the non-homogeneous differential equation can be written
using eqns. (3.53) and (3.54), as

y ( t ) = c1 y1 ( t ) + c2 y2 ( t ) + y p ( t ) . (3.67)

Given initial conditions y(0) and y’(0) the unknown constants, c1 and c2 can be
evaluated and the complete (exact) solution is obtained.

www.TechnicalBooksPDF.com
122  Differential Equations: A Problem Solving Approach Based on MATLAB

3.3.2.2 Complete solution using laplace transforms


If the initial conditions are given, the method based on Laplace transforms can also be
used to obtain the complete solution. Taking the Laplace transform of the differential
equation in eqn. (3.3) leads to
a  s 2Y ( s ) − sy0 − y1  + b  sY ( s ) − y0  + cY ( s ) =
G ( s ). (3.68)

In eqn. (3.68), G(s) is the Laplace transform of g(t). Solving for Y(s), the Laplace
transform of y(t) becomes

( as + b ) y0 + ay1 G (s)
=Y (s) 2
+ 2
. (3.69)
as + bs + c as + bs + c
The complete solution is obtained by evaluating the inverse Laplace transform of y(t).
Details are provided in Appendix B.

3.3.2.3 Complete solution using Runge-Kutta methods


If the initial conditions are given, the Runge-Kutta method can be applied for further
verification of the results. For the case of the non-homogeneous differential equation
in eqn. (3.3), the coupled first order equations become
 dy 
 dt   0 1   0 
   y     
 =
 c b    +  g ( t )  ⇒ x ' = Ax + p . (3.70)
 dz   − − z

 dt   a a   a 

In eqn. (3.70), p is a R2 vector.

 0 
 
p = g ( t )  . (3.71)
 
 a 
As an example (Example # 3.14), consider the following second order differential
equation,

y '' ( t ) − 2 y ' ( t ) =
t 2 e 2t . (3.72)
The characteristic equation is
0 . (3.73)
r 2 − 2r =
The roots are 0 and 2 and therefore, the homogeneous solution is
yh ( t =
) c1 + c2 e2t . (3.74)
We will look at the method of undetermined coefficients first. The forcing function
is the product of two terms, a quadratic term in t and exponential term containing
(2t). The scaling factor in the exponent matches one of the roots of the characteristic
equation, namely 2. This means that the initial guess of the particular solution must

www.TechnicalBooksPDF.com
Linear Second Order Differential Equations with Constant Coefficients 123

involve scaling by t. In other words, one of the terms in the initial guess of the particular
solution will be

y p1 ( t ) = te 2t . (3.75)

The other term in the initial guess of the particular solution will be a quadratic equation
containing t2, t and a constant,

y p 2 ( t ) = At 2 + Bt + C . (3.76)
In eqn. (3.76), A, B, and C are constants to be determined. The initial guess of the
particular solution will be the product of eqns. (3.75) and (3.76)

p (t )
y= y p1 ( t ) y p =
2 (t ) te 2t ( At 2 + Bt + C ) . (3.77)

If yp(t) is a valid solution, it must satisfy the differential equation in eqn. (3.72). Taking
the first and second derivatives of the particular solution in eqn. (3.77) and substituting
in eqn. (3.72), an equation relating A, B and C is obtained as
2 B + 2C + 6 At + 4 Bt + 6 At 2 =
t 2 . (3.78)
Collecting matching terms,
1
6 A =1 ⇒ A = (3.79)
6

1
6 A + 4 B =⇒
0 B=− (3.80)
4

1
2 B + 2C =0 ⇒ C = (3.81)
4

Substituting for A, B, and C, the particular solution in eqn. (3.77) becomes

 t2 t 1 
( t ) te2t  − + 
y p= (3.82)
 6 4 4
Now, we can explore the solution using the method of variation of parameters.
Because the roots of the characteristic function are 0 and 2, the two primary solutions
of the homogeneous part are
y1 ( t ) = 1
. (3.83)
y2 ( t ) = e 2 t
It is easy to observe that the solution to the homogeneous part is a linear combination
of y1(t) and y2(t) in eqn. (3.83). This means that the Wronskian W is
 y1 ( t ) y2 ( t )  1 e 2t 
=W =   2t 
. (3.84)
 y1 ( t ) y1 ( t )  0 2e 
' '

The inverse (Appendix D) of the Wronskian is

www.TechnicalBooksPDF.com
124  Differential Equations: A Problem Solving Approach Based on MATLAB

 1 
1 −
2  . (3.85)
W −1 = 
1 2t 

0 e
 2 

The intermediate vector v ( t ) in eqn. (3.66) is
 1 2 
  − 2 t exp ( 2t ) 
v (t ) =   . (3.86)
 1 2 
t
 2 
The particular solution is obtained using eqn. (3.65) as
1 1 1 1
y p ( t )=  t 2 − t +  te 2t − e 2t . (3.87)
 6 4 4  8
It might appear that the particular solution obtained using the method of variation of
parameters contains an extra term − 1 e 2t . But this is not an error because it is a scaled
8
version of one of the solutions, namely
y2 ( t ) = e 2t . (3.88)
This term can always be absorbed into the homogeneous solution. To see this, let
us write the complete solution using the method of undetermined coefficients first,

 t2 t 1 
y ( t ) = yh ( t ) + y p ( t ) = c1 + c2 e 2t + te 2t  − + . (3.89)
 6 4 4
The complete solution using the method of variation of parameters is

 t2 t 1  1  t2 t 1 
y ( t ) = c1 + c2 e 2t + te 2t  − +  − e 2t = c1 + c3 e 2t + te 2t  − +  (3.90)
 6 4 4 8  6 4 4
It is now easy to see that equations (3.89) and (3.90) are a match except for the
unknown constants and without any loss of significance, c3 can be replaced by c2. If
the initial conditions are given, the constants c1 and c2 can be evaluated.
Consider another example (Example # 3.15). The second order differential
equation is

y '' ( t ) + 16 y ( t ) =
t cos ( 4t ) , y ( 0 ) =
−1, y ' ( 0 ) =
1 (3.91)
The characteristic equation is

r 2 + 16 =
0. (3.92)
The roots are ±4 j resulting in the homogeneous solution of

yh ( t ) c1 cos ( 4t ) + c2 sin ( 4t )
= (3.93)
The forcing function is

www.TechnicalBooksPDF.com
Linear Second Order Differential Equations with Constant Coefficients 125

g ( t ) = t cos ( 4t ) . (3.94)

Because the forcing function contains the term cos(4t), the initial guess of the solution
based on the method of undetermined coefficients is


[A
y p (t ) = 1t + A0 ] t 
    P cos ( 4
t ) + Q sin ( 4t ) 
 . (3.95)
corresponds to t corresponds to cos ( 4 t )

Note that the scaling by t arises from the match of one of the solutions with the
cos(.) term in the forcing function. The quantity in the first bracket is the term from
the presence of the term t in the forcing function and the term arises from cos(4t).
Rewriting eqn. (3.95) in terms of unknowns B1, B2, B3, B4, we have
y p ( t ) = B1t 2 cos ( 4t ) + B2 t 2 sin ( 4t ) + B3t cos ( 4t ) + B4 t sin ( 4t ) . (3.96)
Substituting eqn. (3.96) in the left hand side of eqn. (3.91), we get
2 B1 cos ( 4t ) + 8 B4 cos ( 4t ) + 2 B2 sin ( 4t ) − 8 B3 sin ( 4t ) + 16 B2 t cos ( 4t ) − 16 B1t sin ( 4t ) =
t cos ( 4t )
(3.97)
Collecting the appropriate terms and equating their coefficients, we have

16 B2 = 1 . (3.98)

16 B1 = 0 (3.99)

0
2 B1 + 8 B4 = (3.100)

0
2 B2 − 8 B3 = (3.101)
From equations (3.98)–(3.101), we have
1
B2 = (3.102)
16

1
B3 = (3.103)
64

B=
1 B=
4 0 (3.104)

Substituting the values of B1, B2, B3, B4 in eqn. (3.96), the particular solution in eqn.
(3.96) becomes
1 2 1
=y p (t ) t sin ( 4t ) + t cos ( 4t ) . (3.105)
16 64

www.TechnicalBooksPDF.com
126  Differential Equations: A Problem Solving Approach Based on MATLAB

Using the method of variation of parameters, the Wronskian becomes


 cos ( 4t ) sin ( 4t ) 
W =  . (3.106)
 −4sin ( 4t ) 4 cos ( 4t ) 
The particular solution becomes
1 2 1 1
y p (t ) = t sin ( 4t ) + t cos ( 4t ) − sin ( 4t ) . (3.107)
16 64 256
It is seen that eqn. (3.107) contains the term sin(4t) which is part of the homogeneous
solution and can be discarded when the complete solution is written. The complete
solution becomes
1 2 1
y ( t ) = c1 cos ( 4t ) + c2 sin ( 4t ) + t sin ( 4t ) + t cos ( 4t ) . (3.108)
16 64
Applying the initial conditions,
c1 = −1
63 . (3.109)
c2 =

256
Following the substitution of the unknown constants c1 and c2, the solution becomes
63 1 1
y (t ) =
− cos ( 4t ) + sin ( 4t ) + t 2 sin ( 4t ) + t cos ( 4t ) . (3.110)
256 16 64
Taking the Laplace transform of the differential equation and collecting the terms in
Y(s), we have
1 32 s −1
Y (s) = − − . (3.111)
(s 2
+ 16 )
2
(s 2
+ 16 )
3
(s 2
+ 16 )
Taking the inverse Laplace transform, eqn. (3.111) leads to the solution in eqn. (3.108).

3.3.3 Additional examples
A MATLAB script was written to obtain the complete solution to a second order
linear non-homogeneous differential equation with constant coefficients. The goal
was to create a document consisting of theory, steps involved, solutions using multiple
methods, comparison of the solution, etc. All these were accomplished through a
simple input consisting of a vector of values of a, b, c, initial conditions, and another
input consisting of the forcing function. The results obtained consist of the following
displays:
1. Description of the Method of Variation of parameters (MVP).
2. Description of the method of undetermined coefficients (MUC).

www.TechnicalBooksPDF.com
Linear Second Order Differential Equations with Constant Coefficients 127

3. Step-by-step derivation of the particular solution using MVP.


4. Step-by-step derivation of the particular solution using MUC. If scaling by t or
t2 is required, it will be indicated, giving the reasons.
5. The particular solution obtained using the method of variation of parameters may
contain copies of the components of the homogeneous solution. To check this,
comparison of the particular solution, explanation of any discrepancy between
the two (MVP vs. MUC) and mitigation of the discrepancy are provided.
6. General solution shown if no initial conditions (determined by the number of
input values).
7. If initial conditions are given, the unknown constants are evaluated (with all the
steps shown).
8. Theory of Laplace transform based solution, Laplace transform of y(t) and
solution obtained using the Laplace transform is also shown.
9. Comparison of all results (overview) including those obtained using numerical
techniques shown.
Example # 3.17
abc=[1,0,4];gt=‘cos(2*t)’;

www.TechnicalBooksPDF.com
128  Differential Equations: A Problem Solving Approach Based on MATLAB

Melhod of Unct.l......an.d Coeft\CJenIS


a1/"'(t) + W et) + cp(t) _ Ct-c.
RooIl of"" ~i. equilllion. eI-tbr"C"O ere " end'2 ( Reel)
1-0, iI'q., "q. '2" ,.'2
.. 1 Wq-r ,orq"2' " . '2
..2 ' q.,. ,"z-' (double root)
Jp( 1) - '"(A..t'" ... A.._,' "'- ' ... . ..... A,I' ", A,I ", Ao)c"

Cf" e<'001{""t)
a1/'" (t ) + W(t ) + cp{t) - { Ct .. eI" ' ifl{(o.I/ )
Root' of fie charecleristiceq.uation. a('.br~, . .. . cd : IJ:I (Compl8JC)
•• 0, if p-ojo,l . o~1l'
.· l . lf p-ojo,l . <t~

Jp(1) _ 1'(A..t'" ... A.._,r-' ... ...... A"t' ... A, I ", Ao)o:"'""",(Id )
8,,' ...
... 1"{8",t'" ... 8",_, . - ' ... ...... B,I ... a.)o:'" .u.{....)

1Io(1) - 1"{A",t'" ......... A" ... Ao ¥ IP CN("") ... Q oi..(Id)]

P.rtlculer Solution: V.rlatlon of P.ramet....


JI'( I) + 4 u(1) - COII(21 )
RooII oft .... Chereclerillicor Aw6Iiao'y EqUlllion: r2 +4 _ 0
(21 - 21)
Gen .... .,kJlionl of' .... liDrrogan. Cif. EON: JI'( t) + 4 if( t) - 0
( y, (t ) _ ooo(2t) ",(t ) _ "n(2t) )
WRONSKIAN rwl ~ below
COII{21) sin(2t» )
( - 2 ,a1l(2 1) 2 cos(2t)

PIlftlaA. dJtIon ~ may aonlaln Y, (I) or yz(l) ..ni:h Qn


be IncIuciIcIIn ... hot,. ._ dJtIon with tIIlP"op:\II " ~ , - .
_ ~ + , .11(21)
11, (t) - 1ft 4
CorrpltM Solution ('NIh unkroown aonllanll b j & b 2 )
lI(t) = 1I,(t) + b:z sin(2 t ) + b1 cos(2 t)

www.TechnicalBooksPDF.com
Linear Second Order Differential Equations with Constant Coefficients 129

Coefficients)

www.TechnicalBooksPDF.com
130  Differential Equations: A Problem Solving Approach Based on MATLAB

Coefficients)

www.TechnicalBooksPDF.com
Linear Second Order Differential Equations with Constant Coefficients 131

Example # 3.18
abc=[1,-2,0];gt=‘t^2*exp(2*t)’;

www.TechnicalBooksPDF.com
132  Differential Equations: A Problem Solving Approach Based on MATLAB

Particular Solution: Variation of Parameters


11"(1) - 211(1) = t2!?,
RooIs oItr. CNrKtllru or Auxiliary Equation: r 2 _ 2r = 0
(0 2)
Genllflll soulions oIlhe Horrogen. Dill. EON: 11"( t) - 211(t ) '"' 0
( Yl (t) = 1 1/2(t) = e2' )
WRONSKIAN [WJgiven below

( o" 2e"" )
P8IIio:Ua r soIuIion obtairoed may oonlllin Y, (I) or Y2(t) -Mlicll can
be Included In tie 1"('''00\18- lOIuIion wltll approp!\al8 scaling lactors
_ e' (4i' -4Ji'·HII-3)
Yp(t ) _ :u
Co""ieIe SoIuIion twill ...... nown oonttanls b, & b2 )
y{t) = b, +Yp(t) + ~ e2 1
hltlcular Iol utlon: Method of Undetennlned Coefficients
lI"(t) - 2 1/(1) = t' e"
_ ot 1M a-....,Iorllllc: Of IwxMIrf EqUlllIon
(0 2)
1_ guHI lor 1M ~ dtIon (On_1'CIOI "'n:IIM; .... ir'4:! by I)

YP~)· ' ~~ .. A, t .. AOJ .. p(2"t)


P8l1i(Uar s:...", ~
Yp(t) = t e"H (~ -l+l)
Solution ot tho Homog..-uo Dill&1fI<IIilII Eft_{e, &C
z ..... _ )
~.(t) _ c, + '" e'
eo.,,1aIo Sdulion
v(/) .. v.,{t) + ~.(t)

www.TechnicalBooksPDF.com
Linear Second Order Differential Equations with Constant Coefficients 133

Coefficients)

Example # 3.19
abc=[1,2,1];gt=‘4*exp(t)’;

www.TechnicalBooksPDF.com
134  Differential Equations: A Problem Solving Approach Based on MATLAB

6"(1) + W(I) +cv(I) - Ct-e"


Raota 01 .... ~Ac equelion, a1-u-oc-O arlO " ....:I 'z (Real)
a-O, if q. ," q. 'z' ',.'2
,-lrq", orq"" " . ',
,-2, q..1"z., (<ioubit' root)
~(I) - I' (A-t" + A-_,t"'- ' + ... + A. I' + A,I + Ao)e'"
Cr O"C08(lo.It)
a,,(t) + W(t) + cy(t) - { Ct'" e"'8i7l(Id)
RODII 01 ~ cherllClerislic equation .• r-uoOC-o, '. - 0:1: J.tJ (Comple~)
I - O. if 1'+-10> • " 'itl
• - 1. if I'~. "--it'
w.I' ) - ,'(A-t" + A-_,I- ' + .. , + Atf' + A,I + Ao¥"....(...:)
+ t' (B,.t" + 8._,,-' + .. , + 8,,' + B,I + s.)c'" .in(",,)
w.I') - I'(A-t" +, .. + A" + Ao)o'" IP"""'...:) + Q ';n(...:))
P.rtleular Solution: Variation of P.ramet.,..
;""(1) + 2 y (t) + vOl _ 4e'
Aoott c1the OWra::...islic or Aulciliary EqUlllIon: r' +2 r +1 _ 0
(- I - I )
GM .... WJl.lllon,c1 the Hotrog8ll. Dit. EQH: ;""(1) + 2 y(l) + 11<1) - 0
( YI (t) = e- I Y2(t ) = te- ' )
WRQNSk _ (WJ given below

,-'
( -e-' ,,-. )
a- ' - t e-l

P8tllcaAr ~ obIIined may oonllin)" ,(1) or )"2(1) wI"Ii;h ...


be IndI.dId In .... ha" ......... -.dan v.iIh 1IPIl'0IN1I1CIIing flldonl

y,.(t) = f!
Cafl1llell Solution (wlh .........,..noon.urQ b 1 & btl
y{t ) "" y,,(t ) + b, e- 1 + b:1 t e- 1

www.TechnicalBooksPDF.com
Linear Second Order Differential Equations with Constant Coefficients 135

Coefficients)

www.TechnicalBooksPDF.com
136  Differential Equations: A Problem Solving Approach Based on MATLAB

Example # 3.20
abc=[1,-3,-4,1,-1];gt=‘2*exp(-t)’;

www.TechnicalBooksPDF.com
Linear Second Order Differential Equations with Constant Coefficients 137

Parti cular Solution: Variation of Par.lTllllel"l


1f(1) - 3V(I) - 4.v(I)'" 2e- '
RDoII oIlhe a.._iIllc: or A' r "EquMlan: ,.1 _ 3.. _ 4. .. 0
( - 1 ,,)
GeMqI . . .1Ion. oIlhe ItI>m>gen. Oil. EON: If(t) - 3 V(I) - 4. v(1) - 0
( lId t ) = e- I Y2(t ) = ell )

WRONSK"'N (WJ ~-

( -,-'e-' '''c" )
4.

P~r ICIIt.6:In aIlIained may ron1lin y 1(I) or "2(1) which CItI


be indudId In ... r..., . _ ICIIt.6:In with ~OIN. ~ fKkn

1I,(t ) "" 2e-' i~ '+I )


~ SolutIon (WIll""""'" _ b, & b )
2
lI( t ) = 1I,(t) + ~ e - I + b:l e-'I
Part icular sol ution : Method of Undetermined CoefI'klenta

'-1') - 311'1') - 4,1') = 2.-'


Aoc* 01 u-.. 0-....,_111" or Aulcillary EqUlllion
I - I . )
I.... p . lor lhe pricWr .....1Ion (One """ INIe"-: lQIitIg bV I)

",(1). I A" up(.q

PwtIca.Ur ScUIioII 0btIIned

....1·) - -"(
SI:*ooIion oIlhIi ~ Oin.~ EqUlllan (Co & ~ ori_)

..~(t) .. c:, fl·' + c,e"


eo",,1eII SaItftIn
..tt) " I/,(t) + ..~(t )

www.TechnicalBooksPDF.com
138  Differential Equations: A Problem Solving Approach Based on MATLAB

Coefficients)

www.TechnicalBooksPDF.com
Linear Second Order Differential Equations with Constant Coefficients 139

Complete Solution usIng Inverse Laplace Transform


a!l'(I)+bv'(I)+cy-g{I) Yi{) (as+ b)J,\) + aYI + G{s)
[y(O) !,(I,y(O) YI] ~ l s ((1S2 + bs + c)
!I'(I) - 3i(t) - 4y(t) _ 2e- '
Laplaoa 1"",s/""" Y(I) of 1'(1)

_ e-'(2,,!i'_IOf+23)
( ) -
YLt 25

SO..:ion <freeiV Ilsing dsolve{.)

e--< (2e~' -10t+23)


y(t) ~ "

The Dill_til Eq_


~(I) - 3;(1) - 4 1'(1) _ 2c- ' ( .. . l r. __ 1 )

P . . _,.,....",

Yp(t) =-¥
eo",,_ SoIWon
y(t) = .-. (2'"".;IQ'+23)

~
, r"""=':-:O"="=-= "'·C
2~
F;:;;]
"'''----,
--.
.-
phIt. . plot

,
'. .~--,~- ~"~. .. ,
'"
www.TechnicalBooksPDF.com
140  Differential Equations: A Problem Solving Approach Based on MATLAB

For the remaining examples the displays on their theory are not shown.
Example # 3.21
abc=[1,0,4,-1,1];gt=‘cos(2*t)’;
Linear Second Order Differential Equations with Constant Coefficients 141

Coefficients)
142  Differential Equations: A Problem Solving Approach Based on MATLAB

1O _ _ t ", _ I )

lAp""'" t"","'OI'TTI y\ _I 01 )'(II

YL(t) = ~ - cOS(2 t) + 1"1~')

yet) = rl,Y') - cos(2t) + 1"1 2/ )

p-,-
n. ~bI Equotion
11"(1) + 4 P(I) - ocr.(21)

y,(t) = "11 2
0)
( . _ _ 1 ., _ 1 )

~--
y(t) = 0"(220 ) - <Xl6(2/) + !...!!j!!l

, eornp_plol
, ""M'"
~ " ~

;=' 0
>
~

• , • •• ., ,
" .... • ,.. "
Linear Second Order Differential Equations with Constant Coefficients 143

Example # 3.22
abc=[1,2,1,0,1];gt=‘4*t*exp(t)’;
144  Differential Equations: A Problem Solving Approach Based on MATLAB

Coefficients)
Linear Second Order Differential Equations with Constant Coefficients 145

v"(t) + 2"(1) + 1/(1) = 4 t'!


Lapl""" ,,,,,,slorm y(') of )'(1)

l'C (,j _ .f 2 _+5


L - (0' I)'

SoUion d,,,dy uslog 1Is0....,1.)

y(t) = e- t (2t -e 2 '+ trP+ l)

Tho Dill......, Eq,,",ion


v"(t) + 2"(1) + I/{ f) _ .1'"
PII1;o.u, ....... ion
I/p( / ) = e (t - I)

~--
lI(t)=e- ' (2t -e2'+ t el'+ I)

~ -~
,~
'II ; : :
~
• - .- -.."

•• ,
... ~ . 1000

,"
2!DJ J(D)
146  Differential Equations: A Problem Solving Approach Based on MATLAB

Example # 3.23
abc=[1,-2,1];gt=‘4*t*exp(t)’;
Linear Second Order Differential Equations with Constant Coefficients 147

Coefficients)

Example # 3.24
abc=[1,0,0,0,-1];gt=‘t^2+t+1’;
148  Differential Equations: A Problem Solving Approach Based on MATLAB

Coefficients)
Linear Second Order Differential Equations with Constant Coefficients 149

Complete solution using the Particular Solullon


Diflerenbl Equalion Ini~aI mndiliooos (IC)

If(t) = t 2 +t + 1 [v(O)oO. y(O)- _1 I

Generail101J1on (Pa rbAar SoiUlion pM Homogeneous soIUIion)

y (t) =c.z +Clt+t2 ( h + ~ +n


Equalions lor C, and C ell., the epple.llon oIlnilial Conditions
l

~- O )
( C, __ I
._. ( ,,=- -1)
~ 0

MatvtiCal SoiUlion from P.,kutar Sdulbn & Ho:Imogeneous solution

. (t) = " (1'+21+6) _ t


12
Complele Solulion using Inverse Laplace Trilnlform
,,!I"(t)+ by'(t)+ q ' _ g(t) 1":() (as + b)lAI+aYl +G(s)
(y (O) - !oIl , y'(O)- yLi -+ l. S (as2+bs + c)
y"(t) _ t 2 + t + I (110 _ 0 !I, - -I)
lapl""" t"""sform VIs) 01 )'(1)

SoIuIion using i.......,;e l1opiaoe

_ t(t~+2 t'+6t- 12)


YL( t ) - 12

Solution oracty u .. ng dsolwl.)


150  Differential Equations: A Problem Solving Approach Based on MATLAB

Example # 3.25
abc=[1,1,2,0,-1];gt=‘exp(t)*sin(t)’;
Linear Second Order Differential Equations with Constant Coefficients 151

Plrtleulllr solution: Method of Uno.termlned Coe"lelents

lI'(t) + v'(t) +2 y (t} = f! sill(t)


ADaM 01 tht cr...,1Ir1ltic ~........,. Eq....1Dn

(-1+4' -j -4' )
I.... gue. for the I*ICWt .,kllion (AoaI .... r-.: no a::aIing byl)

Y,(I)· (P·c.o.(t) . O·.In(I M.'


p ... itUllr Solution ObtaIned

SdIllon oItht Ht:omag........ DifIt....... Eql*lon (c, &c z ......-.)

..1'1- , - I (" ~(4') - " ".(4'))


"',,"--
u(t) - ".(1) + JIiI (t)
Comparison of P.-tleul .. Solutions
11"(') + V(t) + 2.(t) = ~ "n(t)
Ro<*oItheO....cWilticorAwililryEqUllllan: ( -1+41 - I ->t' )
Gen .... .,kllion.oI the Ho........ Dif. EON: V'(t) + lI'(t) + 2 u(t) - 0
( . ,(t ) = , -I =(4') I/>(t) - , -I .in( 4') )
P8I'lIrlMr IOIuIIIon (Vnlion 01 pera ....... rs)

1I,(t ) = .tie' 71+1)


P8I'lIrlMr IOIullon (UndIII. II. Old CoIIIk:IInIa)
",(t ) -~, ("f' - "1")
152  Differential Equations: A Problem Solving Approach Based on MATLAB

Compl.t...,hllion uo"'g lho Particular $oIu11oft

VOlt) + v(') + 2v(t) _ <' llin(')

___ ( " ~"' '' ''''' <n''''Hoo_ N · . . . . "'"

Compllot" Solution us ing Invwu Laplace Transform


aV'(t)+bIl'(t)+CI/ - g(t) 'IC() (a~ + b)!.Il + a!lt + G(~)
~(O) - ~,II'(O) - \l,l --+ L 8 (as2+b8+c)
1I"(t)+y'(I}+2v(t) ...... ,,(t)
lapIaoo trw>otoon yeol <JI )'(t )

~ (,) = ~ - l
L ~
SoI ... ion uoiOil morse l.Itjja oo
Linear Second Order Differential Equations with Constant Coefficients 153

Example # 3.26
abc=[1,-3,-4,1,-1];gt=‘2*t*exp(-t)’;
154  Differential Equations: A Problem Solving Approach Based on MATLAB

Coefficients)
Linear Second Order Differential Equations with Constant Coefficients 155

Complete lolulion ullng the Pfu1leullr SollAlon


I..... oondilionl (IC)

V'( I) - 3"(1) - 4 ..el) _ 21 e'"

GIn... IO~"'" (1" "'<""8< SokAion pQ ~ l<lII.fionl

y(t) = CI e-' + eze4 ' - te- ' U+ ~)

0,+ •• ' )
( 4 c, - c, - /;, - - 1

AIWyIcaI Sak.Cion tom 1'''''''''' Sak.Cion & Ib, ~ ..... aoIuIon


"it) = _ . ... ( IO'_ 2e.. +::ti .. _ 123)
" 13

y"(t) - 311'(t) - 4y(t) = 2te'" (JI> - I ~l - -l )


lap""" \tan",,,,,,, y(al "'\111

JC (,) = _ _~+2~2 +7~ +2


L (HI )' (6--4 )

Soh.tion ""'''II j""""", LaPaoe

_ _ e- ' (lOt - 2eM+25i' -1 23)


y ( t) - 125
156  Differential Equations: A Problem Solving Approach Based on MATLAB

Example # 3.27
abc=[1,8,16];gt=‘2*t*exp(-4*t)’;
Linear Second Order Differential Equations with Constant Coefficients 157

Coefficients)

Example # 3.28
abc=[1,8,16];gt=‘2*t^2*exp(-4*t)’;
158  Differential Equations: A Problem Solving Approach Based on MATLAB
Linear Second Order Differential Equations with Constant Coefficients 159

Coefficients)

Example # 3.29
gt=‘6’;abc=[1,1,0];
160  Differential Equations: A Problem Solving Approach Based on MATLAB

Coefficients)
Linear Second Order Differential Equations with Constant Coefficients 161

Example # 3.30
gt=‘t*exp(2*t)*cos(2*t)’;abc=[1,0,4];
162  Differential Equations: A Problem Solving Approach Based on MATLAB

Example # 3.31
gt=‘t^2*cos(2*t)’;abc=[1,0,4];
Linear Second Order Differential Equations with Constant Coefficients 163

Coefficients)
164  Differential Equations: A Problem Solving Approach Based on MATLAB

Example # 3.32
gt=‘t’;abc=[1,1,0];
Linear Second Order Differential Equations with Constant Coefficients 165

Coefficients)

Example # 3.33
gt=‘t^2*exp(-2*t)’;abc=[1,2,0];
166  Differential Equations: A Problem Solving Approach Based on MATLAB

Coefficients)
Linear Second Order Differential Equations with Constant Coefficients 167

Example # 3.34
gt=‘t’;abc=[1,-1,-1];
168  Differential Equations: A Problem Solving Approach Based on MATLAB

Coefficients)

Example # 3.35
gt=‘t*exp(t)’;abc=[1,-3,2];
Linear Second Order Differential Equations with Constant Coefficients 169

Coefficients)
170  Differential Equations: A Problem Solving Approach Based on MATLAB

Example # 3.36
gt=‘t^2+t+2’;abc=[1,0,0];
Linear Second Order Differential Equations with Constant Coefficients 171

Coefficients)

Example # 3.37
abc=[1,3,2];; gt=‘t^2*exp(-2*t)’;
172  Differential Equations: A Problem Solving Approach Based on MATLAB

Coefficients)
Linear Second Order Differential Equations with Constant Coefficients 173

Example # 3.38
gt=‘t*exp(-2*t)’;abc=[1,4,4];
174  Differential Equations: A Problem Solving Approach Based on MATLAB

Coefficients)

Example # 3.39
gt=‘6*sin(t)’;abc=[1,0,1];
Linear Second Order Differential Equations with Constant Coefficients 175

Coefficients)
176  Differential Equations: A Problem Solving Approach Based on MATLAB

Example # 3.40
gt=‘t^2*exp(-2*t)*sin(3*t)’;abc=[1,4,13];
Linear Second Order Differential Equations with Constant Coefficients 177

Coefficients)

3.4 Summary
This chapter is devoted to the detailed study of second order differential equations
with constant coefficients. The methodology based on the roots of the characteristic
equation has been the primary focus for the determination of the solution. Unlike the
conventional pedagogic formats where other approaches for obtaining the solutions
are presented separately either in the Appendix or in other chapters, all the methods
to obtain the solutions are presented together here. These methods include breaking
the second order differential equation into a pair of coupled first order differential
equations, Laplace transforms, as well as numerical methods based on Runge-
Kutta using MATLAB. This allows the reader to compare the results from different
approaches. The results also include detailed analysis of the phase portraits which help
explain the stability of the systems modeled through these differential equations. While
homogeneous differential equations are solved through the multiple ways described
above, non-homogeneous differential equations are solved through the use of method
of variation of parameters as well as the method of undetermined coefficients in order
to obtain the particular solution. The results from these two approaches for obtaining
the particular solutions are compared and explanations are provided appropriately
in cases where the particular solutions appear different. Even in the case of the non-
homogeneous differential equations, Laplace transforms as well as ODE based methods
are employed as additional verification steps. The examples cover a substantial number
of different cases and the solution in each case is prepared to be self-contained with
appropriate theory.
178  Differential Equations: A Problem Solving Approach Based on MATLAB

3.5 Exercises
1. Examine the phase portraits for the set of second order homogeneous differential
equations with constant coefficients with [a,b,c] as a=1, b=[-2,-1,-.5,0,0.5,1,2,3],
c=[-2,-1,-.5,0,0.5,1,2,3].
2. For all the cases above, obtain the general solutions starting with the roots of the
characteristic equation and formulating the solution from the roots. Verify your
results directly using MATLAB.
[a,b,c]
[1,-4,-4]
[1,-4,-3]
[1,-4,2]
[1,-4,1]
[1,-3,-4]
[1,-3,-3]
[1,-3,0]
[1,-3,2]
[1,-3,1]
[1,-2,-4]
[1,-2,-3]
[1,-2,2]
[1,-2,1]
[1,4,-4]
[1,4,-3]
[1,4,2]
[1,4,1]
[1,5,-4]
[1,5,-3]
[1,5,0]
[1,5,2]
[1,5,1]
[1,6,-4]
[1,6,-3]
[1,6,0]
[1,6,2]
[1,6,1]
Linear Second Order Differential Equations with Constant Coefficients 179

3. For the set of differential equations with [a, b, c, y(0), y’(0)], obtain the complete
solution using (a) roots (b) Laplace transforms and (c) using Runge-Kutta methods
and verify that the results match.
[1,-4,-4,-1,1]
[1,-4,-3,-1,1]
[1,-4,0,1,-1]
[1,-4,2,1,-1]
[1,-4,1,1,-1]
[1,-3,-4,1,-1]
[1,-3,-3,1,-1]
[1,-3,0,1,-1]
[1,-3,2,1,-1]
[1,-3,1,1,-1]
[1,-2,-4,1,-1]
[1,-2,-3,1,-1]
[1,-2,2,1,-1]
[1,-2,1,-1,1]
[1,4,-4,-1,1]
[1,4,-3,-1,1]
[1,4,2,-1,1]
[1,4,1,-1,1]
[1,5,-4,-1,1]
[1,5,-3,-1,1]
[1,5,0,-1,1]
[1,5,2,-1,1]
[1,5,1,-1,1]
[1,6,-4,-1,0]
[1,6,-3,1,0]
[1,6,0,-1,0]
[1,6,2,0,-1]
[1,6,1,0,1]
4. For the following sets of differential equations identified by the coefficients a,
b, c as a row vector and the corresponding forcing functions, obtain expressions
for the particular solution obtained using the method of variation of parameters
and the method of undetermined coefficients.
A=[1,2,1]; g(t)=t exp(-t)
A=[1,2,1]; g(t)=tcos(t);
180  Differential Equations: A Problem Solving Approach Based on MATLAB

A=[1,-2,-3]; g(t)=t2exp(3t)
A=[1,4,0]; g(t)=t2+t+2
A=[1,4,4];g(t)=texp(-2t)
A=[1,0,0];g(t)=t+5;
A=[1,0,-9]; g(t)=t exp(2t)
A=[1,0,25]; g(t)=t sin(5t)
A=[1,-2,2]; g(t)=exp(t) cos(t)
A=[1,2,2]; g(t)=exp(-t)*sin(t);
5. Obtain the complete solutions for the problem in 5.5 with the initial conditions
given. Verify your results using Laplace transforms and plot the results obtained
using ode45 and the roots.
Initial conditions constitute the vector [y(0);y’(0)].
A=[1,2,1];g(t)=t exp(-t);IC=[1;-1]
A=[1,2,1];g(t)=tcos(t));IC=[1;-1]
A=[1,-2,-3]; g(t)=t2exp(3t);IC=[1;-1]
A=[1,4,0];g(t)=t2+t+2;IC=[1;-1];
A=[1,4,4];g(t)=texp(-2t);IC=[-1;1];
A=[1,0,0];g(t)=t+5;IC=[2;1];
A=[1,0,-9];g(t)=texp(2t);IC=[1,-2];
A=[1,0,25];g(t)=tsin(5t);IC=[-1,1];
A=[1,-2,2];g(t)=exp(t)cos(t);IC=[1,0]
A=[1, 2,2];g(t)=exp(-t)sin(t);IC=[1,0]

CHAPTER 4

Linear Higher Order Differential


Equations with Constant
Coefficients

4.1 Introduction 181


4.2 Homogeneous Differential Equations (n<5) 182
4.3 Non-homogeneous Differential Equations and Particular Solutions (n<5) 185
4.4 Additional Methods of Obtaining the Solution and Verification 186
4.4.1 Laplace transform 186
4.4.2 Numerical techniques 187
4.5 Higher Order Differential Equations (n>4) 188
4.6 Examples 188
4.7 Summary 233
4.8 Exercises 234

4.1 Introduction
The concept of a second order linear differential equation with constant coefficients
can be extended to higher order differential equations. A general higher order linear
differential equation with constant coefficients can be written as
An y ( n ) ( t ) + An −1 y ( n −1) ( t ) +  A0 y ( t ) =
g ( t ) . (4.1)
In eqn. (4.1), A0, A1,.., An are constants and
d n y (t )
y ( n) ( t ) = . (4.2)
dt n
When the excitation function or the external forcing function g(t)=0, eqn. (4.1)
becomes a homogeneous type and g(t) ≠ 0, eqn. (4.1) becomes a non-homogeneous
type. The solution to the differential equation (4.1) may be obtained using procedures
similar to the ones presented in connection with the second order ones as described
in Chapter 3. These include the use of the characteristic equation or the characteristic
182  Differential Equations: A Problem Solving Approach Based on MATLAB

polynomial, variation of parameters for obtaining the particular solution, Laplace


transforms and numerical ones such as the Runge-Kutta method.
One of the difficulties with the use of the roots of the characteristic equation arises
from the breadth and scope of the relationships among the various roots. For example
with n=2, roots are either real and distinct, real and equal or complex. With n=3, the roots
may be distinct, two of them may be equal or all three of them may be equal. It is also
possible that one of the roots is real while the other two form a complex pair. One can
therefore envision the various possibilities that might exist in terms of the relationships
among the roots when n exceeds 4. Because of this, the initial discussion is limited to
n<5. The cases of higher order differential equations with n>4 are treated separately.

4.2 Homogeneous Differential Equations (n<5)


The characteristic equation associated with the nth order homogeneous differential
equation is given by
An r n + An −1r n −1 +  A1r + A0 =
0 . (4.3)

Following the approach and arguments put forth in obtaining the solution for a second
order homogeneous differential equation with constant coefficients, the basis solution
vector becomes
 y1 ( t ) 
 
  y2 ( t ) 
Y ( t ) =  .  . (4.4)
 
 yn −1 ( t ) 
 y (t ) 
 n 
Note that the solution vector in eqn. (4.4) may also be written as row vector of size
[1 x n]

Y ( t ) =  y1 ( t ) y2 ( t ) . yn −1 ( t ) yn ( t )  . (4.5)

The general solution for the homogeneous differential equation becomes


n

yh ( t ) = ∑ ck yk ( t ). (4.6)
k =1

In eqn. (4.6), the coefficients ck may be obtained if initial conditions are provided
and the fundamental solution set consisting of the basic solutions, y1(t), y2(t),..,yn(t),
are formed from the roots of the characteristic equation in eqn. (4.3).
The nature of the solution set is more complicated than the three forms associated
with the case of a second order differential equation because the interrelationships
(if any) among the roots of eqn. (4.3) determine the complexity of the solution set.
Therefore, one needs to consider different values of n (2, 3, 4,..) separately to formulate
the solution set. While the solution set for n=2 is described in Chapter 3, the case of
n=3, 4 will be presented in detail now and higher order cases will be discussed in
general terms.
Linear Higher Order Differential Equations with Constant Coefficients 183

The characteristic equation associated with a 3rd order differential equation is


0 . (4.7)
A3 r 3 + A2 r 2 + A1r + A0 =
If the three roots are identified by rk, k=1,2,3, depending on whether roots are
distinct, equal or complex conjugates, the solution set may take different forms. If the
roots are distinct and real, the solution vector is

 y1 ( t )   e r1t 
  r2t 
Y= ( t )  y2 (= t )

e  , r1 ≠ r2 ≠ r3 (4.8)
 y3 ( t )   e r3t 
 
If all the roots are identical, the solution vector is

 y1 ( t )   e rt 
    rt 
Y ( t )=  y2 ( t ) =  te  , r= r1= r2= r3 . (4.9)
 y3 ( t )  t 2 e rt 
 
If the two roots are equal and real, the solution vector is

 y1 ( t )   e rt 
  r1t 
Y= ( t )  y2 =( t )  e  , r=≠ r1 r2 (4.10)
 y3 ( t )  te r1t 
 
The remaining possibility is that one root is real while the other two form a complex
conjugate pair with real valued constants α and β. The solution vector is

 y1 ( t )   e rt 
    αt 
Y ( t ) = y2 ( t )  =e cos ( β t )  , r ≠ r1,2 =α ± j β . (4.11)
 y3 ( t )   eα t sin ( β t ) 
 
The nature of the roots can now be expanded to provide the solution set for
differential equations of order 4. We identify the four roots as rk, k=1, 2, 3, 4. If all
roots are real and distinct, the solution vector is
 y1 ( t )   e r1t 
   
 = y2 ( t )  e r2t 
= Y ( t )  y3 ( t )   e r3t  . (4.12)
   rt
 y4 ( t )  e 4 
When all four roots are real and equal, the solution vector becomes
 y1 ( t )   e rt 
   rt 
  y2 ( t )   te= , r r
Y (t ) =
= (4.13)
 y3 ( t )  t 2 e rt  1,2,3,4

   3 rt 
 y4 ( t )  t e 
It is possible to proceed similarly when two of the roots are equal in pairs or one
is distinct and three are equal. The other cases will be when two are distinct and the
184  Differential Equations: A Problem Solving Approach Based on MATLAB

other two form a complex pair, and when two real roots are equal and the other pair
is complex. The final case will correspond to the case of two pairs of equal complex
conjugate sets.
 y1 ( t )   e r1t 
   rt 
 y2 ( t )   e =
Y ( t ) =
= , r ; r r (4.14)
 y3 ( t )   te rt  1 2,3,4

   2 rt 
 y4 ( t )  t e 
 y1 ( t )   e r1t 
   r2t 
  y2 ( t )  e  , r =
Y (t ) =
= , r ; r r (4.15)
 y3 ( t )   e rt  1 2 3,4

   rt 
 y4 ( t )  te 
 y1 ( t )   e r1t 
   r1t 
 y ( t )  te =
Y ( t )  2=
=  , r r=
, r r ,r (4.16)
 y3 ( t )   e r3t  1 1,2 3 3 4
   r3t 
 y4 ( t )  te 

 y1 ( t )   e r1t 
   
 y ()t e r2 t

Y ( t )=  2 =  α t
(4.17)  , real r , r and r = α ± j β
 y3 ( t )  e cos ( β t )  1 2 3,4

   αt 
 y4 ( t )   e sin ( β t ) 

 y1 ( t )   e rt 
   
 y (t )  te rt
 , real r= r and
Y ( t )=  2 = r3,4= α ± j β (4.18)
 y3 ( t )  eα t cos ( β t )  1,2

   αt 
 y4 ( t )   e sin ( β t ) 
 y1 ( t )   eα t cos ( β t ) 
   αt 
 y (t )  e sin ( β t )  , r = r = α ± j β
Y ( t )=  2 = (4.19a)
 y3 ( t )  teα t cos ( β t )  1,2 3,4
   αt 
 y4 ( t )   te sin ( β t ) 
 y1 ( t )   eα1t cos ( β1t ) 
   

 y2 ( t )   eα1t sin ( β1t ) 
Y (t ) = = α1 ± j β1 , r3,4 =
,r = α 2 ± j β 2 (4.19b)
 y3 ( t )  eα 2t cos ( β 2 t )  1,2
   α2t 
 y4 ( t )   e sin ( β 2 t ) 
It can easily be seen that as the order of the differential equation increases, the
possible grouping of the basic solutions becomes more diverse making it difficult to
form a solution. A general approach can be stated as follows:
Linear Higher Order Differential Equations with Constant Coefficients 185

If the multiplicity of the roots is m (m<n, m roots are equal to r) and if the roots
are real, the solutions can be expressed as

e rt , te rt , t 2 e rt , , t m −1e rt . (4.20)
The remaining roots, (n-m) will be distinct, each with a unique solution. When n>3,
possibilities exist that conjugate complex pair of roots might also display multiplicity.
The multiplicity of m results in 2m solutions as

eα t cos ( β t ) , teα t cos ( β t ) , t 2 eα t cos ( β t ) , , t m −1eα t cos ( β t )


(4.21)
eα t sin ( β t ) , teα t sin ( β t ) , t 2 eα t sin ( β t ) , , t m −1eα t sin ( β t ) .
The remaining (n-2m) might be distinct in which case, there will be distinct
solutions. If multiplicities exist among (n-2m) real roots, the solutions will follow
the format in eqn. (4.20).
For reasons mentioned above, solutions for higher order differential equations with
n>4 may be obtained easily using a method based on Laplace transforms discussed
below and verified using the Runge-Kutta method.

4.3 Non-homogeneous Differential Equations and Particular


Solutions (n<5)
Just as it was done for the case of second order non-homogeneous equations of constant
coefficients, the solution can now be expressed as
n
y ( t ) = yh ( t ) + y p ( t ) = ∑ ck yk ( t ) + y p ( t ) . (4.22)
k =1

The particular solution resulting from the excitation force represented by g(t) in
eqn. (4.1) is represented by yp(t).
While the particular solution may be obtained using the method of undetermined
coefficients as it was done for the case of second order systems, the process of obtaining
the solution is simplified and more formal through the use of the method of variation
of parameters. This approach requires the use of the Wronskian associated with the
nth order differential equation. Proceeding similarly as in the case of a second order
differential equation, the Wronskian W becomes
 y1 y2 . . yn 
 (1) (1) 1 
 y1 y 2 . . yn( ) 
W = . . . . .  . (4.23)
 
 . . . . . 
 ( n −1) n −1 
y2(
n −1)
 y1 . . yn( ) 
The particular solution yp(t) is given by

y p ( t ) =  y1 ( t ) y1 ( t )  yn ( t )  ∫ v ( t )dt . (4.24)

In eqn. (4.24),
186  Differential Equations: A Problem Solving Approach Based on MATLAB

 0 
 0 
 
  . 
v ( t ) = W −1   . (4.25)
 . 
 g (t ) 
 
 An 
In eqn. (4.25), W–1 is the inverse of the Wronskian and the matrix on the right
hand side is of size [n x 1] with the first (n-1) elements being zeros. If initial conditions
IC are given, the unknown coefficients c1, c2, .., cn in eqn. (4.22) can be determined,

=
y ( 0 ) y (1) ( 0 )  y ( n −1) ( 0 ) 
IC = [ y0 y1  yn −1 ] . (4.26)

Once the unknown coefficients are evaluated, the complete solution of the
differential equation in eqn. (4.1) can be obtained.

4.4 Additional Methods of Obtaining the Solution and


Verification
Two methods can be implemented to obtain the solution to the higher order differential
equation. The first one is the method based on the Laplace transform and the other
is the use of numerical techniques. The numerical techniques use ODE solvers in
MATLAB® and this requires that the higher order differential equation be broken
down into a set of n-first order differential equations. Details of both techniques are
provided in the Appendix.

4.4.1 Laplace transform
As shown in Appendix B, the Laplace transform based approach is a simple and
direct way of obtaining the solution to a set of differential equations or a higher order
differential equation. The solution is obtained only when initial conditions are available.
Taking the Laplace transform of the differential equation in eqn. (4.1), it is
possible to write

y0  An s n −1 + An −1 s n − 2 +  + A1  + y1  An s n − 2 + An −1 s n − 3 +  + A2  +  + yn −1 An
A( s) =
An s n + An −1 s n −1 +  + A1 s + A0
(4.27)

G (s)
B (s) = . (4.28)
An s + An −1 s n −1 +  + A1 s + A0
n

In eqn. (4.28) G(s) is the Laplace transform of g(t). If Y(s) is the Laplace transform
of the solution y(t),
( s ) A ( s ) + B ( s ). (4.29)
Y=
Linear Higher Order Differential Equations with Constant Coefficients 187

The solution y(t) is obtained by taking the inverse Laplace transform of eqn. (4.29).

4.4.2 Numerical techniques
If the initial conditions are available, it is also possible to obtain the solution
numerically using the Runge-Kutta method described in Appendix A. The first step
in the solution is the creation of n-first order differential equations. We define
Z1 = y ( t )
Z2 = y( ) (t )
1

Z3 = y(
2)
(t ) (4.30)

Zn = y(
n −1)
(t )
Using eqn. (4.30), it is possible to write n-first order equations as

Z1(1) = Z 2
Z 2(1) = Z 3
Z 3(1) = Z 4
 (4.31)
(1)
Z n −1 = Z n
An −1 A A A g (t )
Z n(1) =− Z n − n − 2 Z n −1 −  − 1 Z 2 − 0 Z1 +
An An An An An
Equation (4.31) can be expressed in matrix form as

 Z1(1)   0 1 0  0 0   0 
 Z1  
 (1)   0 0 1  0 0  
  0 
 Z2   Z2 
 (1)   0 0 0  0 0   0 
 Z3    Z3  
 
=  . . . ... . .   +    (4.32)
   
   0 0 0  0 1    0 
 Z n(1−)1     Z n −1   
 − A0 A1 A2 A A    g (t ) 
 (1) 
 A − −  − n−2 − n −1   Z n   
 Z n   n An An An An   An 
Equation (4.32) can be simplified by defining the following:
A A A
an −1 =
− n −1 , an − 2 =
− 2 −1 , , a0 =
− 0 (4.33)
An An An

g (t )
h (t ) = (4.34)
An
188  Differential Equations: A Problem Solving Approach Based on MATLAB

 Z1(1) 
 (1) 
 Z2 
 (1) 
 Z
Z' =  3  (4.35)
  
 
 Z n(1−)1 
 (1) 
 Z n 
 0 1 0  0 0 
 0 0 1 0  0 0 
0 1  0 0  
 0 0 1  0 0 
 0 0 0  0 0  
  0 0 0  0 0 
A = . . . ... . .   

 0 0 0  0 1   
  0 0 0  0 1 
 A0 A1 A2 An − 2 A  
− A − A − A  − A − n −1   a0 a1 a2  an − 2 an −1 
 n n n n An 
(4.36)

 0 
 0 
 
  0 
b (t ) =  
   (4.37)
 0 
 
 h ( t ) 
The higher order differential equations can now be written in the form of a matrix
equation as
  
Z ' ( t ) AZ ( t ) + b ( t ).
= (4.38)

It should be noted that numerical evaluation of the solution requires the availability
of the initial conditions given in eqn. (4.26).

4.5 Higher Order Differential Equations (n>4)


Because of the possible existence of varied relationships among the roots when n>4,
solutions are obtained easily using Laplace transforms as shown in Section 4.4.1.
Results can be verified using the numerical techniques described in Section 4.4.2.

4.6 Examples
Example # 4.1 Consider a 3rd order differential equation,
y ''' ( t ) + y ' ( t ) =
4 + sin ( t ). (4.39)
Linear Higher Order Differential Equations with Constant Coefficients 189

The initial conditions are


y (0) = 0
y ' (0) = 1 . (4.40)
y '' ( 0 ) = −1
The characteristic equation associated with the differential eqn. (4.39) is
r3 + r =0. (4.41)

The roots of the characteristic equation are (one real and a pair of complex ones)
0
− j . (4.42)
j
The solution set associated with the homogeneous differential equation is
y1 ( t ) = t
y2 ( t ) = cos ( t ) . (4.43)
y3 ( t ) = sin ( t )
The solution to the homogeneous differential equation is
yh ( t ) =
b1 y1 ( t ) + b2 y2 ( t ) + b3 y3 ( t ) =
b1t + b2 cos ( t ) + b3 sin ( t ) . (4.44)
Using the solution set in eqn. (4.43), the Wronskian W in eqn. (4.23) becomes

1 cos ( t ) sin ( t ) 
 
=W 0 − sin ( t ) cos ( t )  . (4.45)
0 − cos ( t ) − sin ( t ) 

The vector v ( t ) in eqn. (4.25) is
 sin ( t ) + 4 
  
v (t ) = − cos ( t ) sin ( t ) + 4   . (4.46)
 
 − sin ( t ) sin ( t ) + 4  
The particular solution can be obtained using eqn. (4.24) and is
t
y p (t ) =
4t − cos ( t ) − sin ( t ). (4.47)
2
The complete solution is
t
y ( t ) = yh ( t ) + y p ( t ) = b1t + b2 cos ( t ) + b3 sin ( t ) + 4t − cos ( t ) − sin ( t ). (4.48)
2
Applying the initial conditions in eqn. (4.40) to the solution in eqn. (4.48), the
constants b1, b2, b3 are obtained as
190  Differential Equations: A Problem Solving Approach Based on MATLAB

b1 = 0 b2 = 1 b3 = −3 . (4.49)

Substituting the values of the constants in eqn. (4.48), the solution to the 3rd order
differential equation in eqn. (4.39) becomes
t
y (t ) =
4t − 3sin ( t ) − sin ( t ) . (4.50)
2
The Laplace transform of the solution can be obtained using eqn. (4.29) as
s 4 − s 3 + 5s 2 + 4
Y (s) = . (4.51)
(s + s)
3 2

Taking inverse Laplace transforms, eqn. (4.51) leads to a solution matching the one
in eqn. (4.50).
Example # 4.2 Consider another 3rd order differential equation,
y ''' ( t ) − y '' ( t ) − y ' ( t ) + y ( t ) =
t 2 + t . (4.52)

The initial conditions are


y ( 0 ) = −1
y ' (0) = 0 . (4.53)
y '' ( 0 ) = 0
The characteristic equation associated with the differential eqn. (4.39) is
r3 − r2 − r +1 =0. (4.54)
The roots of the characteristic equation are
−1
1 . (4.55)
1
The roots are not distinct, with one set being equal to unity while the other is
equal to –1 leading to the set associated with the homogeneous differential equation as
y1 ( t ) = e − t
y2 ( t ) = e t . (4.56)
y3 ( t ) = te t

The solution to the homogeneous differential equation is


yh ( t ) = b1 y1 ( t ) + b2 y2 ( t ) + b3 y3 ( t ) = b1e − t + b2 et + b3tet . (4.57)

Using the solution set in eqn. (4.56), the Wronskian W in eqn. (4.23) becomes
 e − t et tet 
 −t 
W=
 −e e e ( t + 1)  .
t t (4.58)
 e − t et et ( t + 2 ) 
 
Linear Higher Order Differential Equations with Constant Coefficients 191


The vector v ( t ) in eqn. (4.25) is
 t t 
 e ( t + 1) 
4
 
  − t e − t ( t + 1)( 2t + 1)  .
v (t ) = (4.59)
 4 
 
 t 
e − t ( t + 1)
 2 
The particular solution can be obtained using eqn. (4.24) and is

y p ( t ) = t 2 + 3t + 5 . (4.60)

The complete solution is


y ( t )= yh ( t ) + y p ( t )= b1e − t + b2 et + b3tet + t 2 + 3t + 5 . (4.61)

Applying the initial conditions in eqn. (4.53) to the solution in eqn. (4.61), the
constants b1, b2, b3 are obtained as
1 11
b1 = − b2 = − b3 = 2. (4.62)
2 2
Substituting the values of the constants in eqn. (4.62), the solution to the 3rd order
differential equation in eqn. (4.61) becomes
1 11
y ( t ) = 3t − e − t − et + 2tet + t 2 + 5 . (4.63)
2 2
The Laplace transform of the solution can be obtained using eqn. (4.29) as
−s5 + s 4 + s3 + s + 2
Y (s) = . (4.64)
s 3 ( s − 1) ( s + 1)
2

Taking inverse Laplace transform, eqn. (4.64) leads to a solution matching the one
in eqn. (4.63).
Example # 4.3 Consider a 4th order differential equation,
y '''' ( t ) − y ( t ) =et + e − t . (4.65)
The initial conditions are
y (0) = 1
y ' (0) = 1
. (4.66)
y '' ( 0 ) = −1
y ''' ( 0 ) = −1
The characteristic equation associated with the differential eqn. (4.65) is
r 4 −1 =0 . (4.67)

The roots of the characteristic equation are


192  Differential Equations: A Problem Solving Approach Based on MATLAB

−1
1

− j . (4.68)
j
The solution set associated with the homogeneous differential equation is
y1 ( t ) = e − t
y2 ( t ) = e t
. (4.69)
y3 ( t ) = cos ( t )
y4 ( t ) = − sin ( t )
Note that use of –sin(t) or sin(t) in eqn. (4.69) will not change the result. The solution
to the homogeneous differential equation is

yh ( t ) = b1 y1 ( t ) + b2 y2 ( t ) + b3 y3 ( t ) + b4 y4 ( t ) = b1e − t + b2 et + b3 cos ( t ) − b4 sin ( t ) .


(4.70)
Using the solution set in eqn. (4.69), the Wronskian W in eqn. (4.23) becomes
 e−t et cos ( t ) − sin ( t ) 
 −t 
−e et − sin ( t ) − cos ( t ) 
W =  −t . (4.71)
e et − cos ( t ) sin ( t ) 
 −t 
 −e et sin ( t ) cos ( t ) 

The vector v ( t ) in eqn. (4.25) is
 1 
 − 4 (1 + e ) 
2t

 
 1 1 + e 2t


v (t ) = 
4
( )  . (4.72)
 
 sin ( t ) cosh ( t ) 
cos ( t ) cosh ( t ) 

The particular solution can be obtained using eqn. (4.24) and it is


1
− ( 2t + 3e 2t − 2te 2t + 3).
y p (t ) = (4.73)
8
The complete solution is
1
( 2t + 3e 2t − 2te 2t + 3) . (4.74)
y ( t ) = b1e − t + b2 et + b3 cos ( t ) − b4 sin ( t ) −
8
Applying the initial conditions in eqn. (4.66) to the solution in eqn. (4.74) the constants
b1, b2, b3, b4 are obtained as
Linear Higher Order Differential Equations with Constant Coefficients 193

1 1 3
b1 = b2 = b3 = b4 = −1 . (4.75)
8 8 2
Substituting the values of the constants in eqn. (4.74), the solution to the 4th order
differential equation in eqn. (4.65) becomes
3 1 1
y ( t )=cos ( t ) + sin ( t ) − cosh ( t ) + t sinh ( t ). (4.76)
2 2 2
The Laplace transform of the solution can be obtained using eqn. (4.29) as
s 5 + s 4 − 2 s 3 − 2 s 2 + 3s + 1
Y (s) = . (4.77)
(s 2
− 1)( s 4 − 1)
Taking the inverse Laplace transform, eqn. (4.77) leads to a solution matching the
one in eqn. (4.76).
Example # 4.4 Consider another 4th order differential equation,
y '''' ( t ) + y ' ( t ) =te − t + 4 . (4.78)

The initial conditions are


y ( 0 ) = −1
y ' (0) = 0
. (4.79)
y '' ( 0 ) = 0
y ''' ( 0 ) = 1
The characteristic equation associated with the differential eqn. (4.78) is
r4 + r =0. (4.80)
The roots of the characteristic equation are
0
−1
1− j 3
. (4.81)
2
1+ j 3
2
The solution set associated with the homogeneous differential equation is
y1 ( t ) = 1
y2 ( t ) = e − t
t
 3 
y3 ( t ) = e 2 cos  t  . (4.82)
 2 
t
 3 
y4 ( t ) = −e 2 sin  t 
 2 
194  Differential Equations: A Problem Solving Approach Based on MATLAB

The solution to the homogeneous differential equation is


t
 3  t
 3 
yh ( t ) =
b1 y1 ( t ) + b2 y2 ( t ) + b3 y3 ( t ) + b4 y4 ( t ) =+
b1 b2 e − t + b3 e 2 cos  t  − b4 e 2 sin  t .
 2   2 
(4.83)
Using the solution set in eqn. (4.82), the Wronskian W in eqn. (4.23) becomes
 −t
t
 3  t
 3  
1 e e 2 cos  t  −e 2 sin  t  
  2   2  
 
 0 −e − t
t
π 3  t
π 3 
 e 2 cos  + t  −e sin  +
2
t  
3 2   3 2 .
W = (4.84)
 t
π 3  t
π 3 
0 e−t −e 2 sin  + t  −e 2 cos  + t  
 6 2   6 2 
 
 −t
t
 3  t
 3  
 0 −e −e 2 cos  t  e sin  t  
2

  2   2  

The vector v ( t ) in eqn. (4.25) is
 4 + te − t 
 
1
 − ( t + 4et ) 
 3 
  
v ( t ) =  − 2 e − 2 t cos  3 t  t + 4et  .
1

 3   ( ) (4.85)
  2  
 2 −1t  3  
 e 2 sin 
 t  ( t + 4et ) 
 3  2  
The particular solution can be obtained using eqn. (4.24) and is
e−t
− (12t − 72te 2t + 3t 2 + 16 ) .
y p (t ) = (4.86)
18
The complete solution is
t
 3  t
 3  e−t
y ( t ) =b1 + b2 e − t + b3 e 2 cos 
2
t  − b4 e 2 sin 
2
t  −
18
(12t − 72te2t + 3t 2 + 16 ) .
   
(4.87)
Applying the initial conditions in eqn. (4.79) to the solution in eqn. (4.87), the constants
b1, b2, b3, b4 are obtained as

19 13 3
b1 =1 b2 = 1 b3 = − b4 =. (4.88)
9 9
Substituting the values of the constants in eqn. (4.88), the solution to the 4th order
differential equation in eqn. (4.87) becomes
Linear Higher Order Differential Equations with Constant Coefficients 195

1 2 1 19 t  3  13 3 2t  3 
y ( t ) =1 + 4t + e − t − te − t − t 2 e − t − e 2 cos  t  − e sin  t  . (4.89)
9 3 6 9  2  9  2 
The Laplace transform of the solution can be obtained using eqn. (4.29) as
2
4 3  1 
−s + 
s 1+ s 
Y (s) = . (4.90)
s ( s 3 + 1)

Taking the inverse Laplace transform, eqn. (4.90) leads to a solution matching
the one in eqn. (4.89).
When analytical approaches based on the roots of the characteristic equation
become cumbersome (as the order of the differential equation increases), the convenient
option is to rely on the Laplace transform based approach. In all cases, additional
verification is possible using numerical techniques based on Runge-Kutta methods
as described in Appendix A and in Section 4.4.2. The MATLAB script for the case of
a 3rd order differential equation and results are given first.
Example # 4.5 Consider the case of the following 3rd order differential equation,

y ''' ( t ) + y '' ( t ) − 2 y ' ( t ) =


t + et , y ( 0) =
1, y ' ( 0 ) =
1, y '' ( 0 ) =
−1 . (4.91)

The MATLAB script created for solving the differential equation and the results are
shown.
function higherorder_numerical_example
% june 2017 solution of a higher order differential equation using Laplace transform
% and verification using Runge-Kutta method P M Shankar
% y’’’(t)+y’’(t)-2y’(t)=t+exp(t), y(0)=1, y’(0)=1,y’’(0)=-1
syms t s
A3=1;A2=1;A1=-2;A0=0;
y0=1;y1=1;y2=-1; % initial conditions
gt=t+exp(t); % forcing functions
Dr=(A3*s^3+A2*s^2+A1*s+A0); % Denominator of the Laplace transform
As=(y0*(A3*s*s+A2*s+A1)+A3*y2+y1*(A2+A3*s))/Dr;
Bs=laplace(gt,t,s)/Dr; % Laplace transform of the forcing function
yL=ilaplace(As+Bs,s,t); % inverse Laplace transform to get the solution
simplify(yL,’steps’,100); % analytical solution using Laplace
fy=MATLABFunction(yL);
syms z(t) % use z as a placement or dummay variable
D3=diff(z,3);
D2=diff(z,2);
D1=diff(z,1);
f=[A3*D3+A2*D2+A1*D1+A0*z==t+exp(t)];
V = odeToVectorField(f);% break higher order DE into 3 first order ones
F = MATLABFunction(V,‘vars’, {‘t’,‘Y’});% create inline Function for ODE
tspan=[0 5];
[T,yode]=ode45(F,tspan,[1;1;-1]);
% numerical solution; only use the first column of the solution yode
196  Differential Equations: A Problem Solving Approach Based on MATLAB

figure,plot(T,fy(T),‘r-’,T,yode(:,1),’k*’)
xlabel(‘time t’),ylabel(‘solution’)
legend(‘analyt’,‘numerical’)
syms y(t)
yy=[y(t)==yL]; % create the expression for the title
title([‘$’ latex(yy) ‘$’],‘interpreter’,‘latex’,‘fontsize’,14,‘color’,‘b’)

end

Figure 4.1  Plot of the solution y(t) for the Example # 4.5.

The approach based on combining Laplace transform and Runge-Kutta methods


can also be used to solve differential equations in orders higher than the 4th. As the
order increases, the increasing number of roots leads to difficulties in forming the
solutions set for the corresponding homogeneous differential equation. The Laplace
transform offers a simple means to obtain an analytical expression for the solution
and the verification of the solution can be accomplished through the use of the Runge-
Kutta method implemented in MATLAB.
Example # 4.6 Consider a 5th order differential equation
y ''''' ( t ) + y ''' ( t ) + y '' ( t ) + y ( t ) = et , y ( 0 ) = 1, y ' ( 0 ) = y '' ( 0 ) = y ''' ( 0 ) = 0, y '''' ( 0 ) = 1
(4.92)
The characteristic equation associated with differential equation is
r5 + r3 + r2 + r =0. (4.93)
Linear Higher Order Differential Equations with Constant Coefficients 197

The roots of the characteristic equation are


−1
−j
j
1 . (4.94)
2
1− j 3 ( )
1
2
1+ j 3 ( )
As suggested, the simpler way to obtain the analytical solution is to use the Laplace
transform based approach. Taking the Laplace transform of the differential equation
in eqn. (4.92), the expression for the Laplace transform of the solution becomes
s3
. Y (s) = (4.95)
s4 −1
Taking the inverse Laplace transform of eqn. (4.95), the solution to the differential
equation becomes
cos ( t ) + cosh ( t )
y (t ) =
. (4.96)
2
The results of verifying the solution are shown in Figure 4.2.
Example # 4.7 Consider the case of a 6th order differential equation,
y '''''' ( t ) + y ''''' ( t ) =te − t , y ( 0 ) =1, y ' ( 0 ) = y '' ( 0 ) = y ''' ( 0 ) = 0, y '''' ( 0 ) =1, y ''''' ( 0 ) = 0 .
(4.97)
The characteristic equation and its roots are
0 . (4.98)
r6 + r5 =

0
0
0
. (4.99)
0
0
−1
Taking the Laplace transform of the differential equation in eqn. (4.97), the Laplace
transform of the solution is
1
s+ + s 4 + s5 + 1
( s + 1)
2

Y (s) = . (4.100)
s 5 ( s + 1)
Taking the inverse Laplace transform of eqn. (4.100) leads to the solution
198  Differential Equations: A Problem Solving Approach Based on MATLAB

Figure 4.2  Plot of the solution y(t) for the Example # 4.6.

t3 t4 1
y ( t ) = 16 − 10t + 3t 2 − + − 15e − t − 5te − t − t 2 e − t . (4.101)
2 12 2
The verification is provided in Figure 4.3.
Example 4.8 Consider the case of a 7th order differential equation

y ''''''' ( t ) − y ''''' ( t ) + y '''' ( t ) − y '' ( t ) =


t,
. (4.102)
y ( 0 ) 1, y=
= ' ( 0 ) y=
'' ( 0 ) y=
''' ( 0 ) y =
'''' ( 0 ) y '''''
= ( 0 ) 0, y ''''''
= ( 0) 1
The characteristic equation and the roots of the characteristic equation are
0 . (4.103)
r7 − r5 + r4 − r2 =

0
0
−1
−1
1 . (4.104)
1
2
(
1− j 3 )
1
2
(
1+ j 3 )
Linear Higher Order Differential Equations with Constant Coefficients 199

Figure 4.3  Plot of the solution y(t) for the Example # 4.7.

Taking the Laplace transform of the differential equation in eqn. (4.102), the Laplace
transform of the solution is
s8 − s 6 + s 5 − s 3 + s 2 + 1
Y (s) = . (4.105)
s 4 ( s − 1)( s + 1) ( s 2 − s + 1)
2

Taking the inverse transform of eqn. (4.105), the solution to the differential equation
becomes

1 3 1 1 2 3 2t  3 
y ( t ) =2 − 2t + et − e − t − te − t − t 3 + e sin  t  . (4.106)
2 2 3 6 6  2 
The verification is given in Figure 4.4.
In keeping up with the theme of this manuscript, theoretical aspects are provided
with every example given. Of specific mention is the fact that explicit values of the
fundamental solution set based on the roots are provided for every example, for all
types of relationships among the roots as mentioned in Section 4.4.2.
The MATLAB script generates the following displays.
1. Based on the vector A representing the coefficients, a determination is made
regarding the order of the differential equation and the general form of the
equation, the characteristic equation, roots and the form of the general solution
is provided. While the form of the general solution is simple for order 2, with
order 3 and order 4, more possibilities exist for the general solution based on the
relationships among the roots of the characteristic function. All these possibilities
are automatically shown.
200  Differential Equations: A Problem Solving Approach Based on MATLAB

2. The roots of the characteristic equation and the set of solutions forming the
solution to the homogeneous differential equation are shown next.
3. The method of variation of parameters used to obtain the particular solution is
shown.
4. The particular solution is then obtained, tested by substitution in the differential
equation and the validation is shown.
5. The general solution incorporating the particular one is shown and the analysis
ends if initial conditions are not provided.
6. If the initial conditions are provided, the applicable theory for the specific highest
order is shown.
7. The Laplace transform of the solution y(t) is shown along with the solution to
the differential equation.
8. The solution is then verified by applying the initial conditions to the general
solution obtained using the roots displaying the values of the unknown constants
as well as the complete solution obtained from the roots.
9. The solution obtained using dsolve(.) is also shown for the sake of completeness.
10. The numerical computational approach is shown next with the decomposition
of the higher order into several first order differential equations.
11. The plots of the solutions obtained using various methods are shown as in the
final display.

Figure 4.4  Plot of the solution y(t) for the Example # 4.8.
Linear Higher Order Differential Equations with Constant Coefficients 201

Example # 4.9
A=[1 0 1 0];IC=[0,1,-1];gt=‘cos(t)+sin(t)’;

Characteristic
202  Differential Equations: A Problem Solving Approach Based on MATLAB

hrtk:ular SoIwlon ualng the MIothocl of Vatl.llon 01 P.,..melll,.


~F_ g(1) .. mo(l ) .......(I )

IV ..
,,(1) lI:(t ) 1/1(1)
,,(t ) ';(1) ";(1)
1
[ ,:'{t ) 1Il'(1) 1&'(1)

U( I) _ (lvr ' [ ~ ] , A, if the coc/Iicic"t of v"(I)


~I) .. "' (1) ,, (1),,(11] / ;1(1) <11

I'wticlMLr SoIuton ..... v._ fit I'..... ~ ..

lI,o(') =~-~-~-~
,.. tt.-,."' ...._ .. O••• ral EON
DeAl.. ofWron~n

( I ooo(t) ""'t) )
-""
w_ ( 0 - sin(t) ,,,,t) )
( 0 - cm(t ) - sin(t ) )

v'2 sin (t + i)
J2";U+!) _!
I{I ) ..

Linear Higher Order Differential Equations with Constant Coefficients 203

Inwors. LapiKe bII ud solution : TlIeory end R.. ults


0iIf........ equation _Ini ... eo_,.{Ge,.,..1 C_l
~lr(t) + A. v"(I) + Al 11'(1) + Ao 11- g(l )
111(0) -lIJ,V(O) -IIJ,v"(O) - /Ill
V(sl-Al sl-B(I)

";':·~~1I~(t) = =(t) ~~-----


( y(O) '" 0 11'(0) .. I 11"(0) '" - I )
~Ieao Trans/aM V{I) ol)l(Q

YL (S) '" r.;H;


SoIoA.'on )'(I) ..Ing ..... 1'9!1 Laplaoe

Y (t) --~-~-~
2 2 2

Complete Solution end Verrdlttlon


SolutIon kJ I,. Homog_ pert lMrng roots (unknown oono"" • . b, .b;z .•. l
Yh(t) - b, !It(t) + b:t Io\!(t) + III ¥J{t)
eo",,1eto sWI.Ion )'(Il-v,,(tMp(t)
y( t) _ h~<! _ ~ _ !.!j!ll + b, y,{t) + ~ ~(t ) + ~¥J(t) _ ~
0bIairI .... '-~ oon..... (b, b;z 11,) by applying I" initial <XItIdilions
(b,b;zll,) " (0 i 1)
Cl",,1eIt sWI.Ion using '00lS (replece unknown oono ...... )

y( t)=~-~-~
Cl",,1eIt sWI.Ion using ...... ~.ce ,.... rorm.

y(t)_~_~_~

Cl",,1eIt sWI.Ion using deotve(_) In Malab


y(t)_~_~_~
204  Differential Equations: A Problem Solving Approach Based on MATLAB

Example # 4.10
A=[1 -1 -1 1];IC=[-1,0,1 ];gt=‘exp(t)-t*exp(-t)’;

Characteristic
Linear Higher Order Differential Equations with Constant Coefficients 205

Partleu"r and complete eolullon e


Higher order dlfferenl .. 1equatione
DifI__ ,", Equation and 1" - CtwdIi> ....
y*'(t ) - y"(t) -1I(t) + y(t ) = It - t e- '
(U(O) _ _ l V(O)- O V'(O)_ l )
cr.~ _ ", "'I"",;,n: "' - r" - r + l ", 0
_ oIlht ChI..,.;..", """'.... Homog......,.,. ""'-'..... ""
Yl (t )= e-'

Yl (t )= 1t

Y3(t ) = t el

Roots "' r, r("""" I), andp


u( I) - e' ,u(t) '" I.e'"
u( t) _.r
Partk ...... Solution .... Ini 1"- Method of Variation 01 Pa...... I. ..
FaaroFooctc>n g(IJ_tl _ l e-'

WRONSKIAN IV _
~,(I)
,,(t )
r,o,(l) VI( I)
,,(1) i.(I)
1
[ !I.'(I) ~( t) ~(t)

ii(1) _ lilT ' [ ~ ] , A. .. the coofficj""t 0111"(1)

lI~t) - II/l(t) I/>(t ) VI(I )] J i1(t ) dt

PllliaAa. Sclullon .. Ing V.1IMion 01 P ... .... Ilf1


,-'(" - 20"+<1""- " '0" +'''+3)
Y, (t ) =- 16
T. 11ho ... ~ bo/ .ubafUlon ... DiII_..;"1EON

VALnPASS
206  Differential Equations: A Problem Solving Approach Based on MATLAB

--
w_
(e~'

(-e-'
f!

( e-' f! el (t + 2»
eI
tel)
f! (t+ 1»

ill') ..
(2 '+1) (.e-"_I)
,
,- ..,...
I .. - ••

Inw ,u Laplac. baNd lIOIution : Th.ory a nd R.. uits


0i~1.III Equal"",...,. IrWioI Caridi!;'"" (Ge"",,' CMe)
~V·(I) + A2lf(t) + A , 1/'(1) + Ao It' - g(l)
w(O) - II",iI'(O) - V" V'(O) - Vll
Y(I)oI\(I»B(I)

0011..... 1.11 EqUlllOon..-oj I..... Cooditi>nl (;"""l


y"'(t) - 1I'(t) - yet) + yet) = f! - te- '
( v{O) - - 1 rI(O) _ 0 ,"(0) _ 1 )
lap"'" T",noIorm V(I) 01)'(1)
~ ( ) _ '(-"i4"+3.-2)
L II - (0'_ 1)'
ScIutiCIn )'(I) ..1og __ ooe lIIp1aoo
.-<
(41+1 Ie" - 10, ."-4" e" +21'+5)
yet) = 16
Linear Higher Order Differential Equations with Constant Coefficients 207

Compl~ Solution and Vaildlotlon


SoUion II the , ... , _ _ ,., ..... _ (\I~ ..... WlII. b, . ~ ._. )

,.(I) _ b, ... (1) + ~ lII (t) + Ib n{l )


~ . . . . . )'(I,"".(I",.~)
,(1) _ b, ",{I) - • '(" - ' .. ' .. ';: .......'.' .. ~) + .. ,.{I)+ """, (I)
0tUin"""'-' .... -~1 ~'=\) 111'.~ ... - -
-I I )
OJ ' " •
0001;'. ocrUb> ..... _( - I ,"","","u _ _ II)

." ) • '(... "... _It, ..'_.,·.... ,....)


~I -- II
~ocrUb>""'_~_

ODEU I nd compa olaon


DtI..... 'NiI EqF,lllllon II'1I:I ,.... ConcIiIb..
1I'(t) - 1I'(t) - 1I'(t ) + lI{t ) - ,; - t e- I
( 11(0) - - I f lO) _ 0 f'(O ) _ 1 )
eor..~lr.o ..... dlf_nilll*IU.b.. "" CXlE (Y, • )(1)1_

Yilt )) -_ 11
Yj(t Yo )
( Y;(I) _" - 11-' - y, + Yo + Yo
208  Differential Equations: A Problem Solving Approach Based on MATLAB

Example # 4.11
A=[1 0 0 0 -1];IC=[1,-1,0,-1 ];gt=‘t+cos(t)’;

Characteristic
Linear Higher Order Differential Equations with Constant Coefficients 209

,..rtk:...... Solution ... , Ing'''' ~thod ofV",rhltlon of P . ......., . ...


Fac:ircl Funcion g(l) - 1+<:<1«(1)

WRONSKloO.N IV _
VI(I) volt)
,,(1) ~(I)
V3(t)
v.,(I)
V.(I)
!I.(I)
1
[ v'I'(l) ~(t) ~(t) ~
v:"(I) V{(I) IIT(I) ,r.

",)-(wr' [ll,"'' ' ' ,,-_of'-'''


f
P-.I<:Uar Sdu*>n """'" v._
v,(I) - WI(I)VO(I)VO(Il¥.(I)]

y, (t)=-t -~-~
of P... "",Il ..
J(t)dI

f ••• fIo "DIy..,. ._t1"'im "' 0 _ _ •EDN


V.oLtDlPA.$S

0.1811, of Wron aldan


(e-' f! C06(t) -sin(t»)
~-­
w. ( - e- ' f! -sin(t) -cos{t»)
(e-' f! - oos(t) sin(t»)
( - e- ' f! sin(t) oos(t»)

fl t) ...
.,. ...
( ..".))

,
';0(1) ('+<0(2)

,
<0>0(,) ("' <0>0('))
210  Differential Equations: A Problem Solving Approach Based on MATLAB

A. V-(I) + ~J("'(I) + A,lf(l) + A, V(I) +..to .. - g(t)


W(O) - • •V(O) -1/1."(0) - 111."'(0)- ~l

",,11 A•• '+A.,o+A, +A., .. +1tI A... + ..... +A.o+A, +1I>(A.,+Ao.)


A(• ) + + + ,,+
B(.) - .......A> ..~!;r+A,.+A;
0itI........ ~ ..:I '''''-I CondII.... lgo..n)
If"(t) - If(t ) - t + 008(t)
I...IpI.cII T.. _m
( ,(0) _ 1 V(O) _ -1
Y(-l of I'll)
V'(O) _ 0 ....{O) _ - 1 )

Yd.) 2 iii+t~+"-1
Sck.CIan )1(1:) ..1r4;J ....... 1II~
y(t) = Q~'" - t + ~ + f + "11)- I"t)

Compl.u. Solution and Validation


SdulianlO the I-Iamag_.. ~ "'' 41 roaIl (unkr><Mn "....1IIn ... b, .1>:._.)
... (1) _ b, ... (I) + lit 111(1) + b. ~(I) + '" 11«1)
CO"l' .....dulian )(I)o<y h ~)+J p~)

.,(1) _ b, , ,(I) - ~ - I + b, 1ft(1) + b, 1ft(1) + b. , . (I) - ~


0tUin unk.-n IXIII'-Ib, b:! II:. b'.)by.ppI}4no llllllritlll"",_.

( I II-I)
eo.....--.tIonuolng_(~ .. ~"....WI.)

.,(1) - ~ - I +~+ i+ ~ - ~
Con,ll ... -.tIon uoIng ...... UpItot_iotmI

IIll) - ~ - I +~+ i+ ~ - ~
eo...,.11111 -.tiM uoIng d.....) kI Mo •

.,(1) - ~ - 1+ ~ +i+ ~ - ~
Linear Higher Order Differential Equations with Constant Coefficients 211

Example # 4.12
A=[1 0 0 -1 0];IC=[-1,1,0,1];gt=‘exp(-t)’;

Characteristic
212  Differential Equations: A Problem Solving Approach Based on MATLAB
Linear Higher Order Differential Equations with Constant Coefficients 213

OU.... ofW'on ..... n


I~(4') ~-I'.(4') )
WiOl 'Il' ,
w_
( I
" .-_.-1~(I- 4') _.-1 ~(l +4') )
( 0
" _,-I "'(I
( 0
( 0
.'" ,-I +4')
~(4')
,-1".(1+4') )
~-I "'(4') )
-e-'

11(.).. !=f!
,.-1 ;<4')

••- 1 ;<4')

~ ... £q\IolIotI "'" 1_


.......... l..JpI .... b...d .... utlon: Th-,. Ind R. .ulta
CondiIbroo ~ C_)
"'''''(1)+ ~ "'(1) + A,('(I) + A, vet)+ ... , _ g(1)
(r(0) - lb. v(O) .. ". ('(O) .. 1'l , ("(0) .. I'll

B(')_;
_ ~~~~=- _ __
~1111 eq_ II'Id 1_ CondiI_ (g"")
~(t) - vet)_e-'
( , (0) _ - \ "(0) .. 1 ('(0) .. 0 ,..(0) _ I )
LIpIoco T.. -..oV(o)oIl'10
"t (.) __a+,,-,·+ f

--)1(1)""'-......
r; + if +
,,(t) _
. _.'

2.-1 (...(4tJ!Ao(4<» _3
214  Differential Equations: A Problem Solving Approach Based on MATLAB

-""''''' H"n Q .jIIrI . . . . _(U_ . . . . . . .,...


CompI_ SolutIon ...cIV8Ildation

1/11(1) .. " ,. (t ) + '" ,.(t ) + .. ,.(1) + "" ,. (1)


-l

~_)(tn.(I)o1,(I)

If(1) .. ..,. + .. VI (I) +", m Il + "1Il(') + b" .(I)


b:t .., b. ) II'IlppI)oIrog 1M _"",,ollie:> •

u_
0bI8in _.-~ _ _ Ib,

•eo""-..,...1oII
,"'.>- uIifI9 ( -3 I I -"Pcono)..... )
toOII (.........

•• ) t..!
",I .. ! + + '· '7 q..j + tJI, i"(
I<'
T r 41) 3
~-.......,-~--
r;
'(1) .. + if + t . 1(...( 4')/.11.:(4'» - 3
Co/rpIIoIl_ """"V """""C.) ..........

")
",I - t..! .o'
" +T+ 10 '7q<)+ .~. ' -'( 41 ) - 3
i

ODE~ end c~l1_


~WEq ___ Co_
","'(t l - y'( I ) = e-'
( ~(O) .. _ 1 V(O ) .. 1 V'(O) .. 0 V"(O) .. 1 )
eor....... odIoiQ . . . _ d _ _ .,.,._ ... OOE( V, . )'11)]_

Y,'(IJ - Y. )
Y;(t ) .. Y,
( Y;C' )" Y,
Y; (t ) .. e-' + Y,

... ,
Linear Higher Order Differential Equations with Constant Coefficients 215

Example # 4.13
A=[1,1,-2,0];IC=[1,1,-1];gt=‘t+exp(t)’;

Characteristic
216  Differential Equations: A Problem Solving Approach Based on MATLAB

PIIrtlculII, Solution ullng 1M Mtlhod of Vlrtilion 01 PlnllIlII\ItQ


FadoG F _ gil ) .. 1+01

IV ..
,,(1) 1'1(1) ,,(1)
~(t) ,,(1)
,,(I )
1
[ Ji(I) "W) -'(I )

il{t) .. [W r ' [ ~ J'A. io tho urd&t:ic:oI: of ""(1)


f
_, . . . . . . _alP._.os
Mt) '"' "(1),,(1),,(1)] il(1)J1

~(t)-1f-¥-i-~-1
T. . . . -,.Ir¥ _ _ "'-...iII(QN
YALID'A.SS

o.WJt ofWronelda n
( I e- 21 e')
( 0 _2e- z, e')
( 0

11(, )" .. '~..... )

'1"+1
Linear Higher Order Differential Equations with Constant Coefficients 217

InWI''' u~, btoMd soIullon: Theory end R.. ults


owr...... EqUllion IlnClIniW

11'(0) - ,,",11'(0) - 1/1 ,"-(0) - V-I J

A(.) _
BI·) =
IInCIlnIIIII Cordi.... (given)
+ v'lt) - 2lilt) = t + ..
( , (0) _ I rI(O) _ 1 "-(0) _ - 1 )
l8pIIa T .......m Y(s) of)l(1)

" l. I.) - "t"-4r)l{"t.-1


.. (. - 1 (. .2 )
Sck.(Ion y(t) utIrO _ lap'-

lI(t) = ¥ - ~ -~+!f - f+1


Complete Solution ~ Val1dallon
Solution tlllw Homog......,.. pert ..ing _ (unkIKMn cotillion • • b , .b:!.-.)
,~(I ) - II, 1/1 (I) + b: lh(t) + II, ,,(t )
Co"..,1eII tdlAlon y(tn~(I~~~(I)

,(t) - If - ~ - i + Ii! ,, (t)+b,Ih (t ) +~I/':I(I ) - ~ -I


0IUIn """_" oon_(b, b:z b,) bot.ppI)6ng tr.lnitlllloondIIlonI
.,~.,) - II - M il
Coo. ~llll MlUlDn Ulln9roDt1 (~uflknoooo4, cotillion.)

~,) - If - """ -\ + 'f - ~ + J


Co".., .... MlUlDn UIIn9 _ .......01 w..1omw

~ ,) - If - "fr'! -\ + 'f - ~ + I
Co"..,1eII toIutlon Uling dllllMC.) WI t.1&1ab

~') - If - """ - ! + 'f - \ + J


218  Differential Equations: A Problem Solving Approach Based on MATLAB

Example # 4.14
A=[1,1,0,0,0,0];IC=[1;0;1;0;1];gt=‘t’;
Linear Higher Order Differential Equations with Constant Coefficients 219

tnvot,..
upIK. bliNd toIution
orr->l11 EqUllion _1riW ~

JI""(') + >"'(' ) ~,
( ,(0) .. I ,,(0) .. 0 r'(0) .. I '-(0) .. 0 ,"(0) " 1 )

~*- T..nIform Yl to) '" y(\)

" L (, ) = (-'+~f"0+1)
+"+I )
Salutlon)'(l) ..1"41 irwI ... Lapl«e I........orm '" Yl (I)
- 1 12,~ r' ~
() = 2 t+ 2 e -"2+'3-24+i1ij- 1
yt
SdoAlon y(t) uaIng dIoM(J In MatIioIl

y(t) = 2t + 2e-' - '; + t; - ~ + 1~ - 1

OOf.U llId c~lI--'


owr... ... Eq""'" _ _ Con:tti>N
r ( t ) + V"" (t) = t
( ,(0) .. I , (0) .. 0 ""(0) _ 1 ,..(0) . 0 ,"(0) _ 1 )

V...,., 1'1 "'I ... d« _ _ ill *lUBk:In. , ,(.)- y. )


Y,'(I) .. 1',
"" ODE ) Y, • )'(Ill ... ~(I) .. 1',
( 1': (1) .. Yo

_.
~ ......
~
Y'(t) _ t _ Yo


/'
•o 0.5 1 1.5 2
....
2.5 3 15 4 U 5
220  Differential Equations: A Problem Solving Approach Based on MATLAB

Example # 4.15
A=[1,0,1,1,0,1];IC=[1;0;0;0;1];gt=‘exp(t)’;
Linear Higher Order Differential Equations with Constant Coefficients 221

Example # 4.16
A=[1,0,0,-1,0,0];IC=[1;0;1;0;0];gt=‘exp(-t)’;
222  Differential Equations: A Problem Solving Approach Based on MATLAB

......... L.Io~ . boo .... - . . _


-'WEquoIIoft _ _ ~

r (t) - 1I"(t) .. e-'


(.<t l_ ' ; (0). ' " (11_ 1 ,..~)_ o '-COI- I)
I,.opIoal T...-m y.ltlol,(ll

y,(.) __ ;fr-'."u·
~ .. -..
SoIuIIon !'CIluoIroII-'" L...-......... <II Y. (II
4v'3d "'.(;+*)
lI( t) "" slnh(t) - t - , +2
_!IIII..w,g-..cJ"_~

lI(t) "" ainh(t) - t _ 2 e-~ C08( *) _h "'-\ ,01, 4') + 2


00E45 .... c_ r l - .
OiII •• .w~ _ _ Ow ft· •

V'""(t) - v"(t) = e-t


( ~)_ , ((1)_ ' " /11 _ 1 "'(e)- I .H{II_ I '

v_: . ........... _ _ _ ""'"


""ODE {Y, • )(I)) ..

••!o-~.".,~~-~,,~~,~':U~ ,
... , u • 0.5 5
Linear Higher Order Differential Equations with Constant Coefficients 223

Example # 4.17
A=[1,1,0,0,0,0,0];IC=[1;0;0;0;1;0];gt=‘exp(-t)*t’;
224  Differential Equations: A Problem Solving Approach Based on MATLAB

Example # 4.18
A=[1,0,0,1,0,0,0];IC=[0;0;0;0;0;1];gt=‘t+5’;
Linear Higher Order Differential Equations with Constant Coefficients 225
226  Differential Equations: A Problem Solving Approach Based on MATLAB

Example # 4.19
A=[1,0,0,1,0,0,0,0];IC=[1;0;0;0;0;0;1];gt=‘t’;
Linear Higher Order Differential Equations with Constant Coefficients 227

Example # 4.20
A=[1,0,0,1,0,0,0,0];IC=[1;0;0;-1;0;0;1];gt=‘t*exp(-t)’;
228  Differential Equations: A Problem Solving Approach Based on MATLAB
Linear Higher Order Differential Equations with Constant Coefficients 229

Example # 4.21
A=[1,0,-1,1,0,-1,0,0];IC=[1;0;0;0;0;0;1];gt=‘t’;
230  Differential Equations: A Problem Solving Approach Based on MATLAB

Example # 4.22
A=[1,0,-1,1,0,-1,0,0];IC=[1;0;0;0;0;0;1];gt=‘t+exp(-t)’;
Linear Higher Order Differential Equations with Constant Coefficients 231
232  Differential Equations: A Problem Solving Approach Based on MATLAB

Example # 4.23
A=[1,0,-1,1,0,-1,0,0];IC=[1;0;0;0;0;0;1];gt=‘exp(-t)’;
Linear Higher Order Differential Equations with Constant Coefficients 233

4.7 Summary
In this chapter, we explored ways of solving higher order differential equations with
constant coefficients. The characteristic equation is used to formulate the solution to
the homogeneous differential equation while the concept of the Wronskian introduced
in Chapter 3 is invoked to get the particular solution. The difficulties encountered
in using the roots of the characteristic equation of the higher order differential
equations is clearly articulated in terms of the relationships that might exist among
the various roots making it difficult to proceed as the order increases beyond 4. As
has been done throughout, the solution obtained through the use of roots and the
Wronskian is compared to the one obtained using the theory of Laplace transforms.
Additional confirmation is provided through the use of numerical techniques based
on the Runge-Kutta method in MATLAB. Differential equations with orders larger
than the 4th are solved using Laplace transforms and results are compared using the
Runge-Kutta method.
234  Differential Equations: A Problem Solving Approach Based on MATLAB

4.8 Exercises
1. Consider a higher order differential equations with a coefficient vector A=[An,An-
1,..,A0]. Obtain the characteristic equation, roots and the homogeneous solution.
Does the solution match the one obtained using solve(.) in MATLAB.
A=[1,-3,-1,0]
A=[1,0,-2,-1]
A=[1,-1,0,-4];
A=[1,-1,0,0];
A=[1,0,0,-3];
A=[1,0,-3,0];
A=[1,-1,1,0];
A=[1,0,0,0];
A=[1,0,0,1];
A=[1,-4,0,0];
A=[1,0,0,-8,0];
A=[1,4,0,0,0];
A=[1,0,0,1,0];
A=[1,0,0,-1,0];
A=[1,-1,0,0,0];
2. A number of third order differential equations are identified by the coefficient
vector A=[A3,A2,A1,A0]. For each of the cases, a forcing function g(t) is
provided. Obtain the particular solution in each case. Provide the homogeneous
solution set and Wronskian in each case.
A=[1,1,0,0]; g(t)=texp(-t)+t
A=[1,-1,0,0];g(t)=t;
A=[1,0,4,0];g(t)=cos(2t)
A=[2,-5,2,0]=g(t)=exp(2t)
A=[1,0,-9,0];g(t)=cosh(3t);
A=[1,-4,-5,0]; g(t)=t+t^2exp(5*t)
A=[2,0,-2,0];g(t)=sinh(t)
A=[1,2,0,-1];g(t)=cos(t);
A=[2,1,0,0];g(t)=t^2;
A=[1,0,0,-8,0];g(t)=t+exp(2t)
A=[1,4,0,0,0];g(t)=t*exp(-4t)
A=[1,0,0,1,0];g(t)=exp(-t)
A=[1,0,0,-1,0];g(t)=5t+exp(t)
A=[1,-1,0,0,0];g(t)=t+t^2
A=[1,-1,-1,0,0];g(t)=t;
Linear Higher Order Differential Equations with Constant Coefficients 235

3. For the given initial conditions, obtain the complete solutions. Verify the results
using Laplace transforms and ode45.
A=[1,1,0,0];g(t)=t*exp(-t)+t;IC=[1,-1,0];
A=[1,-1,0,0];g(t)=t;IC=[1,1,0];
A=[1,0,4,0];g(t)=cos(2*t);IC=[0,-1,0];
A=[2,-5,2,0];g(t)=exp(2*t);IC=[-1,-1,0];
A=[1,0,-9,0];g(t)=cosh(3*t);IC=[0,-1,1];
A=[1,-4,-5,0];g(t)=t+t^2*exp(5*t);IC=[-1,-1,1];
A=[2,0,-2,0];g(t)=sinh(t);IC=[0,-1,-1];
A=[1,2,0,-1];g(t)=cos(t);IC=[-1,1,0];
A=[2,1,0,0];g(t)=t^2;IC=[0,-1,1];
A=[1,0,0,-8,0];g(t)=t+exp(2*t);IC=[1,0,-1,1];
A=[1,4,0,0,0];g(t)=t*exp(-4*t);IC=[1,0,1,1];
A=[1,0,0,1,0];g(t)=‘exp(-t)’;IC=[1,1,0,1];
A=[1,0,0,-1,0];g(t)=‘5*t+exp(t)’;IC=[1,0,-1,0];
A=[1,-1,0,0,0];g(t)=t+t^2;IC=[1,1,0,0];
A=[1,-1,-1,0,0];g(t)=t;IC=[1,0,0,0];

CHAPTER 5

First Order Coupled Differential


Equations with Constant
Coefficients

5.1 Introduction 236


5.2 A Pair of Coupled Differential Equations 237
5.2.1 Homogeneous systems 237
5.2.2 First order non-homogeneous systems 268
5.3 Multiple First Order Coupled Differential Equations of Constant 279
Coefficients
5.3.1 Solution using eigenvalues and eigenvectors 280
5.3.2 Solution using Laplace transforms 281
5.3.3 Examples 282
5.4 Numerical Solutions 295
5.5 Examples 298
5.6 Summary 381
5.7 Exercises 381

5.1 Introduction
Systems often comprise more than one component or rely on two or more components
linked together for efficient operations. Examples include electrical, mechanical
and chemical flow systems, and traffic networks. Such systems require two or more
dependent variables for modeling and the behavior or operation of the systems can be
described in terms of a set of coupled first order differential equations. The analysis
presented here examines only linear systems with constant coefficients. We start with
the case of a pair of coupled equations before we explore coupled systems with three
or more variables.
First Order Coupled Differential Equations with Constant Coefficients 237

5.2 A Pair of Coupled Differential Equations


An example of a system with two variables x1(t) and x2(t) can be written as
dx1
= A11 x1 + A12 x2
dt
. (5.1)
dx2
= A21 x1 + A22 x2
dt
Equation (5.1) can be written as a matrix equation (Appendix D)
 dx 
  1
dx dt  A11 A12   x1  
= =   = Ax (5.2)
dt  dx2   A21 A22   x2 
 dt 

In eqn. (5.2), A is the coefficient matrix and x is the vector

 x 
x =  1  . (5.3)
 x2 
While eqn. (5.1) is homogeneous, the non-homogeneous set of differential equations
can be expressed as
 dx1 

dx  dt   
=  =  Ax + g ( t ) . (5.4)
dt  dx2 
 dt 
In eqn. (5.4),

  g ( t )  . (5.5)
g (t ) =  1 
 g 2 ( t )
In eqn. (5.5), g1(t) and g2(t) are the forcing functions. If the initial conditions are
available, they can be expressed in vectorial form as

  x (0) 
x (0) =  1 . (5.6)
 x2 ( 0 ) 
We will now consider the homogeneous and non-homogeneous differential
equations separately.

5.2.1 Homogeneous systems
5.2.1.1 Solution using eigenvalues and eigenvectors
Consider the case of a pair of first order homogeneous equations expressed as
 dx 
  1
dx dt    x (0) 
= = x (0)  1
 Ax , = . (5.7)
dt  dx2   x2 ( 0 ) 
 dt 
238  Differential Equations: A Problem Solving Approach Based on MATLAB

In eqn. (5.7),
A A12 
A =  11  (5.8)
 A21 A22 
The solution to the first order homogeneous (coupled) system can be obtained by
examining the coefficient matrix A in eqn. (5.8) and its properties in terms of the
eigenvalues and eigenvectors. The concepts of eigenvalues and eigenvectors are
discussed in Appendix D. From the analysis presented in Appendix D, three distinct
possibilities exist for the two sets of eigenvectors: real and distinct, real and equal or
form a complex conjugate pair.

Distinct eigenvectors
When the coefficient matrix is not defective (it has two distinct eigenvectors), two
possibilities exist, either the eigenvalues are distinct or equal. Consider the case where
the two eigenvalues are real and distinct. If the two eigenvalues associated with A
 
are λ1 and λ2 with corresponding eigenvectors v1 and v2 , the two linearly independent
solution vectors are
 
X 1 ( t ) = v1eλ1t
  . (5.9)
X 2 ( t ) = v2 eλ2t
The fundamental matrix X(t) associated with the system is the [2 x 2] matrix
 
X ( t ) =  X 1 X 2  (5.10)

The general solution of the homogeneous system is the superposition of the two
solutions in eqn. (5.9) as
    2 
x (t ) =
Xc= ∑ ck X k ( t ) . (5.11)
c1 X 1 ( t ) + c2 X 2 ( t ) =
k =1

In eqn. (5.11), c is the vector with two elements c1 and c2 representing the two
unknown constants or scaling factors.

The two unknown coefficients can be evaluated from the initial conditions x ( 0 )
in eqn. (5.7). The analysis and the solution given in eqn. (5.9) and eqn. (5.11) do not
change even when λ1 = λ2 = λ, if the two eigenvectors are distinct because the set of
equations in eqn. (5.9) represents two linearly independent solutions.

Complex eigenvectors
When eigenvectors are complex, eigenvalues are also complex and vice versa. If the
two eigenvalues are
λ1,2= λ±= α ± j β . (5.12)
In eqn. (5.12), α and β are real. The two eigenvectors are
   
v1,2= v±= u ± jw . (5.13)
First Order Coupled Differential Equations with Constant Coefficients 239

The two solution vectors are


  
= X 1 ( t ) eα t u cos ( β t ) − w sin ( β t ) 
   . (5.14)
= X 2 ( t ) eα t u sin ( β t ) + w cos ( β t ) 
The general solution is once again given by eqn. (5.11) with the solution vectors
given in eqn. (5.14).

Equal eigenvectors
When the eigenvectors are equal (this certainly implies that eigenvalues are equal),
the coefficient matrix is defective and two independent solution vectors do not exist.
This case requires the generation of a pair of generalized eigenvectors as described in
Appendix D. While it is possible to keep the single eigenvector obtained and get an
extra single generalized eigenvector and use these two, the approach described here
does not use the original eigenvector. Instead, a pair of generalized eigenvectors is
obtained from the solution of
2 
( A − λ I2 ) v =0. (5.15)
In eqn. (5.15), I2 is the 2 x 2 identity matrix and if the pair of generalized eigenvectors
 
are vg and vg2, the solution vectors become (Appendix D)
1
  
X 1 ( t=
) eλt vg1 + t ( A − λ I 2 ) vg1 
   . (5.16)
X 2 ( t=
) eλt vg2 + t ( A − λ I 2 ) vg2 
The general solution is once again given by eqn. (5.11) with the solution vectors
given in eqn. (5.16). It should be noted that for the case of a 2 x 2 defective matrix,
the generalized eigenvectors will be (see appendix D)

 1 
vg1 =  
0 
(5.17)
 0 
vg 2 =  
1 
5.2.1.2 Solution without using eigenvectors
While the solutions to a set of first order coupled homogeneous differential equations
with constant coefficients is simple and straightforward, it creates some difficulties
when the coefficient matrix is defective. It is possible to obtain the solutions using the
characteristic equation approach outlined in Chapter 3 in connection with the solutions
of second order homogeneous differential equations with constant coefficients. The
same approach can be implemented here by converting a pair of homogeneous first
order equations into a second order differential equation of constant coefficients.
Consider the first differential equation in x1 in eqn. (5.1). Its differentiation leads to
x1'' A11 x1' + A12 x2' .
= (5.18)
240  Differential Equations: A Problem Solving Approach Based on MATLAB

Equation (5.18) can be rewritten using the differential equation for x2 from eqn. (5.1)
and creating a second order differential equation in x1 as

x1'' =A11 x1' + A12 [ A21 x1 + A22 x2 ] =A11 x1' + A12 A21 x1 + A22 ( x1' − A11 x1 ) (5.19)

Simplifying eqn. (5.19) leads to


x1'' − ( A11 + A22 ) x1' + ( A11 A22 − A12 A21 ) x1 =
0 (5.20)

Using the method based on the roots of the characteristic equation developed in
Chapter 3, it is possible to get a general solution for x1(t). Substituting x1(t) in the first
differential equation eqn. (5.1), a general solution for x2(t) can be obtained. Using the
initial conditions, the unknown coefficients can be obtained completing the solution.
In some of the instances, A12=0 and A21≠0. In this case, the first differential
equation eqn. (5.1) is used to obtain a second order differential equation in x2(t) and the
procedure is repeated to obtain the solution for x1(t). In the special case of A12= A21=0,
the two differential equations are uncoupled and they can easily be solved.

5.2.1.3 Solution using Laplace transforms


If the initial conditions are given, the solutions set can be obtained using the concept
of Laplace and inverse Laplace transforms. The solutions vector can be written as

 x1 ( t )  
−1  −1  x1 ( 0 )  

=
  L [ sI 2 − A]   . (5.21)
 2 ( )
x t   2 ( )  
x 0
In eqn. (5.21), I2 is a [2 x 2] identity matrix and [sI2 – A]–1 is the inverse of the
matrix [sI2 – A]. Inversion of a matrix is described in Appendix D. Solutions may also
be obtained using numerical techniques outlined in Appendix A.

5.2.1.4 Analysis of coupled first order homogeneous systems with constant


coefficients
An analysis on a set of homogeneous first order coupled differential equations of
constant coefficients will be incomplete without a discussion of the critical point. The
critical point or the equilibrium point is the solution to

dx 
= 0= Ax . (5.22)
dt
Because we have a homogeneous system, the critical point will be [0. 0] or the origin.
The critical point and the behavior of the solutions of the differential equations can
be used to characterize the stability of the system described by the set of differential
equations. The phase plane plots or phase portraits (Appendix C) show the behavior
of the solutions and hence the behavior of the system. A number of specific coefficient
matrices have been analyzed to demonstrate the usefulness of the phase portrait and
its use in understanding the behavior of the system described by the coupled first
First Order Coupled Differential Equations with Constant Coefficients 241

order system. While the detailed procedure is described in Appendix C, the analytical
solutions are not plotted alongside the quiver(.) plot.
clear;close all;
% generate phase plots for several coefficient matrices
% P M Shankar, July 2017
for k=1:12
if k==1
A=[-1,2;2,1];
elseif k==2
A=[-1,2;-4,1];
elseif k==3
A=[-1,-1;1,-1];
elseif k==4
A=[2,1;-1,2];
elseif k==5
A=[2,-2;1,-1];
elseif k==6
A=[-2,2;1,-1];
elseif k==7
A=[2,0;1,1];
elseif k==8
A=[2,0;0,2];
elseif k==9
A=[-1,0;-1,-1];
elseif k==10
A=[-2,0;0,-2];
elseif k==11
A=[-2,1;0,-2];
elseif k==12
A=[2,2;-2,-2];
end;
[x1,x2]=meshgrid(-3:.5:3,-3:.5:3);
DX1=A(1,1)*x1+A(1,2)*x2;
DX2=A(2,1)*x1+A(2,2)*x2;
figure
quiver(x1,x2,DX1,DX2,1.5,‘color’,‘r’),xlabel(‘x_1(t)’),ylabel(‘x_2(t)’)
xlim([-3,3]),ylim([-3,3])
lambda=eig(sym(A));
title([‘EigenValues\Rightarrow’,’ [‘,num2str(double(lambda’)),‘]’])
end;

The results are presented below. Consider the case of the coefficient matrix
 −1 2 
A=  . (5.23)
 2 1
The eigenvalues are real with one of them being positive and the other being negative
resulting in the phase portrait in Figure 5.1. The solution moves away from the critical
point indicating that the system is unstable.
242  Differential Equations: A Problem Solving Approach Based on MATLAB

Figure 5.1  The eigenvalues are real and have opposite signs. The solutions move away from the critical
point [0,0] indicating that the system is unstable.

Consider the case of the coefficient matrix


 −1 2 
A=  . (5.24)
 −4 1 
The eigenvalues are purely imaginary (complex conjugate pair) resulting in the
phase portrait in Figure 5.2. The solutions continously encircle the critical point [0,0]
indicating that the system is oscillatory, because the solutions are sines and cosines.
Consider the case of the coefficient matrix
 −1 −1
A=  . (5.25)
 1 −1
The eigenvalues form a complex conjugate pair with the real part being negative
resulting in the phase portrait in Figure 5.3. The solutions continously move towards
the critical point [0,0] indicating that the system is asymptotically stable.

Consider the case of the coefficient matrix


 2 1
A=  . (5.26)
 −1 2 
First Order Coupled Differential Equations with Constant Coefficients 243

Figure 5.2  The eigenvalues are purely imaginary. The solutions continously encircle the critical point
[0,0], indicating that the system is oscillatory.

Figure 5.3  The eigenvalues are complex with a negative real part. The solutions move towards the critical
point [0,0] indicating that the system is asymptotically stable.
244  Differential Equations: A Problem Solving Approach Based on MATLAB

Figure 5.4  The eigenvalues are complex with a positive real part. The solutions move away from the
critical point [0,0] indicating that the system is unstable.

Figure 5.5  One of the eigenvalues is zero while the other one is positive. The solutions move away (opposite
direction) from a diagonal line going through the critical point [0,0] indicating that the system is unstable.
First Order Coupled Differential Equations with Constant Coefficients 245

The eigenvalues form a complex conjugate pair with the real part being positive
resulting in the phase portrait in Figure 5.4. The solutions continously move away
from the critical point [0,0] indicating that the system is unstable.
Consider the case of the coefficient matrix
 2 −2 
A=  . (5.27)
1 −1
The eigenvalues are real with one of them being a zero and the other one being positive
resulting in the phase portrait in Figure 5.5. The solutions move away (opposite
direction) from a diagonal line through critical point [0,0] indicating that the system
is unstable. The unstable nature in this case being defined w.r.t. a line is due to the
existence of an eigenvalue of 0.
Consider the case of the coefficient matrix
 −2 2 
A=  . (5.28)
 1 −1
The eigenvalues are real with one of them being a zero and the other one being
negative resulting in the phase portrait in Figure 5.6. The solutions move towards the
diagonal line through the critical point [0,0], indicating that the system is stable. The
stability in this case being defined w.r.t. a line is due to the existence of an eigenvalue
of 0.
Consider the case of the coefficient matrix

Figure 5.6  One of the eigenvalues is zero while the other one is negative. The solutions point to the a
diagonal line through the critical point [0,0] indicating that the system is stable.
246  Differential Equations: A Problem Solving Approach Based on MATLAB

Figure 5.7 Both eigenvalues are positive. The solutions move away from the critical point [0,0],
indicating that the system is unstable.

2 0
A=  . (5.29)
1 1 
The eigenvalues are real and positive resulting in the phase portrait in Figure 5.7. The
solutions move away from the critical point [0,0] indicating that the system is unstable.
Consider the case of the coefficient matrix
2 0
A= . (5.30)
0 2
The eigenvalues are real and positive resulting in the phase portrait in Figure 5.8. The
solutions move away from the critical point [0,0], indicating that the system is unstable.
Consider the case of the coefficient matrix
 −1 0 
A= . (5.31)
 −1 −1
The eigenvalues are real and negative resulting in the phase portrait in Figure 5.9.
The solutions move towards the critical point [0,0], indicating that the system is
asymptotically stable.
Consider the case of the coefficient matrix
First Order Coupled Differential Equations with Constant Coefficients 247

Figure 5.8  Both eigenvalues are equal and positive. The solutions move away from the critical point
[0,0], indicating that the system is unstable.

Figure 5.9  Both eigenvalues are negative. The solutions move towards the critical point [0,0], indicating
that the system is asymptotically stable.
248  Differential Equations: A Problem Solving Approach Based on MATLAB

Figure 5.10  Both eigenvalues are negative. The solutions move towards the critical point [0,0] indicating
that the system is asymptotically stable.

 −2 0 
A= . (5.32)
 0 −2 
The eigenvalues are real and negative resulting in the phase portrait in Figure
5.10. The solutions move towards the critical point [0,0] indicating that the system
is asymptotically stable.
Consider the case of the coefficient matrix
 −2 1 
A=  . (5.33)
 0 −2 
The eigenvalues are real and negative resulting in the phase portrait in Figure
5.11. The solutions move towards the critical point [0,0] indicating that the system
is asymptotically stable. Note the difference in how the solutions move towards the
critical point in this case vs. what is seen in Figure 5.10. Even though the eigenvalues
for the matrices in eqns. (5.32) and (5.33) are identical, the matrix in eqn. (5.32) is
symmetric and therefore it is not defective (it has two distinct eigenvectors). The
matrix in eqn. (5.33) is not symmetric and it is defective because it only has a single
eigenvector. Details can be seen in Appendix D.
Consider the case of the coefficient matrix
First Order Coupled Differential Equations with Constant Coefficients 249

2 2
A= . (5.34)
 −2 −2 

Figure 5.11  Both eigenvalues are negative. The solutions move towards the critical point [0,0], indicating
that the system is asymptotically stable. Note the difference in how the solutions move towards the critical
point in this case vs. what is seen in Figure 5.10. This is due to the fact that the matrix is defective in this
case while the matrix is not defective for the case depicted in Figure 5.10.

Figure 5.12  Both eigenvalues are zeros. The solutions move in opposite directions with respect to the line
through the critical point [0,0] indicating that the system is unstable.
250  Differential Equations: A Problem Solving Approach Based on MATLAB

The eigenvalues are real and both of these are 0’s resulting in the phase portrait in
Figure 5.12. The solutions move in opposite directions with respect to the line through
the critical point [0,0], indicating that the system is unstable.
The phase plane plots and the stability criteria associated with a pair of first
order homogeneous differential equations with constant coefficients is summarized
in Table 5.1

5.2.1.5 Examples
A set of examples demonstrating the different pairing of the eigenvalues described
above will now be given before MATLAB® based examples are provided.
Example # 5.1 Consider a pair of coupled differential equations represented by the
coefficient matrix

1 2  . (5.35)
A= 
3 2 
This coefficient matrix represents the two coupled differential equations,

1 (t ) x1 ( t ) + 2 x2 ( t )
'
x=
. (5.36)
x2' ( t ) 3x1 ( t ) + 2 x2 ( t )
=
The initial conditions are
 x1 ( 0 )  1 
  =   . (5.37)
 x2 ( 0 )  0 
The two eigenvalues associated with the coefficient matrix and the corresponding
eigenvectors are

  −1
λ1 =
−1 v1 = 1
 
 2  . (5.38)
  
λ2 4=
= v2 3
 
 1 
The solution set can now be written as
2
x1 ( t ) =
−c1e − t + c2 e 4t
3 . (5.39)
x2=( t ) c1e + c2 e4t
−t

The two unknowns constants c1 and c2 may be obtained by applying the initial
conditions in eqn. (5.37). This leads to
2
1 =−c1 + c2
3 . (5.40)
0= c1 + c2
Table 5.1. Eigenvalues, eigenvectors and stability.

Eigenvalues Eigenvectors Type of Critical Point Stability Gallery of solutions


λ1, λ2 >0 Real and distinct Node Unstable Not straight lines
λ1, λ2 < 0 Real and distinct Node Asymptotically stable Not straight lines
λ1< 0 < λ2 Real and distinct Saddlepoint Unstable Not straight lines
λ1 = λ2 >0 Real and distinct Node Unstable Straight lines
λ1 = λ2 <0 Real and distinct Node Asymptotically stable Straight lines
λ1 = λ2 >0 Real, but not distinct Node Unstable Not straight lines
λ1 = λ2 <0 Real, but not distinct Node Asymptotically stable Not straight lines
λ1 = 0, λ2 < 0 Real and distinct Crt. Point(s) on a line Asymptotically stable Straight lines
λ1 = 0, λ2 > 0 Real and distinct Crt. Point(s) on a line Unstable Straight lines
λ1 = λ2 = 0 Real, but not distinct Crt. Point(s) on a line Unstable Straight lines
λ1, λ2 = α ± j β, α > 0 Complex conjugate pair Spiral point Unstable Not straight lines
λ1, λ2 = α ± j β, α < 0 Complex conjugate pair Spiral point Asymptotically stable Not straight lines
λ1, λ2 = α ± j β, α = 0 Complex conjugate pair Center Stable Ellipses
First Order Coupled Differential Equations with Constant Coefficients 251
252  Differential Equations: A Problem Solving Approach Based on MATLAB

Solving eqn. (5.40) gives


3
c1 = −
5
. (5.41)
3
c2 =
5
Equation (5.39) can now be rewritten as

 2e5t + 3 
x1 ( t ) = e − t  
 5 
. (5.42)
−t  e − 1 
5t
x2 ( t ) = 3e  
 5 
The two coupled equations can be converted to a single second order differential
equation in x1(t) as
x1'' ( t ) − 3 x1' ( t ) − 4 x1 ( t ) =
0 (5.43)

Equation (5.43) can be solved using the methods described in Chapter 3. Note that
the roots of the characteristic equation associated with the second order differential
equation in eqn. (5.43) will be -1 and 4, matching the eigenvalues obtained directly
from the coefficient matrix in eqn. (5.35). The solution for x1(t) can be expressed in
terms of two unknown constants b1 and b2 as
( t ) b1e−t + b2 e4t .
x1= (5.44)

Using one of the differential equations in eqn. (5.36), the solution for x2(t) becomes
3
x2 ( t ) =
−b1e − t + b2 e 4t . (5.45)
2
Applying initial conditions given in eqn. (5.37), eqn. (5.44) and (5.45) can be solved
for b1 and b2 as
3
b1 =
5
. (5.46)
2
b2 =
5
Substituting the values of b1 and b2 in eqns. (5.44) and (5.45), the solutions obtained
match those given in eqn. (5.42).
In terms of the Laplace transforms, the Laplace transforms of the solutions to set of
differential equations in eqn. (5.36) becomes
s−2
X1 ( s ) = −
− s 2 + 3s + 4
(5.47)
3
X2 (s) = − 2
− s + 3s + 4
First Order Coupled Differential Equations with Constant Coefficients 253

Taking inverse Laplace transforms of eqn. (5.47), the solution set becomes
2 4t 3 − t
(t )
x1= e + e
5 5
. (5.48)
3 3
x2=( t ) e 4t − e − t
5 5
Note that the solution set in eqn. (5.48) matches the set in eqn. (5.42). The phase
portrait shown in Figure 5.13 illustrates that the system represented by the coefficient
matrix in eqn. (5.35) is unstable.

Figure 5.13  The phase plane plots or gallery of solutions. The directional arrows clearly show that the
solutions are moving away from the critical point, indicating that the system is unstable.

Example # 5.2 Consider a pair of coupled differential equations represented by the


coefficient matrix
 −1 2 
A=  . (5.49)
 −1 1 
The set of differential equations represented by the coefficient matrix in eqn. (5.49) is
x1' ( t ) =
− x1 ( t ) + 2 x2 ( t )
(5.50)
x2' ( t ) =
− x1 ( t ) + x2 ( t )
The initial conditions are
 x1 ( 0 )   2 
 =  . (5.51)
 x2 ( 0 )  1 
254  Differential Equations: A Problem Solving Approach Based on MATLAB

The eigenvalues and eigenvectors associated with the coefficient matrix are

 1 + i 
λ1 =
−i v1 =
 1 
 
. (5.52)
 1 − i 
λ2 i =
= v2  
 1 
Notice that the eigenvectors are purely imaginary and therefore, the solution will
consist of sines and cosines. The solution set is
x1 ( t )= c1 cos ( t ) + sin ( t )  + c2 cos ( t ) − sin ( t ) 
. (5.53)
x2 ( t ) c1 cos ( t ) − c2 sin ( t )
=
Applying the initial conditions in eqn. (5.51), the two constants are obtained as
=c1 1=
c2 1 . (5.54)
Using the values of c1 and c2, the solution set becomes
x1 ( t ) = 2 cos ( t )
 π  . (5.55)
x2 ( t )
= 2 cos  t + 
 4
The set of differential equations can be converted to a second order differential
equations as
x1'' ( t ) + x1 ( t ) =
0 . (5.56)

The roots of the characteristic equation associated with the second order differential
equation are [I, -i]. The solution set becomes
x1 ( t ) b1 cos ( t ) − b2 sin ( t )
=
b1 b b b . (5.57)
cos ( t ) − 2 cos ( t ) − 1 sin ( t ) − 2 sin ( t )
x2 ( t ) =
2 2 2 2
Applying initial conditions, the two unknown constants become
=b1 2=b2 0 . (5.58)
Using the values of b1 and b2 in eqn. (5.57), one obtains the solution set matching the
one given in eqn. (5.55).
The solution to the set of differential equations can also be obtained using Laplace
transforms. The Laplace transforms of the two differential equations become (with
the initial conditions included)
2 s −1
1 (s)
X= +2 2
s2 + 1 s +1
. (5.59)
2 s +1
X2 (s) =
− 2 + 2
s +1 s +1
First Order Coupled Differential Equations with Constant Coefficients 255

Taking inverse Laplace transforms, the solution set becomes


x1 ( t ) = 2 cos ( t )
 π  . (5.60)
x2 ( t ) = cos ( t ) − sin ( t ) = 2 cos  t + 
 4
The phase portrait associated with the system described by the coefficient matrix in eqn.
(5.49) is shown in Figure 5.14. The oscillatory behavior of the system is clearly seen.

Figure 5.14  The phase plane plots or gallery of solutions. The directional arrows clearly show that the
solutions form elliptical orbits indicating stability.

Example # 5.3 Consider a pair of coupled differential equations represented by the


coefficient matrix
 1 0
A=  . (5.61)
 −2 1 
The coefficient matrix in eqn. (5.61) represents a pair of differential equations
x1' ( t ) = x1 ( t )
(5.62)
x2' ( t ) =
−2 x1 ( t ) + x2 ( t )
The initial conditions are given as
 x1 ( 0 )  1 
 =  (5.63)
 x2 ( 0 )  0 
256  Differential Equations: A Problem Solving Approach Based on MATLAB

The two eigenvalues of the matrix are equal, each being 1,


λ=
1 λ=
2 1. (5.64)
The matrix is defective because there is only a single unique eigenvector. This means
that a pair of generalized eigenvectors is required. Using the method described in
Appendix D, the generalized eigenvectors are (eqn. (5.17))
1   0 
0  , 1  . (5.65)
   
The general solution can be written in terms of the generalized eigenvectors from
eqn. (5.16) as
x1 ( t ) = et c1
. (5.66)
x2 ( t ) =
−2tet c1 + et c2
Applying initial conditions, the constants are evaluated as
=c1 1=
c2 0 . (5.67)
The solution set now becomes
x1 ( t ) = et
. (5.68)
x2 ( t ) = −2tet
Because the coefficient matrix A is such that A12= 0 (does not contain x2), the second
differential equation in eqn. (5.62) is used to obtain a second order differential equation
in x2(t) as
x2'' ( t ) − 2 x2' ( t ) + x2 ( t ) =
0 . (5.69)

The roots of the characteristic equation are [1, 1]. This leads to a solution for x2(t) as
2 (t )
x= et ( b1 + b2 t ) . (5.70)
Substituting eqn. (5.70) in the second differential equation in eqn. (5.62), the solution
for x1(t) becomes
b2 t
x1 ( t ) = −
e . (5.71)
2
Applying initial conditions, the two constants are evaluated as
b1 = 0 b2 = −2 . (5.72)

Substituting for b1 and b2 in eqn. (5.70) and eqn. (5.71) leads to the solution set obtained
from the eigenvector set given in eqn. (5.68).
The Laplace transforms of the set of differential equations (with initial conditions) are
1
X1 ( s ) =
s −1
1 . (5.73)
X 2 ( s ) = −2
( s − 1)
2
First Order Coupled Differential Equations with Constant Coefficients 257

Taking inverse Laplace transforms, eqn. (5.73) leads to


x1 ( t ) = et
. (5.74)
x2 ( t ) = −2tet
The phase portrait associated with the coefficient matrix in eqn. (5.61) is shown in
Figure 5.15. The unstable equilibrium conditions are seen.

Figure 5.15  The phase plane plots or gallery of solutions. The directional arrows clearly show that the
solutions are moving away from the critical point, pointing out that the system is unstable.

Example # 5.4 Consider a pair of coupled differential equations represented by the


coefficient matrix
2 0
A=  . (5.75)
0 2
The set of differential equations associated with the coefficient matrix is
x1' ( t ) = 2 x1 ( t )
. (5.76)
x2' ( t ) = 2 x2 ( t )
The initial conditions are given as
 x1 ( 0 )  1
  =   . (5.77)
 x2 ( 0 )  1
258  Differential Equations: A Problem Solving Approach Based on MATLAB

The eigenvalues of the coefficient matrix are equal even though the coefficient matrix
is not defective because two distinct eigenvectors are associated with A in eqn. (5.75).
The eigenvalues and eigenvectors are

 1 
λ1 2=
= v1  
0 
. (5.78)
 0 
λ2 2=
= v2  
1 
The solution set in terms of two unknown constants c1 and c2 becomes
x1 ( t ) = c1e 2t
. (5.79)
x2 ( t ) = c2 e 2t
Applying initial conditions, the solution set becomes
x1 ( t ) = e 2t
. (5.80)
x2 ( t ) = e 2t
It is clear from the set of differential equations in eqn. (5.76) that the set does
not constitute a pair of coupled equations and therefore, no second order differential
equation is necessary to obtain the solution set. Using the concept of Laplace
transforms, the Laplace transforms become
1
X1 ( s ) =
s−2
. (5.81)
1
X2 (s) =
s−2
Taking inverse Laplace transforms, the set of Laplace transforms in eqn. (5.81) leads
to the solution set in eqn. (5.80).
The phase portrait for the coefficient matrix in eqn. (5.75) is shown in Figure
5.16. The unstable equilibrium conditions are seen.
Example # 5.5 It is interesting to observe how the solutions behave for a system having
equal eigenvalues with a degenerate coefficient matrix. Consider a set of differential
equations represented by the coefficient matrix
2 1
A=  . (5.82)
0 2
While the two eigenvalues of the matrix are equal (each being 2), the matrix is defective
requiring the use of generalized eigenvectors. The use of the generalized eigenvectors
alters the gallery of solutions as seen in Figure 5.17.
The set of differential equations associated with the coefficient matrix in eqn. (5.82) is
x1' ( t ) 2 x1 ( t ) + x2 ( t )
=
. (5.83)
x2' ( t ) = 2 x2 ( t )
First Order Coupled Differential Equations with Constant Coefficients 259

Figure 5.16  The phase plane plots or gallery of solutions. The directional arrows clearly show that the
solutions (straight lines) are moving away from the critical point, pointing out that the system is unstable.

Figure 5.17  The phase plane plots or gallery of solutions. The directional arrows clearly show that the
solutions (no longer straight lines) are moving away from the critical point, indicating that the system is
unstable. The use of the generalized eigenvector (due to the defective nature of the coefficient matrix)
alters the nature of the solutions.
260  Differential Equations: A Problem Solving Approach Based on MATLAB

The initial conditions are given as


 x1 ( 0 )  0 
  =   . (5.84)
 x2 ( 0 )  1 
The eigenvalues are 2 and 2. But the matrix is defective because we only have a single
eigenvector requiring a pair of generalized eigenvectors,
1   0 
 0  , 1  . (5.85)
   
The general solution can be written in terms of the generalized eigenvectors as

( t ) e2t c1 + c2te2t
x1=
. (5.86)
x2 ( t ) = c2 e 2t
Applying the initial conditions, the constants can be evaluated as
=c1 0=c2 1 . (5.87)
The solution set now becomes
x1 ( t ) = te 2t
. (5.88)
x2 ( t ) = e 2t
If we compare the solution set in eqn. (5.80) and the solution set in eqn. (5.88), it is
seen that the defective nature of the matrix leads to scaling by t in eqn. (5.88). This
leads to the difference in the trajectory of the solutions as seen in Figures 5.16 and 5.17.
Example # 5.6 Consider a pair of coupled differential equations represented by the
coefficient matrix
 1 1
A=  . (5.89)
 −2 1
The set of corresponding differential equations is

1 (t ) x1 ( t ) + x2 ( t )
'
x=
. (5.90)
x2' ( t ) =
−2 x1 ( t ) + x2 ( t )
The initial conditions are given as
 x1 ( 0 )  1 
  =   . (5.91)
 x2 ( 0 )  0 
First Order Coupled Differential Equations with Constant Coefficients 261

The eigenvalues and eigenvectors of the coefficient matrix are


 i 
  
λ1 =
1− i 2 v1 =
 2
 1 
. (5.92)
 i 
 − 
λ2 =
1 + i 2 v2 =
 2
 1 
Using the eigenvalues and eigenvectors, the solution set becomes

2 t

=x1 ( t )
2
( 2t ) + 22 e c cos ( 2t ) .
e c1 sin t
2
(5.93)
=x2 ( t ) e c cos ( 2t ) − e c sin ( 2t )
t
1
t
2

Applying initial conditions in eqn. (5.91), c1 and c2 are evaluated as

=c1 0=c2 2 . (5.94)


Using eqn. (5.94), the solution set becomes

x1 ( t ) = et cos( 2t )
. (5.95)
x2 ( t ) = − 2e sin ( 2t )
t

A second order differential equation is created as

x1'' ( t ) − 2 x1' ( t ) + 3x1 ( t ) =


0 . (5.96)
The roots of the characteristic equation are

1 + i 2  1 − i 2  . (5.97)
   
The pair of complex roots leads to the solution set as

=
 ( ) ( )
x1 ( t ) et b1 cos 2t − b2 sin 2t 

. (5.98)
x2 ( t ) = ( ) ( )
− 2e b1 sin 2t + b2 cos 2t 
t 
 
Applying initial conditions, the two constants b1 and b2 are evaluated as
=b1 1=
b2 0 . (5.99)
Substituting the values of b1 and b2 is eqn. (5.98), the solution set matching the set
given in eqn. (5.95) is obtained.
262  Differential Equations: A Problem Solving Approach Based on MATLAB

The Laplace transform of the differential equations are


s −1
X1 ( s ) =
s 2 − 2s + 3
. (5.100)
2
X2 (s) = − 2
s − 2s + 3
Taking inverse Laplace transforms of the set in eqn. (5.100), the solution set obtained
matches the set in eqn. (5.95).
The phase portrait associated with the coefficient matrix in eqn. (5.89) is shown
in Figure 5.18 illustrating that the system is unstable.
Example # 5.7 Consider a pair of coupled differential equations represented by the
coefficient matrix
 1 −1
A=  . (5.101)
 −1 1 
The set of differential equations associated with the coefficient matrix is

1 (t ) x1 ( t ) − x2 ( t )
'
x=
. (5.102)
x2' ( t ) =
− x1 ( t ) + x2 ( t )
The initial conditions are given as
 x1 ( 0 )   1 
  =   . (5.103)
 x2 ( 0 )   −1

Figure 5.18  The phase plane plots or gallery of solutions. The directional arrows clearly show that the
solutions are moving away from the critical point, pointing out that the system is unstable.
First Order Coupled Differential Equations with Constant Coefficients 263

The eigenvalues and eigenvectors are

 1
λ1 0=
= v1  
1
. (5.104)
  −1 
λ2 2=
= v2  
 1
Using the eigenvalues and eigenvectors, the solution set becomes
x1 ( t =
) c1 − c2 e2t
. (5.105)
x2 ( t =
) c1 + c2 e2t
Applying the initial conditions in eqn. (5.103), the two constants c1 and c2 can be
evaluated as
c1 = 0 c2 = −1 . (5.106)

The solution set now becomes


x1 ( t ) = e 2t
. (5.107)
x2 ( t ) = −e 2t
The second order differential equation corresponding to the set of differential equations
is
x1'' ( t ) − 2 x1 ( t ) =
0 . (5.108)

The roots of the characteristic equation are 0 and 2 which lead to the solution set in
eqn. (5.107). The Laplace transforms of the differential equations are
1
X1 ( s ) =
s−2
. (5.109)
1
X2 (s) =
2−s
Taking the inverse Laplace transform of the set in eqn. (5.109), the solution set obtained
matches the solution set in eqn. (5.107).
Example # 5.8 It is possible to compare this example to the case of a set of differential
equations represented through the coefficient matrix
0 1 
A=  . (5.110)
0 −3
The eigenvalues are 0 and -3. The gallery of solutions is displayed in Figure 5.20
which shows that the directional arrows point to the critical point demonstrating the
system is asymptotically stable.
264  Differential Equations: A Problem Solving Approach Based on MATLAB

Figure 5.19  The phase plane plots or gallery of solutions. The directional arrows show that the solutions
are straight lines and that they are moving away from a line through critical point, indicating that the
system is unstable.

Figure 5.20  The phase plane plots or gallery of solutions. The directional arrows show that the solutions
are straight lines and are moving towards a line through the critical point indicating that the system is
asymptotically stable.
First Order Coupled Differential Equations with Constant Coefficients 265

Example # 5.9 Consider a pair of coupled differential equations represented by the


coefficient matrix
2 2
A=  . (5.111)
 −2 −2 
The set of differential equations corresponding to the coefficient matrix is
x1' ( t ) 2 x1 ( t ) + 2 x2 ( t )
=
. (5.112)
x2' ( t ) =
−2 x1 ( t ) − 2 x2 ( t )
The initial conditions are
 x1 ( 0 )   −1
  =   . (5.113)
 x2 ( 0 )   −1
The coefficient matrix has a unique set of eigenvalues. They are both equal to 0 and the
coefficient matrix is defective. This means that generalized eigenvectors are required.
The eigenvalues and generalized eigenvectors are

 1 
= λ1 0= v1  
0
. (5.114)
 0
= λ2 0= v2  
1 
Using the generalized eigenvectors and the eigenvalue, the solution set in terms of
two unknown constants c1 and c2 becomes
x1 ( t=
) c1 ( 2t + 1) + 2c2t
. (5.115)
x2 ( t ) =
−2c1t − c2 ( 2t − 1)
Applying the initial conditions and evaluating the unknown constants, the solution
set becomes
x1 ( t ) =−4t − 1
(5.116)
x2 ( t=
) 4t − 1
The second order differential equation is unique and it is given by
x1'' ( t ) = 0 . (5.117)

The roots of the characteristic equation are equal and each is equal to zero leading to
the solution set as
x1 ( t =
) b1 + b2t
b2 . (5.118)
x2 ( t ) =−b1 − b2 t +
2
Applying initial conditions, the values of b1 and b2 are obtained as
b1 =
−1 b2 =
−4 . (5.119)
266  Differential Equations: A Problem Solving Approach Based on MATLAB

Substituting for b1 and b2, the solution set obtained matches the result in eqn. (5.116).
Taking Laplace transforms of the differential equations, the Laplace transforms
are obtained as
−s − 4
X1 ( s ) =
s2
. (5.120)
−s + 4
X2 (s) =
s2
Taking the inverse Laplace transforms, the solution set obtained matches the solution
set in eqn. (5.116).
Example #5.10 Consider a pair of coupled differential equations represented by the
coefficient matrix
 −1 0 
A=  . (5.121)
 −2 −3

Figure 5.21  The phase plane plots or gallery of solutions. The directional arrows clearly show that the
solutions are moving away from a line through the critical point, pointing out that the system is unstable. The
case of a single eigenvalue of zero and double zero eigenvalues can be compared and seen that in the latter
case arrows only point in two directions while in the former case they are moving away in four directions.
First Order Coupled Differential Equations with Constant Coefficients 267

The set of differential equations associated with the coefficient matrix is


x1' ( t ) = − x1 ( t )
. (5.122)
x2' ( t ) =
−2 x1 ( t ) − 3x2 ( t )
The initial conditions are given as
 x1 ( 0 )   −1
  =   . (5.123)
 x2 ( 0 )   1 
The eigenvalues and eigenvectors associated with the coefficient matrix are

 0 
λ1 =
−3 v1 =
 
1 
. (5.124)
  −1
λ2 =
−1 v2 =
 
1
The solutions set using eigenvalues and eigenvectors becomes
x1 ( t ) = −c2 e − t
. (5.125)
2 (t )
x= c1e −3t + c2 e − t
Applying initial conditions, the constants c1 and c2 are evaluated as
=c1 0=c2 1 . (5.126)
Using the values of c1 and c2, the solution set in eqn. (5.125) becomes
x1 ( t ) = −e − t
. (5.127)
x2 ( t ) = e − t
Because the first differential equation in eqn. (5.122) does not contain x2, the second
order differential equation in x2 is created starting from the second differential equation
in eqn. (5.122) as
x2'' ( t ) + 4 x2' ( t ) + 3 x2 ( t ) =
0 . (5.128)
The roots of the characteristic equation are -3 and -1 and a solution set matching the
set in eqn. (5.127) is obtained in this case.
Taking the Laplace transforms of the differential equations, the Laplace transforms
become
−1
X1 ( s ) =
s +1
. (5.129)
1 2 1
X2 (s) = + =
s + 3 ( s + 3)( s + 1) s + 1
Taking inverse Laplace transforms, a solution set matching the set in eqn. (5.127) is
obtained.
268  Differential Equations: A Problem Solving Approach Based on MATLAB

Figure 5.22  The phase plane plots or gallery of solutions. The directional arrows clearly show that
the solutions are moving towards to the critical point and converging pointing out that the system is
asymptotically stable.

5.2.2 First order non-homogeneous systems


A typical first order coupled equations with constant coefficients with external forcing
functions constitute a non-homogeneous system represented in eqn. (5.4). A complete
solution to the non-homogeneous system is written as the sum of the solution to the
 
homogeneous part xh ( t ) and a particular solution x p ( t ) as
   2 
xh ( t ) =c1 X 1 + c2 X 2 =∑ ck X k ( t ) . (5.130)
k =1

  x1 p ( t ) 
xp (t ) =   . (5.131)
 x2 p ( t ) 
  
x ( t ) xh ( t ) + x p ( t ) . (5.132)
=

The particular solutions set can be obtained from the fundamental matrix using the
method of variation of parameters described in in Appendix D as (see eqn. (D. 140)) as

  x1 p ( t )  −1 
x p ( t ) =
=  X ( t ) ∫  X ( t )  g ( t ) dt (5.133)
x
 2p  ( t )
First Order Coupled Differential Equations with Constant Coefficients 269

Note that X(t) is the fundamental matrix defined in eqn. (5.10). If the initial conditions
are given, the unknown coefficients c1 and c2 can be obtained. Given the initial
conditions, the solution can also be obtained using the concept of Laplace and inverse
Laplace transform as

 x1 ( t )   −1  x ( 0 )    
 =L−1 [ sI 2 − A]  1  + L ( g ( t ) )   . (5.134)
 x2 ( t )    x2 ( 0 )   

5.2.2.1 Example of non-homogeneous coupled first order systems


Example # 5.11 Consider a system described through the coefficient matrix A, with
initial conditions and forcing functions given by
 −1 2 
A=  . (5.135)
 −1 1 
  cos ( t ) 
g (t ) =   . (5.136)
t sin ( t ) 
 x1 ( 0 )   2 
  =   . (5.137)
 x2 ( 0 )  1 
The set of coupled differential equations described through eqns. (5.135)–(5.137) is
x1' ( t ) =
− x1 ( t ) + 2 x2 ( t ) + cos ( t ) , x1 ( 0 ) =
2
(5.138)
x2' ( t ) =
− x1 ( t ) + x2 ( t ) + t sin ( t ) , x2 ( 0 ) =
1
The eigenvalues and the eigenvectors of the coefficient matrix A are complex and
are given by

 1 + i 
λ1 =
−i v1 =
 1 
 
. (5.139)
  1 − i 
λ2 i =
= v2  
 1 
The fundamental matrix associated with the coefficient matrix (and the homogeneous
differential equations set) is
  cos ( t ) + sin ( t ) cos ( t ) − sin ( t ) 
X ( t ) =
= X 1 X 2    . (5.140)
 cos ( t ) − sin ( t ) 
The solution to the set of homogeneous differential equations is

   cos ( t ) + sin ( t )  cos ( t ) − sin ( t ) 


xh ( t ) =c1 X 1 + c2 X 2 =c1   + c2  .
(5.141)
 cos ( )   − sin ( t ) 
t
270  Differential Equations: A Problem Solving Approach Based on MATLAB

The particular solution set is obtained using the expression in eqn. (5.133) as
 sin ( t ) t 2 cos ( t ) t cos ( t ) 
 − + 

xp (t ) =  2 2 2  . (5.142)
 sin ( t ) t 2 cos ( t ) t 2 sin ( t ) t cos ( t ) t sin ( t ) 
 − + − − 
 4 4 4 4 4 
The general solution to the non-homogeneous set of differential equation is the sum
of the homogeneous and particular solution sets. Using eqns. (5.141) and (5.142), the
general solution becomes
 sin ( t ) t cos ( t ) 
 x1 ( t )   cos ( t ) + sin ( t )   cos ( t ) − sin ( t )  
+ (1 − t ) 
2 2
  = c1   + c2  + .
 x2 ( t )   cos ( t )   − sin ( t )   sin ( t ) 1 − t + t 2 − t cos ( t ) 1 + t 

 4
( ) 4 ( )
(5.143)
Applying initial conditions to eqn. (5.143), the two constants c1 and c2 are evaluated as
 c1  1
c  = 1 . (5.144)
 2  
Substituting the values of c1 and c2 in eqn. (5.143) and simplifying, the solution set
becomes
sin ( t ) t cos ( t )
x1 ( t ) = 2 cos ( t ) + + (1 − t )
2 2
. (5.145)
sin ( t ) t cos ( t )
( t ) cos ( t ) +
x2=
4
( t 2 − t − 3) −
4
(1 + t )
Incorporating the initial conditions, the Laplace transform of the differential equation
can be performed and the Laplace transform set becomes
   
 2  2 s + 1 +  s + 2  ( s − 1) 
 2 
 ( )   s + 1 
  s2 + 1 2 

 X1 ( s )   s2 + 1 
 =  . (5.146)
 X 2 ( s )   2s 
s 
  + 1 ( s + 1) − 2 −2 
 ( s + 1)
 
2
2 s +1 
  
2

 s +1 
Taking inverse Laplace transforms, the solution set matching the solution set in eqn.
(5.145) is obtained.
Example # 5.12 The coefficient matrix, forcing functions, and initial conditions are
given as
1 2 
A=  . (5.147)
2 1
First Order Coupled Differential Equations with Constant Coefficients 271

  t 
g ( t ) =  − t  . (5.148)
e 
 x1 ( 0 )  1 
  =   . (5.149)
 x2 ( 0 )  0 
The set of coupled homogeneous set of differential equation becomes
x1' ( t ) =x1 ( t ) + 2 x2 ( t ) + t , x1 ( 0 ) =1
. (5.150)
x2' ( t ) = 2 x1 ( t ) + x2 ( t ) + e − t , x2 ( 0 ) = 0
The eigenvalues and eigenvectors of the coefficient matrix are

  −1
λ1 =
−1 v1 =1
 
. (5.151)
 1
λ2 3=
= v2  
1
The fundamental matrix associated with the coefficient matrix (and the homogeneous
differential equations set) is
   −e − t e 3t 
X ( t ) =
= X 1 X 2   − t  . (5.152)
e e 3t 
The solution to the set of homogeneous differential equations is

    −e − t   e 3t 
xh ( t ) =c1 X 1 + c2 X 2 =c1  − t  + c2  3t  . (5.153)
e  e 
The particular solution set is obtained using the expression in eqn. (5.133) as
 t e − t te − t 5 
 − − − 
 3 8 2 9
x p ( t ) =  −t . (5.154)
 te e − t 2t 4 
 − − + 
 2 8 3 9
The general solution to the non-homogeneous set of differential equations is the sum
of the homogeneous and particular solution sets. Using eqns. (5.153) and (5.154), the
general solution becomes
 t e − t te − t 5 
− − − 
 x1 ( t )   −e 
−t
e   3 8
3t
2 9
  = c1  − t  + c2  3t  +  − t . (5.155)
 x2 ( t )  e  e   te − e − 2t + 4 
−t

 
 2 8 3 9
272  Differential Equations: A Problem Solving Approach Based on MATLAB

Applying initial conditions to eqn. (5.149), the two constants c1 and c2 are evaluated as
 −1 
 c1   
=
c   49  . (5.156)
 2  
 72 
Using the constants c1 and c2 in eqn. (5.156), the solution set in eqn. (5.155) becomes
t 7 49 t 5
x1 ( t ) =+ e − t + e3t − e − t −
3 8 72 2 9
. (5.157)
49 3t 9 − t 2t t − t 4
x2 ( t=) e − e − + e +
72 8 3 2 9
The Laplace transform relationship is obtained as
 1 
 2
( s − 1)  2 + 1 
 s 
− − 
 X 1 ( s )   ( s + 1) ( − s + 2s + 3) ( − s + 2s + 3) 
2 2

 =  . (5.158)
 X 2 ( s )  1
2  2 + 1
 
 s  − s −1 
− 
 ( − s + 2 s + 3) ( s + 1) ( − s + 2 s + 3) 
2 2

Taking the inverse Laplace transforms, the solution set matching the set in eqn. (5.157)
is obtained.
Example # 5.13 The coefficient matrix, forcing functions and initial conditions are
given as
 1 0
A=  . (5.159)
 −2 3
  t2 
g ( t ) =  − t  . (5.160)
te 
 x1 ( 0 )  1
  =   . (5.161)
 x2 ( 0 )  1
The set of coupled homogeneous set of differential equation becomes
x1' ( t ) =
x1 ( t ) + t 2 , x1 ( 0 ) =
1
. (5.162)
x2' ( t ) =
−2 x1 ( t ) + 3 x2 ( t ) + te − t , x2 ( 0 ) =
1
The eigenvalues and eigenvectors of the coefficient matrix are

 1
λ1 1=
= v1  
1
. (5.163)
 0 
λ2 3=
= v2  
1 
First Order Coupled Differential Equations with Constant Coefficients 273

The fundamental matrix associated with the coefficient matrix (and the homogeneous
differential equations set) is
   et 0
X ( t ) =
= X 1 X 2   t  . (5.164)
e e 3t 
The solution to the set of homogeneous differential equations is

    et  0
xh ( t ) =c1 X 1 + c2 X 2 =c1  t  + c2  3t  . (5.165)
e  e 
The particular solution set is obtained using the expression in eqn. (5.133) as
 −t 2 − 2t − 2 
   .
x p ( t ) = 16 (5.166)
 − t − 1 e − t − t e − t − 2 t 2 − 52 
 9 16 4 3 27 
The solution set can now be expressed as the sum of the homogeneous and particular
solutions as
 −t 2 − 2t − 2 
 x1 ( t )   et  0  
 =c + c +
 1  t  2  3t   16 1 − t t − t 2 2 52  . (5.167)
x
 2 ( t ) e
  e
  − t − e − e − t − 
 9 16 4 3 27 
Applying initial conditions in eqn. (5.161) to the solution set in eqn. (5.167), the two
constants are obtained as
 3 
 c1   
c  =  5  . (5.168)
 2  −
 432 
Substituting eqn. (5.168) in eqn. (5.167), the solution set becomes
x1 ( t ) = 3et − 2t − t 2 − 2
1 −t 5 3t 16 t 2 52 . (5.169)
x2 ( t ) = 3et −
e − e − t − e−t − t 2 −
16 432 9 4 3 27
The Laplace transform relationship is obtained as
 2 
 +1 
s3
 
 X1 ( s )   s −1 
 =
  1 . (5.170)
 X 2 ( s )  +1 2  
 + 1 
 ( s + 1)
2
3
s
−2   
 s −3
 ( s − 1 )( s − 3) 
Taking the inverse Laplace transform, the solution set matching the set in eqn. (5.169)
is obtained.
274  Differential Equations: A Problem Solving Approach Based on MATLAB

5.2.2.2 Non-homogeneous coupled differential equations with constant


(no time dependence) forcing functions
While the method described above can be used even when the forcing functions
are numbers instead of time dependent entities, in the absence of time dependent
forcing functions, another simple approach exists for solving a pair of coupled non-
homogeneous first order differential equations with constant coefficients. The typical
non-homogeneous differential equation given in eqn. (5.4) is now expressed as
 dx1 

dx  dt   
=  =  Ax + q . (5.171)
dt  dx2 
 dt 
In eqn. (5.171), the forcing function expressed in vectorial form is
 q 
q =  1  . (5.172)
 q2 
The initial conditions are

  x (0) 
x (0) =  1  (5.173)
 x2 ( 0 ) 
While the critical point associated with a pair of coupled first order homogeneous
differential equations with constant coefficient is [0, 0], the critical point associated
with set of the non-homogeneous differential equations in eqn. (5.171) is the solution of

dx   0 
= Ax + q =   . (5.174)
dt 0 
In other words, the critical point is the solution of

  0   
Ax + q =  ⇒ Ax =−q (5.175)
0 
Using simple principles of linear algebra, the critical point becomes

 x10   −1 
−q1 
 = A [ −q ]= A  −q  . (5.176)
−1

 x20   2

In eqn. (5.176), A–1 is the inverse of the matrix A. Note that if q is a null vector,

the critical point will the origin, [0, 0]. But, when q is not a null vector, it is obtained
as [x10, x20]. If α(t) and β(t) denote the departure of x1(t) and x2(t) from their respective
equilibrium values,
( t ) x1 ( t ) − x10
α=
. (5.177)
( t ) x2 ( t ) − x20
β=
First Order Coupled Differential Equations with Constant Coefficients 275

Using eqn. (5.177), the non-homogeneous differential equation set in eqn. (5.171)
can be expressed as
d
α ( t ) + x=  A11 α ( t ) + x10  + A12  β ( t ) + x20  + q1
10 
dt 
. (5.178)
d
 β ( t ) + x=
  A21 α ( t ) + x10  + A22  β ( t ) + x20  + q2
20 
dt
Carrying out the differentiation leads to
d
α ( t ) = A11α ( t ) + A12 β ( t ) + A11 x10 + A12 x20 + q1
dt 
. (5.179)
d
 β ( t ) = A21α ( t ) + A22 β ( t ) + A21 x10 + A22 x20 + q2

dt
Because [x10, x20] is the solution to eqn. (5.175),
A11 x10 + A12 x20 =
−q1
. (5.180)
A21 x10 + A22 x20 =
− q2
Using eqn. (5.180), eqn. (5.179) becomes
d
=α ( t )  A11α ( t ) + A12 β ( t )
dt 
. (5.181)
d
β ( t )  A21α ( t ) + A22 β ( t )
=
dt
It can be seen that eqn. (5.181) is a homogeneous coupled first order system defined
by the same coefficient matrix A. In other words, eqn. (5.181) is the homogeneous
equivalent of the non-homogeneous set given in eqn. (5.171) with a new set of initial
conditions
( 0 ) x1 ( 0 ) − x10
α=
. (5.182)
( 0 ) x2 ( 0 ) − x20
β=
Once eqn. (5.181) is solved for α(t) and β(t) with the initial conditions in eqn. (5.182),
the solution set of the non-homogeneous differential equation set can be written using
eqn. (5.177) as
( t ) α ( t ) + x10
x1=
. (5.183)
( t ) β ( t ) + x20
x2=
It is clear from the discussion above that the approach described here works only
when the coefficient matrix is invertible (determinant of the matrix cannot be zero).
An example is shown now comparing the two approaches to illustrate that the method
described above is rather simple.
Example # 5.14 Consider a non-homogeneous coupled system with the coefficient
matrix, forcing functions and initial conditions are given as
1 1
A=  . (5.184)
 4 1
276  Differential Equations: A Problem Solving Approach Based on MATLAB

 3
g ( t ) =   . (5.185)
4
 x1 ( 0 )   1 
  =   . (5.186)
 x2 ( 0 )   −1
The set of differential equations are
x1' ( t ) = x1 ( t ) + x2 ( t ) + 3, x1 ( 0 ) = 1
(5.187)
x2' ( t ) =
4 x1 ( t ) + x2 ( t ) + 4, x2 ( 0 ) =
−1
The equilibrium or the critical point of the non-homogeneous system is obtained
using eqn. (5.176)
 1

 x10  1 1  −3  3 
−1

=   =      . (5.188)
 x20   4 1  −4   − 8 
 3 
The phase plane plot for the non-homogeneous system and the homogeneous system
are given. They show that the critical point matches the values in eqn. (5.188) for
the non-homogeneous system described by the differential equations in eqn. (5.187).
Using the new critical point, the new initial conditions are
4
α ( 0 )= x1 ( 0 ) − x10=
3
. (5.189)
5
β ( 0 )= x2 ( 0 ) − x20=
3
The equivalent set of homogeneous differential equations is
4
α ' (t ) =α (t ) + β (t ) , α ( 0) =
3
(5.190)
5
β ' ( t ) =+
4α ( t ) β ( t ) , β ( 0 ) =
3
The eigenvalues and eigenvectors of the coefficient matrix are
 1
−  2
λ1 =
−1 v1 =
 
 1  . (5.191)
1
  
λ2 3=
= v2 2
 
1
 
First Order Coupled Differential Equations with Constant Coefficients 277

Figure 5.23  Phase portrait associated with the non-homogeneous system in Example # 5.14. The critical
point is not located at the origin.

Figure 5.24  Phase portrait associated with the modified homogeneous system in Example # 5.14. The
critical point is now at the origin.
278  Differential Equations: A Problem Solving Approach Based on MATLAB

The solution set for the new homogeneous set is


 1 1
α ( t )  −t  −  3t  
=  c e
 1   2 2
2 + c e (5.192)
 β ( t )
 1  1
Applying initial conditions in eqn. (5.189), c1 and c2 become
 1

 c1   2 
c  =   . (5.193)
 2   13 
 6 
The solution set of the equivalent homogeneous set becomes
 1 − t 13 3t 
 1 1  e + e 
α ( t )  1 − 13 4 12
 =− e − t  2  + e 3t 2 =
  . (5.194)
 β ( t ) 2   6    1 −t 13 3t 
 1  1
   − e + + e
 2 6 
The solution set of the non-homogeneous set of differential equations are obtained
using eqn. (5.183) as
 1 − t 13 3t 1 
e + e − 
 x1 ( t )  α ( t )   x10   4 12 3
 =
  +
   =   (5.195)
x (
 2  t ) β ( t ) x
  20   − e − t + e3t − 8 
1 13
 2 6 3 
The non-homogeneous set of differential equations will now be solved using the
standard approach where the particular solution is obtained separately. The fundamental
matrix associated with the coefficient matrix is obtained using the eigenvalues and
eigenvectors in eqn. (5.191)

   e−t e 3t 
= X 1 X 2   2
X ( t ) = 
2  . (5.196)
 −t
 e e3t 
The solution to the set of homogeneous differential equations is

   e−t
  e 3t 
 −
xh ( t ) =b1 X 1 + b2 X 2 =b1  2  + b   . (5.197)
 −t  2  23t 
 e   e 
The particular solution set is obtained using the expression in eqn. (5.133) as
 1
 − 3 
x p ( t ) =   . (5.198)
− 8 
 3 
First Order Coupled Differential Equations with Constant Coefficients 279

The solution set can now be expressed as the sum of the homogeneous and particular
solutions as
 1
 e−t   e 3t   − 
 x1 ( t )  −    3
  = b1  2  + b2  2  +   . (5.199)
x
 2 ( t ) −t 3t  8 
 e   e   − 
 3
Applying the original initial conditions given in eqn. (5.186), the two constants b1
and b2 become
 1

 1   2
b
b  =   . (5.200)
 2   13 
 6 
Substituting b1 and b2 in eqn. (5.199), the solution set of the non-homogeneous set
becomes
 1 − t 13 3t 1 
e + e − 
 x1 ( t )   4 12 3 .
  =   (5.201)
x ( t )
 2  − e + e − 8 
1 − t 13 3 t
 2 6 3 
Notice that the solution sets in eqn. (5.195) and eqn. (5.201). Furthermore, it can be
seen that the particular solution in eqn. (5.198) matches the equilibrium or the critical
point in eqn. (5.188). It should be noted that the approach based on converting the non-
homogeneous system to an equivalent homogeneous system with a new set of initial
conditions works only when the forcing functions are numbers, with the coefficient
matrix being invertible.

5.3 Multiple First Order Coupled Differential Equations of


Constant Coefficients
The concept of the fundamental matrix can be extended to find solutions to a set of
coupled differential equations with constant coefficients. If there are n variables, the
set of differential equations are completely defined by the [n x n] coefficient matrix

A and the [n x 1] vector g ( t ) g(t) consisting of the forcing functions. Equation (5.4)
becomes
 dx1 
 dt 
 
 dx2 
 dt 
  
dx  .   
= = Ax + g ( t ) . (5.202)
dt  . 
 
 dxn −1 
 dt 
 
 dxn 
 dt 
280  Differential Equations: A Problem Solving Approach Based on MATLAB

The initial conditions will consist of another [n x 1] vector


 x1 ( 0 ) 
 
 x2 ( 0 ) 
  x (0) 
x (0) =  3  . (5.203)
 . 
 x ( 0 )
 n −1 
 xn ( 0 ) 
The forcing function also constitute another [n x 1] vector,
 g1 ( t ) 
 
 g2 (t ) 
  g (t ) 
g (t ) =  3  . (5.204)
 . 
 g ( t )
 n −1 
 g n ( t ) 
Even though the forcing functions are represented as functions of t, if the forcing
functions constitute a null vector, the set of equations in eqn. (5.202) becomes a set
of homogeneous first order differential equations. Another important point to be noted
is that it is not necessary for all the elements of the vector in eqn. (5.204) be time
dependent, they may even be constants represented by real numbers.
The procedure for obtaining the solution to a set of non-homogeneous first order
coupled differential equations of constant coefficients is identical to the procedure
used for obtaining the solution in the case of a pair of coupled equations. The solution
is once again written as the sum of the solution to the homogeneous part and the
particular solutions set.

5.3.1 Solution using eigenvalues and eigenvectors


The first step in this procedure is the determination of whether the coefficient matrix
is defective or not. If the matrix is not defective as demonstrated in terms of having n
distinct eigenvectors, the solution to the homogeneous part can be written as
n
 
xh ( t ) = ∑ ck xk ( t ) . (5.205)
k =1

In eqn. (5.205),
  λk t 
k (t )
x= v=
ke X k=
, k 1, 2,..., n . (5.206)

The distinct eigenvectors are represented by vk and the corresponding eigenvalues
are λk . The fundamental matrix associated with the set of differential equations is
  
X ( t ) =  X 1 X 2  X n  . (5.207)
First Order Coupled Differential Equations with Constant Coefficients 281

Depending on the algebraic and geometric multiplicities of the eigenvalues, if


the matrix is deemed to be defective, the solution to the homogeneous part can still
be expressed by eqn. (5.205) with the individual solution vectors represented in terms
of the generalized eigenvectors. This aspect is discussed in detail in Appendix D.
The particular solution is obtained as described in eqn. (5.133). The general
solution can be written as
  
= x ( t ) X ( t ) c + x p ( t ) . (5.208)
 
In eqn. (5.208), x p ( t ) is an [n x 1] vector and c is a vector of size [n x 1] consisting of
unknown constants to be determined by applying the initial conditions. The particular

solution x p ( t ) is obtained using eqn. (5.133) noting that we now have an [n x n]
fundamental matrix and the solution vectors and the forcing functions are of size
[n x 1]. The homogeneous solution set as a vector can be written as
 
xh ( t ) = X ( t ) c . (5.209)
While obtaining the unknown constants is relatively simple in the case of a pair
of coupled first order differential equations, the evaluation of the constants becomes

cumbersome as n goes up. The vector c can be evaluated using the concepts of inverse
of a matrix. Setting t = 0 eqn. (5.208) becomes
  
X (=0 ) c x ( 0 ) − x p ( 0 ) . (5.210)

In eqn. (5.210),
X ( 0 ) = X ( t ) t =0
  (5.211)
xp (0) = xp (t )
t =0

Equation (5.210) can be rewritten as a simple matrix equation (matrix-vector equation)



in terms a new [n x 1] vector xd ( 0 ),
  
xd=( 0 ) x ( 0 ) − x p ( 0 ) . (5.212)

The solution for vector c is given by
 −1 
c =  X ( 0 )  xd ( 0 ) . (5.213)

The power of (-1) on the right hand side of eqn. (5.213) implies the inverse of the

matrix. Once c is substituted in eqn. (5.208), the complete solution is obtained.

5.3.2 Solution using Laplace transforms


With the availability of initial conditions, the complete solution can be obtained in a
way similar to the method adopted for a pair of coupled first order differential equations
in eqn. (5.134) which can be rewritten as



{ −1  
}
x ( t ) =L−1 [ sI n − A] x ( 0 ) + L ( g ( t ) ) . (5.214)
282  Differential Equations: A Problem Solving Approach Based on MATLAB

5.3.3 Examples

Example # 5.15 Consider the coefficient matrix A, initial conditions x ( 0 ) and the

forcing function g ( t ) given by
 0 −1 1 
A =  0 2 0  . (5.215)
 −2 −1 3 

0 
x ( 0 ) = 0  .

(5.216)
1 

1
g ( t ) =  t  .

(5.217)
e − t 
The coupled differential equations can be expressed as
x1' ( t ) =
− x2 ( t ) + x3 ( t ) + 1
x2' ( t ) 2 x2 ( t ) + t
= . (5.218)
x (t ) =
'
3 −2 x1 ( t ) − x2 ( t ) + 3 x3 ( t ) + e −t

The eigenvalues and eigenvectors of the coefficient matrix are


1 
  
= λ1 1= v1 0 
1 
 1

  2
= λ2 2= v2   . (5.219)
1 
 0 
 
1
 2
= λ3 2= v3  
1 
0
 
Even though two of the eigenvalues are equal, eigenvectors associated with these
eigenvalues are distinct and therefore, the coefficient t matrix is not defective. The
fundamental matrix in eqn. (5.207) becomes
 t e 2t e 2t 
e − 
 2 2 
X (t ) =  0 e 2t
0  . (5.220)
 et 0 e 2t 
 
 
First Order Coupled Differential Equations with Constant Coefficients 283

Using a set of unknown constants to be determined, the solutions to the associated


homogeneous set of differential equations become
 et t 
 ( 2c1 − c2 e + c3 e ) 
t

2
   
xh ( t ) X=
= (t ) c  c2 e 2t  (5.221)
 
 e ( c1 + c3 e )
t t

 
Using the method of variation parameters expressed in eqn. (5.133), the particular
solution set is given by

 e−t t 9 
 − − 
 6 2 4 
  t 1 
x p ( t )=  − − . (5.222)
2 4 
 −t 
 e t 7
 − 6 − 2 − 4 
The complete solution is the sum of the homogeneous and particular solutions and
the solutions set is given as

 et e−t t 9 
 ( 2c1 − c2 e + c3 e ) +
t t
− − 
2 6 2 4
  t 1 
= x (t )  c2 e 2t − −  . (5.223)
2 4
 
 e−t t 7 
 e ( c1 + c3 e ) −
t t
− − 
6 2 4
Applying the initial conditions in eqn. (5.216), the unknown constants are
3
 
 c1   2 
1
c = c2    .

= (5.224)
4
 c3  17 
 
12 
Substituting the constants from eqn. (5.224), the solutions set for the differential
equations in eqn. (5.218) becomes
 7 2t 3 t e − t t 9 
 e + e + − − 
12 2 6 2 4
  e 2t t 1 
x (t ) 
= − −  . (5.225)
 4 2 4 
17 2t 3 t e − t t 7 
12 e + 2 e − 6 − 2 − 4 
 
284  Differential Equations: A Problem Solving Approach Based on MATLAB

Based on the relationship of the Laplace transforms and differential equations given
in eqn. (5.214), the Laplace transform of the solution set becomes
 −2 s 3 + 4 s + 1 
− 2 
 s ( s − 1)( s + 1)( s − 2 ) 
  1 
xL ( s ) =   . (5.226)
 s2 ( s − 2) 
 4 3 2

 − − s − 2s + 2s + 3s + 1 
 s 2 ( s − 1)( s + 1)( s − 2 ) 
 
Taking the inverse Laplace transform, the solution set obtained matches the set in
eqn. (5.225).

Example # 5.16 Consider the coefficient matrix A, initial conditions x ( 0 ) and the

forcing function g ( t ) given by
 −1 −1 1 
 −1 2 −1 .
A= (5.227)
 
 −1 1 0 

0 
x ( 0 ) = 1  .

(5.228)
1 

te − t 
  
g ( t ) =  e − t  . (5.229)
 et 
 
The coupled differential equations can be expressed as
x1' ( t ) =
− x1 ( t ) − x2 ( t ) + x3 ( t ) + te − t
x2' ( t ) =
− x1 ( t ) + 2 x2 ( t ) − x3 ( t ) + e − t . (5.230)
x (t ) =
'
3 − x1 ( t ) + x2 ( t ) + e t

The eigenvalues and eigenvectors of the coefficient matrix are


2
  
λ1 =
−1 v1 =
1 
1 
. (5.231)
0
  
λ2,3 1=
= v2 1 
1 
First Order Coupled Differential Equations with Constant Coefficients 285

Equation (5.231) shows that the coefficient matrix is defective because distinct
eigenvectors do not exist for the pair of equal eigenvalues. This requires the generation
 
of generalized eigenvectors (vg 2 and vg 3) for the eigenvalue pair. These can be obtained
using the method described in Appendix D and they are
 1 1

  2  2
= v2   =
λ2,3 1= v3   . (5.232)
1  0
 0  1 
   
The fundamental matrix becomes
 −t et  et
 2e − 
 2  2
  3t   3et t
X
= ( t )  e−t et  + 1  −
 . (5.233)
 2   2
 3et t  3t  
 e−t −e t  − 1  
 2 2  
Using a set of unknown constants to be determined, the solutions to the associated
homogeneous set of differential equations become
 c c 
 2c1e − t − 2 et + 3 et 
2 2
 
   − t c2 t 3c3tet 
xh ( t=
) X () 1
t c
= c e + e ( 3 t + 2 ) − (5.234)
2 2 
 t

 − t 3c2 te c3 t 
 c1e + 2 − 2 e ( 3t − 2 ) 
 
Using the method of variation parameters expressed in eqn. (5.133), the particular
solution set is given by

 e −t
( 2t − e 2t + 2te 2t + 2t 2 + 1) 

 4 





xp (t ) = e −t
( 4t − e 2t
+ 2 te 2t
− 6t 2 2t
e + 2t 2
+ 1) 
 . (5.235)
 8 
 
 − t ( 4t − e + 10te − 6t e + 2t + 5 ) 
2t 2t 2 2t 2

 e 
 8 
286  Differential Equations: A Problem Solving Approach Based on MATLAB

The complete solution is the sum of the homogeneous and particular solutions and
the solutions set is given as

 −t c2 t c3 t
2c1e − e + e + e −t
( 2t − e 2t + 2te 2t + 2t 2 + 1) 

 2 2 4 


 c2 t 3c3te t
( 4t − e 2t
+ 2te 2t
− 6t 2 2t
e + 2t 2
+ 1) 
x ()  1
t
=
(5.236)c e −t
+ e ( 3t + 2 ) − + e −t
.
2 2 8
 
 − t 3c2 tet c3 t ( 4t − e + 10te − 6t e + 2t + 5 ) 
2 t 2 t 2 2 t 2

c1e + 2 − 2 e ( 3t − 2 ) + e
−t

8 
 
Applying the initial conditions in eqn. (5.216), the unknown constants are
1
 
 c1   8 
7
c = c2    .

= (5.237)
8
 c3   
3
 8 
Substituting the constants from eqn. (5.224), the solutions set for the differential
equations in eqn. (5.218) becomes

 e −t
( t − e 2t + 2te 2t + 2t 2 + 1) 

 2 


 ( 2t + 3 e 2t
+ 4te 2t
− 3t 2 2t
e + t 2
+ 1) 
x () 
t = e −t

. (5.238)
4
 
 − t ( 2t + e + 8te − 3t e + t + 3) 
2t 2t 2 2t 2

 e 
 4 
Based on the relationship of the Laplace transforms and differential equations given
in eqn. (5.214), the Laplace transform of the solution set becomes
 
 s3 + 3 
 
( s − 1) ( s + 1)
3 3
 
  − s 5 − 2 s 4 + 2 s 3 + 7 s 2 + 3s + 3 
xL ( s ) =  −  . (5.239)
( s 2 − 1)
3
 
 
 − s 5 − 2 s 4 + 5s 2 + 5s + 5 
 − 
( s 2 − 1)
3
 
Taking the inverse Laplace transforms, the solution set obtained matches the set in
eqn. (5.238).
First Order Coupled Differential Equations with Constant Coefficients 287

Example # 5.17 Consider the coefficient matrix A of size [4 x 4], initial conditions
( ) and the forcing function g ( t ) given by
 −1 0 0 0
 0 −1 0 1 
A= . (5.240)
0 0 1 −1
 
0 0 0 1

0
1

x ( 0 ) =   . (5.241)
1
 
 −1
 et 
 −t 
 te
g ( t ) =  − t  . (5.242)
e 
 
 t 
The set of differential equations associated with the coefficient matrix is
 x1' ( t ) = − x1 ( t ) + et 
 ' −t 

 2( )
x t = − x2( )
t + x 4( )
t + te  . (5.243)
 x3' ( t ) = x3 ( t ) − x4 ( t ) + e − t 
 
4 (t ) x4 ( t ) + t
'
 x= 
The eigenvalues of the matrix are
λ1,2 = 1
. (5.244)
λ3,4 = −1
The difficulties arise because the coefficient matrix only has three eigenvectors,
 0  1   0 
 0   0  1 
 , , 
1  0  0  . (5.245)
     
0 0  0 
There is a need to determine which of the eigenvalues are degenerate so that appropriate
generalized eigenvectors can be created. To find this out, the first step is to determine the
eigenvectors associated with the eigenvalue of 1. These are obtained as the solution of
( A − λ I4 ) =
0 . (5.246)
288  Differential Equations: A Problem Solving Approach Based on MATLAB

There is only a single solution to eqn. (5.246),


0
0

v =   . (5.247)
1 
 
0
Repeating the procedure for the second eigenvalue of -1, the solution consists of two
eigenvectors
1   0 
   
 0 1
v =   ,   . (5.248)
0 0
   
0 0
This means that the eigenvalue of 1 is degenerate and there is a need to find a pair of
generalized eigenvectors associated with this eigenvalue. Using the technique described
in the Appendix D, the generalized eigenvectors are
0
0   
  1
 0   
vg = ,  2  . (5.249)
1   
    0
0   1 
 
Using the eigenvalues and paired eigenvectors, the fundamental matrix becomes
e−t 0 0 0 
 
0 1 t
e−t 0 e
X (t ) =  2  (5.250)
0 0 et −tet 
 
 0 0 0 et 
The solution for the homogeneous set is
 c1e − t 
 
 c e − t + c4 et 
xh ( t ) =  2 2  . (5.251)
 c − c t et 
( 3 4 ) 
 c4 et 
First Order Coupled Differential Equations with Constant Coefficients 289

The particular solutions set is


 et 
 
 2 
2 −t
 t e 
  −t 
x p ( )
t = . (5.252)
 2 −t 
 e 
 −t − 2 − 2 
 
 −t − 1 
Combining the homogeneous and particular solutions, the general solution becomes
 et 
 c1e − t + 
 2 
 − t c4 t t 2 e − t 
 ce + e + −t 
x (t ) =  2 2 2 . (5.253)
 −t

 e 
( c3 − c4 t ) e − t − 2 − 2 
t

 
 c4 et − t − 1 
Applying initial conditions, the constants become
 1
 c1  − 2 
   
 c2   1 
=c =  7  . (5.254)
 c3 
   
c4   2 
 0 
The solutions set now becomes
 sinh ( t ) 
 2 −t 
 e−t + t e − t 
  2 
x (t ) =  −t  . (5.255)
7
 e −t − e
t
− 2
2 2 
 − t − 1 
 
290  Differential Equations: A Problem Solving Approach Based on MATLAB

The Laplace transforms become


 1 
 s2 −1 
 
 1 + 1 − 1
 s + 1 ( s + 1)3 s 2 
X (s) =  3 
 s + 3s 2 + 2 s + 1  . (5.256)
 
 s 2 ( s 2 − 1) 
 
 s +1 
− 2
 s 
Taking the inverse Laplace transforms, the solution set matching to the one in eqn.
(5.255) is obtained.
Example # 5.18 Consider the coefficient matrix A of size [4 x 4], initial conditions
 
x ( 0 ) and the forcing function g ( t ) given by

1 0 0 0
0 1 0 0
A=  . (5.257)
 1 4 −3 0 
 
 −1 −2 0 −3
1
1

x (0) =   . (5.258)
1
 
 −1
 e −3t 
 3t 
 te
g ( t ) =  t  . (5.259)
 e 
 t

t + e 
The set of differential equations associated with the coefficient matrix is

1 (t ) x1 ( t ) + e −3t
 x= '

 
2 (t ) x2 ( t ) + te
' 3t
 x= 
 x3' ( t ) =x1 ( t ) + 4 x2 ( t ) − 3 x3 ( t ) + et  . (5.260)
 ' 
 x4 ( t ) =− x1 ( t ) − 2 x2 ( t ) − 3 x4 ( t ) + t + e 
t

The eigenvalues of the matrix are


λ1,2 = −3
. (5.261)
λ3,4 = −1
First Order Coupled Differential Equations with Constant Coefficients 291

The matrix is not defective because four distinct eigenvectors exist. These are
0  0   −4   −8
0 0  2   2 
  ,   ,   ,   . (5.262)
1   0   1   0 
       
 0  1   0   1 
The first two eigenvectors are associated with the eigenvalue of -3 and the other two
are associated with the eigenvalue of 1. Using the eigenvalues and paired eigenvectors,
the fundamental matrix becomes
 0 0 −4et −8et 
 
0 0 2et 2e t 
X ( t ) =  −3t (5.263)
e 0 et 0 
 −3t

 0 e 0 et 
The solution for the homogeneous set is
 −4et ( c3 + 2c4 ) 
 
  2et ( c3 + c4 ) 
xh ( t ) = . (5.264)
 c3 et + c1e −3t 
 t −3t

 c4 e + c2 e 
The particular solutions set is

 e −3t 
 − 
 4 
 e 3t 
 ( 2t − 1) 
 4
x p ( t ) =  −3t  . (5.265)
 e 
 − 144 ( 36t − 36e + 32e − 48te + 9 ) 
4t 6t 6t

 −3t

 t e e3t et te −3t te3t 1 
 3 + 16 + 9 + 4 + 4 − 6 − 9 
Combining the homogeneous and particular solutions, the general solution becomes

 e −3t 
 − 4 e t
( c3 + 2c4 ) − 
 4 
3t
 e 
 2e ( c3 + c4 ) +
t
( 2t − 1) 
 4
x (t ) =  −3t
 . (5.266)
 t e 
c3 e + c1e − 144 ( 36t − 36e + 32e − 48te + 9 ) 
−3t 4t 6t 6t

 
 t −3t t e −3t e3t et te −3t te3t 1 
 c4 e + c2 e + 3 + 16 + 9 + 4 + 4 − 6 − 9 
292  Differential Equations: A Problem Solving Approach Based on MATLAB

Applying initial conditions, the constants become


 19 
 − 36 
 
 c1   3 
c   − 
 8 .
= c = 2
  (5.267)
 c3   25 
  
c4  16 
 15 
− 
 16 
The solutions set now becomes
 5 t 1 −3t 
 e − e 
4 4
 3t

 5 t e 
 e + ( 2t − 1) 
 4 4
x ( t ) =  −3t  . (5.268)
− e 
 144 ( 36t − 261e + 32e − 48te + 85 ) 
4t 6t 6t

 −3t 3t t −3t 3t

 t − 5e + e − 11e + te − te − 1 
 3 16 9 16 4 6 9 
The Laplace transforms become
 5 1 
 − 
4 ( s − 1) 4 ( s + 3)
 
 ( s − 3) + 1
2 
 
( s − 1)( s − 3)
2
 
X (s) =   . (5.269)
 s 4 + 2 s 3 − 23s 2 − 20 s + 156 
 
( s − 1) ( s − 9 )
2 2
 
 6 5 4 3 2 
 − s − 2 s − 12 s + 18s + 48s − 36 s + 27 
 
s 2 ( s − 1) ( s 2 − 9 )
2
 
Taking the inverse Laplace transforms, the solution set matching the one in eqn.
(5.268) is obtained.
Example # 5.19 Consider the coefficient matrix A of size [4 x 4], initial conditions
 
x ( 0 ) and the forcing function g ( t ) given by

 −1 −4 0 0
1 3 0 0 
A= . (5.270)
1 2 1 0
 
0 1 0 1
First Order Coupled Differential Equations with Constant Coefficients 293

1
 −1

x ( 0 ) =   . (5.271)
1
 
 −1
 et 
 t 
 te
g ( )  2 −t  .
t = (5.272)
t e
 
 4 
The set of differential equations associated with the coefficient matrix is
 x1' ( t ) = − x1 ( t ) − 4 x2 ( t ) + et 
 
 x2 ( t ) =x1 ( t ) + 3 x2 ( t ) + te
' t

 x3' ( t ) = x1 ( t ) + 2 x2 ( t ) + x3 ( t ) + t 2 e − t  . (5.273)
 
 x4' ( t ) = x2 ( t ) + x4 ( t ) + 4 
The eigenvalues of the matrix are
λ1,2,3,4 = 1 . (5.274)
The matrix is defective because only two distinct eigenvectors exist,
0  0 
0  0 
 ,  (5.275)
1   0 
   
 0  1 
Because all the eigenvalues are equal and the matrix is defective, this case can be
treated as an example of a defective matrix with algebraic multiplicity of 4. The four
generalized eigenvectors in this case constitute an identity matrix of size 4 and these
eigenvectors are
1   0   0   0 
 0  1   0   0 
  ,   ,   ,   . (5.276)
 0   0  1   0 
       
 0   0   0  1 
Using the eigenvalues and generalized eigenvectors, the fundamental matrix becomes
 −et ( 2t − 1) −4tet 0 0
 
 te t
e ( 2t + 1) 0
t
0
X (t ) =  te t
2tet et 0 (5.277)
 2 t

 t e 
 et ( t 2 + t ) 0 et 
2 
294  Differential Equations: A Problem Solving Approach Based on MATLAB

The solution for the homogeneous set is


 −et ( 2c1t − c1 + 4c2 t ) 
 
 e ( c2 + c1t + 2c2 t )
t


xh ( t ) =  et ( c3 + c1t + 2c2 t )  . (5.278)
 
 et ( 2c4 + 2c2 t + c1t 2 + 2c2 t 2 ) 
 
 2 
The particular solutions set is
 tet ( 2t 2 + 3t − 3) 
 − 
 3 
 t 2 et 

 ( t + 3) 
xp (t ) =  3  . (5.279)
 e−t 
− ( 6t − 6t e − 4t e + 6t + 3) 
2 2t 3 2t 2

 12 
 t 3 et t 4 et 
 + −4 
 3 12 
Combining the homogeneous and particular solutions, the general solution becomes
 tet ( 2t 2 + 3t − 3) 
 −et ( 2c1t − c1 + 4c2 t ) − 
 3 
 2 t
t e 
 et ( c2 + c1t + 2c2 t ) + ( t + 1) 
  3 
x () 
t = −t  . (5.280)
e
 et ( c3 + c1t + 2c2 t ) −
12
( 6t − 6 t 2 2t
e − 4t 3 2t
e + 6t 2
+ 3 )
 
 et ( 2c4 + 2c2 t + c1t 2 + 2c2 t 2 ) t 3 et t 4 et 
 + + −4 
 2 3 12 
Applying initial conditions, the constants become
1
 c1   −1
   
 c2 
=c =  5  . (5.281)
 c3   
  4
c4 
 3 
First Order Coupled Differential Equations with Constant Coefficients 295

The solutions set now becomes


 et ( −2t 3 − 3t 2 + 9t + 3) 
 
 3 
 et ( −t 3 − 3t 2 + 3t + 3) 
 − 

x (t ) =  3  . (5.282)
 −t 
e
−
 12
( 6t − 15e2t + 12te2t − 6t 2 e2t − 4t 3e2t + 6t 2 + 3)
 
 t 2 et t 3 et t 4 et 
3et − + + − tet − 4
 2 3 12 
The Laplace transforms become
 s ( s 2 − 5) 
 
( s − 1)
4
 
 
 s ( − s 2 + 2 s + 1) 
 
( s − 1)
4
X (s) =   . (5.283)
 6 5 4 3 2 
 s − s − 3 s + 8 s + 5 s + 9 s − 3 
 ( s − 1) ( s + 1)
4 3

 
 s 5 − 7 s 4 + 20 s 3 − 29 s 2 + 17 s − 4 
− 
s ( s − 1)
5
 
Taking the inverse Laplace transforms, the solution set matching to the one in eqn.
(5.282) is obtained.

5.4 Numerical Solutions
It is clear that as the size of the coefficient matrix increases, the complexity involved in
obtaining the solutions using eigenvalues and eigenvectors increases because defective
matrices require detailed exploration to identify the degenerate eigenvalues and obtain
the appropriate set of generalized eigenvectors. On the other hand, the approach based
on Laplace transforms is clear, straightforward and formulaic and therefore, it can
be implemented easily. In addition to these analytical approaches, it is also possible
to use the Runge-Kutta methods for the numerical evaluation of the solutions. The
use of numerical approaches also permits another level of verification of the results.
296  Differential Equations: A Problem Solving Approach Based on MATLAB

Example # 5.20 An example of a 3 x 3 coefficient matrix and the set of coupled first
order differential equations is now presented. Consider the coefficient matrix A, initial
 
conditions x ( 0 ) and the forcing function g ( t ) given by

 2 −1 −1
 −1 2 −1 .
A= (5.284)
 
 −1 −1 2 

0
x ( 0 ) =  −1 .

(5.285)
 1 

t 
g ( t ) = t 2  .

(5.286)
et 
The coupled differential equations can be expressed as
x1' ( t ) = 2 x1 ( t ) − x2 ( t ) − x3 ( t ) + t
x2' ( t ) =
− x1 ( t ) + 2 x2 ( t ) − x3 ( t ) + t 2 . (5.287)
x (t ) =
'
3 − x1 ( t ) − x2 ( t ) + 2 x3 ( t ) + e t

The approach based on Laplace transform is used to get the analytical solutions and
the numerical solutions are obtained using ode45 in MATLAB. The MATLAB script
and results are given.
function example_numerical_firstorder_multiple
% June 2017 p m shankar solve a coupled system using Laplace transforms and
% compare the results to those obtained numerically
close all
A=[2,-1,-1;-1,2,-1;-1,-1,2]; % coefficient matrix
xx0=[0; -1; 1];% initial conditions
syms t s;
ft={t;t^2;exp(t)}; % forcing functions
B=(s*eye(3)-sym(A)); % this sI-A
F=laplace(ft,t,s); % Laplace transforms of forcing functions
W=inv(B)*(F+xx0); % Laplace transforms
w=simplify(ilaplace(W,s,t),‘steps’,100); % inverse Laplac: solution set
% create inline MATLAB functions for the analytical solutions
fy1=MATLABFunction(w(1,1));
fy2=MATLABFunction(w(2,1));
fy3=MATLABFunction(w(3,1));
tspan=[0 5]; % time span for numerical integration
[tt,yy]=ode45(@examplef,tspan,xx0);
plot(tt,fy1(tt),‘r’,tt,yy(:,1),‘r*’,tt,fy2(tt),‘k’,tt,yy(:,2),‘ko’,...
tt,fy3(tt),‘b’,tt,yy(:,3),‘bs’,‘linewidth’,1.5)
First Order Coupled Differential Equations with Constant Coefficients 297

xlabel(‘time t’),ylabel(‘solutions’)
legend(‘x_1(t)-analyt’,‘x_1(t)-ode’,‘x_2(t)-analyt’,‘x_2(t)-ode’,...
‘x_3(t)-analyt’,‘x_3(t)-ode’,‘location’,‘southwest’)
syms x_1(t) x_2(t) x_3(t)
% for solution display on the plot
yt1=[x_1(t)==w(1,1)];
yt2=[x_2(t)==w(2,1)];
yt3=[x_3(t)==w(3,1)];
text(0.5,4e6,[‘$’ latex(yt1) ‘$’],’interpreter’,‘latex’,...
‘fontsize’,16,‘color’,‘b’,’‘fontweight’,‘bold’)
text(0.5,3e6,[‘$’ latex(yt2) ‘$’],‘interpreter’,‘latex’,...
‘fontsize’,16,‘color’,‘b’,‘fontweight’,‘bold’)
text(0.5,2e6,[‘$’ latex(yt3) ‘$’],‘interpreter’,‘latex’,...
‘fontsize’,16,‘color’,‘b’,‘fontweight’,‘bold’)
end
function dydt = examplef(t,y)
dydt=zeros(3,1);
dydt(1,1)=t + 2*y(1,1) - y(2,1) - y(3,1);
dydt(2,1)= -y(1,1)+2*y(2,1) - y(3,1)+t^2;
dydt(3,1)=exp(t) -y(1,1) - y(2,1)+2*y(3,1);
end
298  Differential Equations: A Problem Solving Approach Based on MATLAB

5.5 Examples
Part 1 A pair of first order equations
Starting with the theoretical descriptions of the methods for solving the pair of
equations. The MATLAB script displays the following:
1. The summary of all the theoretical methods used are shown first. The methods
are based on the use of eigenvectors and eigenvalues (including the case when
the coefficient matrix is defective), conversion into a second order homogeneous
equation of constant coefficients and the Laplace transforms.
2. The phase plane plot is shown with the eigenvalues and the state of equilibrium.
3. The mechanics of forming the solution using the eigenvalues and eigenvectors
are illustrated next. The results contain the eigenvalues (indications when they
form a complex conjugate pair) and, eigenvectors (the need for generalized
eigenvectors if the matrix is defective).
4. The general solution is shown and the unknown constants are evaluated based
on the initial conditions.
5. The approach based on Laplace transforms is presented next along with the
transforms of the two solutions and the solution.
6. The solution obtained directly using MATLAB command dsolve(.) is also shown.
7. The numerically obtained solution is obtained and compared to the analytical
solution in plots.
8. The set of first order equations is converted to the second order equation and is
shown with the roots of the characteristic equation (same as the eigenvalues) and
the solution is derived, constants evaluated, one of the solutions is determined
first and using the input set, the second solution is extracted. The display also
indicates whether x(t) or y(t) was obtained first. If the two differential equations
are independent, dx/dt=ax and dy/dt=by, a statement indicates that the equations
are not coupled.

Example # 5.21
A=[1,2,3,2,1,0];
First Order Coupled Differential Equations with Constant Coefficients 299

Characteristic
300  Differential Equations: A Problem Solving Approach Based on MATLAB

( '?-" -' )
c,+oa_ O

x, ( l..
)

.
• ' ( l"'+~)
I
...(), .. h' j'" 'I
Solutions (Inv..... Lllplaoo,dsolv.(.) & Ru nge-KutlJl)

,~ i---,=::;:C'il
.-
"
...
~
,~
-+-~ -+-~

- ,~
-+-<
~1000
-+-,

" ~

.. , ~ , ~,
~

•• •• •• ,
lime , limet
First Order Coupled Differential Equations with Constant Coefficients 301

Example # 5.22
A=[-1,0,-2,-3,-1,1];

Characteristic
302  Differential Equations: A Problem Solving Approach Based on MATLAB

( r(I) .. - .ail) )
"(I)_ - b(I) -3,(1)

• E...._4 11.. (=!) _ ... "* .....


PI:_,., '....
, ,I ,I I
0'1. ..,STAIIlE_

• , , ,
, ,I ii ~I
, ,
,
,- , ,
, I I

-,
~, I
• ,
I , I
,
I

, I I
I
,, I

-
I
, , ,
fi1t I
1 1 , ,

• , ,
• ·OJ
• •
e-pIOliO ... _ , , .. , of f lrol 0nS0r Uroe .. O_nII.. E q _

......" ( - ' 0 ) ~w (
-!AI -2 - 3 E.,...,.. VI') r(I)
_ -2":r(I)
- z(l)
_ 3V(I)
)
IC
(-')
I
Iigt_...,..
......,
ReIl.<'II:I \IIOllnd ......... ,
E;,oo" ' • (' ) (: -,')
-.-,-, )

--
--
...... -
,,(1) _ q ,,-,

( '"-.--,
+ '" ,,~..
)
--
+.,, _ 1
:r.(I) _ -e~ '

,-"."--~..
~ ...,. ,,(I) _,,-<
First Order Coupled Differential Equations with Constant Coefficients 303

SoIUIIons (Inv ...... Lapl_.dIoIw(.) & Runga-KuttlI )


Loplac:ellMiform XL(.} = - .!,
/n)mDitlerlltJlilll EqnS )' ,
Yd- = 'Oi3 + (>+1)(.+3)
Solution"", zdt) = -e ~ '
IIdt) = e-'
"'J(t) - - e-'
~ t) _ a-'

',----;::=.~

.-
-~M

-.-~
-.-<

., , , ,, ,
05
....,
1 15 05
.,.,
1 1.5

2... ......r Dlfferentl.! Equation baed ...lutlon Nt

( ~'
-2 - 3
0) E"*",,,"
M_~ ( ,,(» - ~.{ .)
11'(1) _ _ 2:«t) _ 3y{IJ
)
Ie
(-.)
I

A" _ 0 .. Create Equation in y .. a ;"(lj + bi(t) +.,,(t) _ 0


E<J.iH_ ~ cwdor DE LoI 1 _ of ,,,- o....,,,,jMjo Equll ....
('( t) + 4 11'(1) + 3 !/Ct) _ 0 ( -3 -I )

GonotII SoIuIOn in *"'"


(0 I)

:r,(t) = - e-'
y,(I) :e- '
304  Differential Equations: A Problem Solving Approach Based on MATLAB

Example # 5.23
A=[0,1,0,-2,0,1];

Characteristic
First Order Coupled Differential Equations with Constant Coefficients 305

~ .. 'aI.~ i6: Pol, of """" 0Ner LIM. 0.,......... !qLiI6!,'"

e'm .... ( '0 -' 2 ) ~w ( ~(') - ,(1) )


_~ E...- "(1) - - 2 ,(, )
ANI_"'_.,.._" .......-.
EigoIo<_ C~) (~2) ( .J (: ~I)
- ..
[.t'. g.J (<<11._ )
('0 -'i ) e- '

GoMoll '".(' ) - CJ - T•

---- '[ :]-(1)


-".• ...
........
".(/) -1- r.;
-~
~-'- ,.(1) ... _tr

zdl) -~-~
~dl ) "'e- 2 !

-..
"4 (' ) -
",(,)
t - .y.
-"
.0 r------;~;~J
- "
~"" -+-d

.- ".,
~.

, ,
011
....,
1 1..5 0..5
.... ,
1 U
306  Differential Equations: A Problem Solving Approach Based on MATLAB

Example # 5.24
A=[1,-1,-1,1,1,-1];

Characteristic
First Order Coupled Differential Equations with Constant Coefficients 307

( :r(f) _ r(t) - ~(t) )


V(t) .. ~(t) _ zIt)

• Ei(jono_I A) .. (~ )
Or-. eIg ........
UNSTAelE
z... _11>0 _ ....


,
"
,,' ' , ",
,, , ", ", ,
,
,
,

,
, , ,
~o
", , , ,
", , , , ""-
., ,
,
, , ,
""-
"-
"-
• , ,
,

"
"-
"- , ,"
,,"-
.•., , • •
~" (' - ') ~W (:r(t)"Z(t) _ ~(t»)
_I... -1 I E~ I/"(t) - !/I:t)-r(t) <( ")

E..........
~)
(6)
(: ~' )

",.(t) .. c,-qe"
!Io(t) - c, + qe"

· [~l - ( -o) )
r .(t) _ .I'
,..(t) _ -e"
308  Differential Equations: A Problem Solving Approach Based on MATLAB

--
__ La,....,. %, (1) _ etl

--
~~ ,)
¥t(t ) - -el'
2:01(1) - c"
...ell -_"
,
~
- M .
-" -
~
-+-4 ~
-+-~
~.

~ • ~"

~ ~

,, , , ~
, , ,
" ."., " " ."" "
2" order Oltr.l .. ,U" Equ.uon - . . ...Iutlon ut

'""'"" ( ' - ' ) DitlMWlW (:<'(1) _ ,, (1)_,(1») ( , )


MIltiJcI~ -1 1 ~ V( l j-r(l)-z{ lj IC _\

.4 " " 0... ea-te Equatlo" In x ... ""'{I} + "'(I} + cr(l ) _ 0


E.......... 2"" _rOE... AoOIO "'1hOa..... lOriolit~
:r"'(I) _ 2>:'(1 ) _ 0 (0 2 )

%1(t ) - ~ + b,c"
,,(1) _ .. - 6,."

- .. ~-
Ib,.,:!' "
%,(1) _ ';"
(. I)

¥I (t ) _ -fIl'
For the remaining examples, the first display containing the theoretical aspects is not
shown.
First Order Coupled Differential Equations with Constant Coefficients 309

Example # 5.25
A=[1,-1,-1,-1,0,1];
310  Differential Equations: A Problem Solving Approach Based on MATLAB

SolutlGo.. llm'_lapI_,dIooI...(.I & Au~1ItUI1


~_ XL(_) --;q
_DiIIor_~ YL{') _ 5:\

--
----
-0
~. , ~-


~

~.

~

;;.-~.

I
, ,
• 0
" ....
• "
2" O<'dIo.DI"", .. ,UIII EqullllDn _
0
0
" ....
• "
d ...1uIIoro MIl

~.( '
_I.of -1 - 1
- ')~_( ""(1) _ ,,(1)_,(1» )
E...... V(I) - -,,(I)-,(t) IC
(OJ
1

A .. " 0 .. Creal e EquAt ion in x .. ar"(I) + hI(l ) + u (l) _ 0


_ '" IhIo 000 _ _ eq_
E~_2"_0I: In x
:or"( I )_2~1)_O (..., -,Ii)

~_In_

z, (t) _ ~ .A' + ~ .- ... ,


cofw_w_,.b,.b• ,.(1) - . _A . (100 +.", .. + .. .. ,.,. _ "" ... e·.,If·)

• •."" ( -f f)
"'L (t) - -~
1tL (t ) ,., .-.10 ( ';"'-:,."'" ~.., ••)
First Order Coupled Differential Equations with Constant Coefficients 311

Example # 5.26
A=[-1,2,-1,1,2,1];
312  Differential Equations: A Problem Solving Approach Based on MATLAB

.,Lil) .. 2 COA(I)
'L(t ),., COA(I) - sin( l)
",,(I) .. 2 000(1)

, ,,(1) .. v"i ""'(I + il

. ...,
o
'---------'
0.5 1 1.5 2

2"" order OI"..."U. Equetlon bMed eoludon HI

CII_ IOI ( - ' ') ~. ( "'(1 ) - 2r11)- "( 1» ) ( ' )


MMrt.(AI - \ 1 Eq.JIIliono V(I) .. ,(I) _ 0:(1) IC 1

AI! '" 0 .. er..te £qualion in x .. .,.."(1 ) + ~ (I) + a(I) .. 0


e._2"" ....... DE .. .
~(t) + .,(t) .. 0

",.,-";" - ";" - ";" -";"


0:,(1) .. b, cue';) - 60, .1a(1)

p>,.to,l .. (2 0)

.,, (1) .. 2 coo( l)


111 (1) .. .J2 oos{t + i)
First Order Coupled Differential Equations with Constant Coefficients 313

Example # 5.27
A=[-3,1,-4,2,-1,1];
314  Differential Equations: A Problem Solving Approach Based on MATLAB

---
110m Dir...."... e"",
Xt(_) .. . I .~t - ..~::t
Yt (.j .. ..f.:t + ,,'2,
--
,....... La..,.
!Set,.: ,'"
" - if'
zdl) " T - ---r
lIdl) ..
~(I )-If-¥
If "'"
~-..c .)
.,.,(Il-¥-¥
• »I-r~,.;:;
-.-,.

Ii'
,
-j; "

10
.-
~.

,~ ,
, M
...,, u , , 0.5

2"" ora. DIffer.n1I., Equation baNd .., Iutlon HI


..., 1 1..5 ,

~.(-3
-IAI - 4
')
2
~_~( z'(t) _ ~(t) _ b( t»)
E~_ V(t) .. 2,(1) _ b (l ) IC
(_')
I

A" .,. 0 " Oeate Eq..atlon In" .. <1%"(1) + 1u'(1) + =(1) .. 0


E"",,,_ 2"" ....., Ill! 10 • _ 01 tt. a.,.,_ic 61_
%"'(, ) + r(l ) _ 2.,(1) .. 0 (-2 I 1

z, (I)" "'~ + '" e""


+.,
,,(1) .. . II, e' . - 11

lb, .""I _ (-Ill


zl(l)-Jf-~
)'I(t) .. If - U;
First Order Coupled Differential Equations with Constant Coefficients 315

Example # 5.28
A=[1,0,-2,1,1,0];
316  Differential Equations: A Problem Solving Approach Based on MATLAB

Example # 5.29
A=[0,1,-1,-2,1,-1];
( .'(.,- ,
~(I) '"
•.
First Order Coupled Differential Equations with Constant Coefficients 317

-:1(1) - 2,(1)
EopI .... _ _
)

, ,
• (.....-Clj.. ( : : )

,
QJ.Pl:ITABU_

• , ,
, , ,
- , ,\ ~ ~\
\
, \ \
\
\
\ \
, , \ \
j;o
\
\

,
~ ~ \ ,
-
\
\

,, ,, ,
,
\

, ,
, ,
\ \
\

\
,
,
,


• . •., , • •
Complollt'''_ P... ol'l. . o.do<u.. .. Orw. ..... fq ...........

=111 (~l ~2)::"-= ( V(I) ::(~z7Ir:)2p(t» ) Ie ( ~l )


.. (AI"' t\cl""",I"", aoI¥e IA - ,U,]li! _ 0 to..,t """",.Jiuld cigelM!CWr'

E""_lll (:: ) ~.;. (iI) (~~)


(C<+ ... )

__ ("-'(t+ l) Ie.... )
[go .t', I (_-I -I e-' -<I- I (t - I )

ow.. :r,(I)_q t e-'+ea"-' (1+ 1)

-...
w,(t) ... -co , ,,-' - ,,>11- ' (I - I )

-~.
.... ( ",<,__
a 'I ) -[~J- (~,)
318  Differential Equations: A Problem Solving Approach Based on MATLAB

SoI"II..ns Onv_ UpI_,dIoI'<'II(.)& RungoH(utta )

"'ttl) '" e-<


,dt) .. -e-<
~(IJ" e-'
M I) - -e""'

•• 0.5
....
1 1.!i , .• ....
- 0.5 1.!i ,

2" order Dwr.r.ntI" Equlllon ~d ...1uIIon HI

~"('
MMIb;[AI - I • )~_w(
-2 E__ V{I) 0'
.. ,-z{l
., -""
) _ 2 ~I) ) IC_
('L)
A""O . Croue EquaLionin~ . J (I) +I>i{I)+cz(I) _ O
E~ 2'" _ . DE In . _dlNo. ... _ E q . -
z'"(I) + 2z'(1) + z {t) .. 0 ( _L _ I )

:r-, (I) - e-' (... + 10,,1)


,,(t ) _ _ -' (.. - .. + "')

"PIII\<""'" Co< ?I • 1b,.I>:tI" ( I 0 1


e-'
", ,{t) ..
111(1) = -e-'
First Order Coupled Differential Equations with Constant Coefficients 319

Example # 5.30
A=[2,0,0,2,1,1];
320  Differential Equations: A Problem Solving Approach Based on MATLAB

SoIuIIoM (low .... LapI_.dtoI"".) " Runge,.KUItI )


........ 1IOn_ Xd' ) · ;!t
Yd . ) -;!t

--
lramDil._otIoIf:.,.

z d l ) • tI,

--
-~-

--,
, d' )-e"
%J(I) '" <I'
l1li1 ) ... <I'

.-
~
-M -~

-
~
-+-d ~
-+--
~.


~

»
• ~
»

,, ,,
,
" .... , "
, ,
" ,"
,
...
2:" ordotr DlfhAntlll EqUlll10n INIMd .olutlon Nt

~.
Mlir\o tAl un ~ ... ( r(l ) _ b (l ) )
EquIIlont 11'(1) '" 2~ 1) ·(:l
" 12"":2,"0 .. No E........ nt 2"" _ , ..... ntiol E()'t; E"' ...... _ .... , .........
""Iof..,,1or1t Fill' 0rII0, DiIIorontlll E"'......
"1 (1) "' '' " .
10>(1)- " '"
( I I)
First Order Coupled Differential Equations with Constant Coefficients 321

Example # 5.31
A=[2,2,-2,-2,-1,-1];
322  Differential Equations: A Problem Solving Approach Based on MATLAB

zt!I) - -<4I 1 - 1
~dl )- 41 - 1
z.(I) _ - 41 - I
111<1)_ 41 _ 1

,·r---------r==e.;cill

•J
-.
~~

1c.'-.,.,"
1. . . . . . . . .

0.5
...,
1 1.5 ,

2"" 0<,., 0 ",-",..,1111 Equlltlon baed ... Iutlon Nt

~. ( ' ' ) ~~ ( z'(1)_ 2z(I) +2 ,11) ) ( _' )


_I"'l -2 -2 E~ ,..(1) _ - h (l ) _ 2,(1) IC - I

All" 0 .. 0.:.. .. Equal"';11 x .. .u"(I) + W II) +C%(I) _ 0


E~ 2"" - . til: ~ ~ _ . . . . O"it ... lIIic ~
:."(1) _ 0 (. 0 J
r, (I) - "' +"' ,
,,(1) -.-~ - 1o, 1

(-1- 4 )
ZI(I) __ 41 _ 1
1/1(1)_ <411 _ 1
First Order Coupled Differential Equations with Constant Coefficients 323

Example # 5.32
A=[1,1,-2,1,1,0];
324  Differential Equations: A Problem Solving Approach Based on MATLAB

---
""'" cw:.. ..... ~ YL(_l -
x.(., .
L
,-1
"'_ hU
.d .+l
e' ooe{ .,./21)
:l"i.(I) _

--
'*"II """"'"I .)
IIdt) - - ./'ie' .m(v'2I)
,...(t) _ " ""(~ I)
1/.(1) - - ..12..' ,.; n( "" , )

2""' ..... DI" .....II. Equltlon IMMd ..,lutIon ut


"""""
~ I~
( _' 2 'I ) E,._
~w ( V(I)
:ret)_- ~j
z{I) +
) _ 2",(1)
,(I») IC
(0, )
A"" 0 .. c-u, Equation in x .. """{I) + Wet) +(:10(1) _ 0
E""_ DE
2"" ....., in x
Z"'{I) - 2:1"(1) + het) _ 0
_ afl/loo.. _ _ _ £q.-t""

( I+ Ji' 1_,,1; , )

%J(ll _.t (~ ... (JlI) - ., .in(~f))


,,(t) _ - ./'1<1 (., Co.("") +.,
aia(./'il»
lb,.t>z) - ( I ' )
z,{t ) .. ~ COI(../2 t)
WI(t) .. - ../2f1 al n(../2 I)
First Order Coupled Differential Equations with Constant Coefficients 325

Part 2 A pair of coupled first order non-homogeneous equations


Example # 5.33
abc=[1,1,4,1,1,-1];gt1=‘3’;gt2=‘4’;
326  Differential Equations: A Problem Solving Approach Based on MATLAB

-- V..tftc.tlo ..


~
~

,,
~.

.

-
-+- .

,~
" " " " ..., "
,
V_CIIIJon
u u ,

-+-.
-
~

~ ~"

~Iow

~_.. ( r (t )- :l:(t)+V(t) + 3 )
Equllm V(t )_ b {t) + y(t )+ 4

'"",,!:: ""'b [::::1]- ( =1)


V...wlcllion bjI..attution In It. ditIorwntioll Eq .... ionI: ( 0 )
,..1 be • NUU Vedor

;r.. (t)-'i+~- l
".(1) - Uf - or - I
SaIulloI'I'" "'*G -..;.)

:l:4(t) - c; + ~ - 1
",'l - "I' - 'T - !
First Order Coupled Differential Equations with Constant Coefficients 327

Example # 5.34
abc=[1,1,0,2,1,0];gt1=‘t*exp(2*t)’;gt2=‘exp(t)’;
328  Differential Equations: A Problem Solving Approach Based on MATLAB

Verlflc:atlon
l~
M

~
loo

•• .. .. .. ... ,
-+-d
~.

• - ,
" l
" U l .'
"
Verlflc.tlon
00
~
00 -+-~

~ -:-~
~

••
" .. .. .. ... , l
" U l.'
"
,

~w

,-
".....".,Sciulon
~
( %'(1) _ 0:(1) + ~(I) + I';' )
VI') - t! + 2~(1)
_Ow
,- (:)
[ <,"l I ( -.I (I +~;t.t + I»)
M'l -
Conci\i(>",

til' IlbIltutiotI in 0... diffe..-tiel EQuat.'onI: ( 00 )


Veritk::elion
M.. ,l». NULl. _

Sck.tlon ... """"0 eig ..... _ & elgerNecb"

0:.(1) _ .I (1.1 - I + I)
~(I ) ~ e' (.I - I )
Sck.tlon ... """"0 _11(. )
~(I) _ .I (1.1 - j + I)
1141) _.I (.I - I)
First Order Coupled Differential Equations with Constant Coefficients 329

Example # 5.35
abc=[-1,-2,1, -1,-1,1];gt1=‘t’;gt2=‘exp(t)’;
330  Differential Equations: A Problem Solving Approach Based on MATLAB

, ,
,
·, ,
~ .
...-.
•-
~

" o 0.2 0.01 0.8 o.s , 12 1A 1.& 111


1,
line'
, V-"Ieation

, ~
...-.'"
, --:-;:;"'1
,, ,. , " ,.. U ,
" " " "
,-
timet
_Ow
~~
Eq.at_
(0:'(1)_1 - :«1) _ 2,(1) )
V(I) _ .t + ,,(I) - Jl(1) Condliono ( ~' )
PA'tiaA,SoIulOn
~ [""'
'''<')1 -
( 1-)+1)
\+.-
V_ion ~ ._ftulion in "'" _ _ Eq .... ionft
M.. t be • NUU v.c:IOt
First Order Coupled Differential Equations with Constant Coefficients 331

Part 3 Multiple first order homogeneous systems


Multiple coupled first order homogeneous solutions are solved and the results are
obtained by (1) using the concepts of eigenvectors (2) inverse Laplace transforms
and (3) ODE. The results generate the following displays.
1. The description of the method based on eigenvalues and eigenvectors is shown.
2. The method to generate generalized eigenvectors if needed is shown.
3. Eigenvalues and eigenvectors are shown along with the statement identifying
the need for generalized eigenvectors.
4. If generalized eigenvectors are required, they are generated with statement
identifying the specific eigenvalue that leads to the generalized eigenvector along
with the specific value of the algebraic and geometric multiplicity.
5. The fundamental matrix is shown along with the general solution. The result
obtained from dsolve(.) is also shown with the caveat that the unknown constants
are different in both solutions.
6. Solutions obtained after the application of the initial conditions are shown for
both dsolve(.) and the solution is generated using eigenvalues and eigenvectors.
7. The equation that forms the basis for the Laplace transform based approach is
shown along with the Laplace transform of the solution.
8. The Laplace place based solution is compared to the one from dsolve(.) and
eigenvector/eigenvalues and the symbolic differences are shown.
9. The solutions are compared to the one obtained from ODE.

Example # 5.36
A=[-1,-2;1,-1];x0=[-1 1];gt={‘t’;‘exp(t)’};
332  Differential Equations: A Problem Solving Approach Based on MATLAB

-.
Particular.rId Complete Solution.
oIII - ~I) + 1(1}

,-
FWId-ul .... Mr. of fit ...

Conditioi'll ...
X (t ) _ IX,(I ), X,(t), ... ,X. (t)]

1 (0) .
"CO,
..:(~)
( ...(0)
)

1(1) _ X(I)HJ',( t)

CC~nI_A ( -.. -.-')


U) ~I(O) (~I )

a %, (I) _ I _ Z,(I )_ h , (I » )
( r,(t) _.t + :r,(f) - :r,{tl
"
First Order Coupled Differential Equations with Constant Coefficients 333

--,
_1_1.41 1 1).1.411G> I ,.. ,1
EIgorJtr- _1"."1 1 ~ .. ' . ,.0; 1 to;

EigelWaI.... (2) & Eigerrlr8C~rs (2~ MaiM NOT detaClNe

Gen«al aoIutlon•• nd unkrlown constants


Ho~~ HI

! - ~ - .j2e -1 (~oos(v'2t)+CISin(.j2t»+i)
( ! + ~ +e-' (CI oos(v'2t) - Co.! sin(v'2 t)) - ~
334  Differential Equations: A Problem Solving Approach Based on MATLAB

Particular

(t)
First Order Coupled Differential Equations with Constant Coefficients 335

~"..,.. III AnIIytlcel SoIu ......

.... n1 •
,- i _. ' (''''':''''):''' '''i'''')) +1
i +i + .. ,-;<".) - '''''';-<'''') - J

,- f _,. ';1"') _f". 'j"i"") +1


"'-
~. ~V.II} i + i + " '7,1},) _.,.,. ',;;"")-1
VJt~V.(I)ooo (:)

.....
...-,..
V~P'
-
VL, t<V.,,)ooo (:)
, + j+
t.' ....:",,). ,"=;<...,
i-f - .. , =< ,.,,_,~ +1
-I
336  Differential Equations: A Problem Solving Approach Based on MATLAB

., .-,
-- ~ "· '10' I ':

.~~~~--~--~--~~
o • 2 25 3
O~ 1~

T_

1 ~ 8o-'m(v'f')_'./!'-'oH(A')_1
3+3 + !I [8 !I

7 1-.- ::;:'" !gn.. ~I



,
~

.,
,

:~~~ o 15 2 25 3

"'"
First Order Coupled Differential Equations with Constant Coefficients 337

Example # 5.37
abc=[2,-5,1,-2,0,1];gt1=‘-cos(t)’;gt2=‘sin(t)’;
338  Differential Equations: A Problem Solving Approach Based on MATLAB

- <
'i
." ;~
·n
" 02
"' .. ,
"' 'm." " "
,. u ,
, V.nticatlon

j[ "
• ~

~.


" 02
......, "
"' "' "'_
,
"
,. U ,
~w (z'(t)_2%(t)_C<III( I)_6~1)) , _ (:)
E,._ vet) _.in(t) + z(l) _ 211(1) Coro\W'J,..

PIII_'ScIu"'"
HI
[Z'('lj
M' l
_ (2tcoo(t) -~-~- t li"(t) )
j wo(t)-~-~
vto¥ ,...,..,..-.-IftIlll __ E q _
IoIoaIbeIN.Al. _

_ ... uotroelg· .. _ .. \ $.
z..{t ) _ 21 ~oo(t) - 8 ';11(1)- 1 ...,(1)

.,.(t) - coo(t) - 3 ';n(t) + t coo(l)

SoUIon III uoIng - , :.)

:<4(1) _ 2, ",,"(II - 8 ..... (1) - t oiu(.)

,..(1) _ cc.(t) - 3 sin(t) + I ..,.(t)


First Order Coupled Differential Equations with Constant Coefficients 339

Example # 5.38
A=[0 -1 1;0 2 0;-2 -1 3];x0=[0 0 1];gt={‘1’;‘t’;‘exp(-t)’};
340  Differential Equations: A Problem Solving Approach Based on MATLAB

Coupled'" order System: Problem Statemenl


u
-;; - .u(')+JI')

(!Z !:i)
u')
r,(I) _ :r,(I)_z,(t)+ l )
u z2(t) _ t + Z:r,(t )
• ( zl,(I) - .,- ' - 2 %, (I) - %, (I) + 3:r,(t)

0· ' 1
" ,
·2 · ' 3

--, ,
, Bg'h • •
,
,
0 ,,
. 5 ,.,,
,
Eigenvalues (3) & Eigenvec~ .. (3~ r.IaIrbc NOT dele<:tNe
First Order Coupled Differential Equations with Constant Coefficients 341

Particular

(t)
342  Differential Equations: A Problem Solving Approach Based on MATLAB

Coupled 1" Order Olfllol'llnllal Equationa: Laplac. Tranaforma

'... "r:.~'"1)
[ "'.(1)
1_ ( 0
A. 1")
~~' ) + (""
.9I~.') )
r .(I ) ,.(1)

0Z'f (0)
(O) )
(
... (0)

lIIp1ace Tran~ _ SoIuaons uelng In_lIIp,- rr-forme


First Order Coupled Differential Equations with Constant Coefficients 343

c_rt- of ",,",,~I SoIutloM

-
f ', AI.
I [I..... v V.~)
"i-i+~+¥-'
~ -1-1
"\f-tT-i+¥-l

- (n
-..c . ~Y.ru

., .,II~".~)oo
T-j+.r.rr+'f-t
~-I-I
"\f-'T-i+¥-i

- ,-0)
y.~)

'LfI~y.ft)oo
'i-I+.r.rr+/f-!
~ -1-\
"\f-'i-i+"f-f

.'. ,I

, ,
•• ., ,
- "
344  Differential Equations: A Problem Solving Approach Based on MATLAB

.I' , I
T - 2- i
' 00
~

~
I-.- ~"·"';" . . . I
ro
m
S ~
i!
• ~

ro

"
, ,
••

-.
"
,
-
"
17"' _ C _ ~ + l.!: _I
12. 2 4
"

~
I~~'
-, '~' -I
~

i~
j

-
'00

•• "
, ,
" ~. "
First Order Coupled Differential Equations with Constant Coefficients 345

Example # 5.39
A=[2,-1,-1;-1,2,-1;-1,-1,2];x0=[0 -1 1];gt={‘t’;‘t^2’;‘exp(t)’};
346  Differential Equations: A Problem Solving Approach Based on MATLAB

(:, -,' ::)


- \ - I 2

~~i{O) ( ~l )

.:(,(I) _ I + Zr,{t) _ n(t) _ :r.(t) )


u 4(t) - 2r1(t) - ",,(t) - z~(t) + t'
• ( ~(t) _ .t - r,(t) - "1(t) + 2>:.{I)

2·' .,
__ A .,2.'
., _1 2

, .,, .,,
,
".01•••.' -' , ,
First Order Coupled Differential Equations with Constant Coefficients 347

Particular

(t)
348  Differential Equations: A Problem Solving Approach Based on MATLAB

0.,.. [,,'O
J1 ( _'O
J) (.'O
' 'r(I)J) _ A :.,(1) "'" ,.(1)
....(1) ... (1) ,.(1)

0. . . . .
_,OJ )
.... (0)
ConcMio ... ( ...{O)

.......
,.....
_'O X~.~.) 1
J) _L-' [ X"'J
~?)
( ... (1) X.(. )

i-~-*+~+'-8
i-~-;'-h + ~-H
t;+~+\t +~- H
First Order Coupled Differential Equations with Constant Coefficients 349

ComplllrlllOll of Analytlclll Solution.

f-'Ifi'-~+\t+'-H
"""'"
Eigetwal..-
& EiganYKk>rs: y .tt)
f-'III"-.-'+'-H
N+"lI"+\t+t-fi

f-'Ifi'-~+\t+,-H
"""'"
ds<lMI(.~ Y4(1) f-'III"-'-'+'-fi
y,,{tt-y.lt .... 0) N+"lI"+\t+'-fi

f-'Ifi'-~+\t+'-H
f-'III"-.-'+'-H
N+"lI"+\t+t-fi
~
.- ~
I. T- .,n
'112 - .,"+~+I'
=

~.

••..

••
••
.,~

• "
, "
,
T~
350  Differential Equations: A Problem Solving Approach Based on MATLAB

~-1nf-iT-~+~-H

._.
I=-=-(Ie",g, lui
- ., ~

•-
.~

§

-..
-- ~

. ,- ..
• ,
-"
,

.~~-:--~
o 05 1.!1 2 ,
T~
First Order Coupled Differential Equations with Constant Coefficients 351

For the remaining examples, the first two displays containing the theoretical aspects
are not shown.
Example # 5.40
A=[-1,-1,1;-1,2,-1;-1,1,0];x0=[0 1 1];gt={‘t*exp(-t)’;‘exp(-t)’;‘exp(t)’};
352  Differential Equations: A Problem Solving Approach Based on MATLAB

Particular

(t)
First Order Coupled Differential Equations with Constant Coefficients 353

Coupled 1" 0 .... DIffe .. ntI.II EquMI~ L"ce T"'--15

-- [
.".) 1 ( n'.» )+ (.10 )
~ .. (. )

... (. )
• A zo,(. )

1 .(')

n'O)
zo, (O) )
",I)

10(' )

(
1 .(0)

X,I ' )
x~.)
1_ [d . _ A)"' ( n~_O)lO) ) + 1< 1. - 'W' ( G,I ') )
~.. )
[ X.(. ) ... (0) G.(o)

nl' ) )
~~.') _ f. - '
[ X,I' )
x~.~.)
1
(
1 .(1) X.(. )

... (.....' .. ,,' .......)


• "' (,.~
• ~
....' ... ,... .. "'+p +l )

."' (,'."' ...,...• ......)


~,."'

354  Differential Equations: A Problem Solving Approach Based on MATLAB

~_oA""",*"I """""'"

.,. ..,,...............
.' j, -<" ........ .. )
.' (.,~ ,)

.' ( ...........,' ........... )

- 0)
-.... ~ y,.ll)

",1-",'''''
. ' ("
,
• '(.. ...... '.....!

,
• '(,,·· ..... •............. ·'1
......................

,

-,-
',ro
')oY.~)oo
" .. ( : )
, '.... ,)
. ' (...........
.·f·..•..... ·.............. "l

.. (........,...............

)

• -.( . .... '+ ... '+' +1)


I

"

First Order Coupled Differential Equations with Constant Coefficients 355

. -' (2 '" '''' .... t ..• -~" "'''''+1)



"
• --
-.- ~~'IUO' 10 n ,:t ar "j
."
~

j
i!~
• ~.

."• ,
"
, ,
T~ "
.- ' (tt ....•... ''''-3'''''+1''')

"
• •
---
• -- " .~'.' "
"


,
S
i!


<
~



."• .. "
T_
, ,
356  Differential Equations: A Problem Solving Approach Based on MATLAB

Example # 5.41
A=[-1,0,0,0;0,-1,0,1;0,0,1,-1;0,0,0,1];x0=[0 1 1 -1];gt={‘exp(t)’;‘t*exp(-t)’;‘exp(-t)’;‘t’};
First Order Coupled Differential Equations with Constant Coefficients 357

Particular

(t)
358  Differential Equations: A Problem Solving Approach Based on MATLAB

·,c·)1 ( _c.»)+ (,CO )


'.....- [
.... (I) _ A ~(I ) ,,(t)

..... (1) ... (1) ,.(1)

I ...... . - cO) )
:.,(0)
Conditio.. ( r .(O)

.--'"- *' ;:h + (.!I)' - *


"'9f.!_'.,tI
- <;1

-...,-
~
aiuh(t)

e-'-t+¥
If - 7
.-' - t - 2

- t- I
First Order Coupled Differential Equations with Constant Coefficients 359

.....
Comparison of An.lytlelll Solution.
sinh(t)
l': igBrH ...... e-'- I +¥
&EIgen\eCbra: y.(t)
,-,-t-
7.1.' ,

-I - 1

.....
dsd'.e(. ~ Y,,(I)
si nh (l)
e-' -t+ ¥
Yd(lrY.(I~ U) , -,-1-
7ft

-I - 1
.-, ,

.....
Laplaca Toallllkrm
sinh(l)
e-'- I +¥
y:~:~.(t,.. (n ,7 0-,--1-
'.'

- I -1
,

sinh(t)
360  Differential Equations: A Problem Solving Approach Based on MATLAB

,
--
e-'- t +"'-'
,
.., • -,
- - eilo· ".','g " ....
.
S .,

,

• ·u
>
.,
•• ,
"
, ,
" Tm.
Ii. ~- ,
~ -T- t - 2
ro

ro

ro
.
1:-:-;;::'·
-, -.1","'

Ji~


.~

':~~~o 1~

T~
2 3
First Order Coupled Differential Equations with Constant Coefficients 361

Example # 5.42
A=[-1 -4 0 0; 1 3 0 0; 1 2 1 0;0 1 0 1];x0=[1 -1 1 -1];gt={‘exp(t)’;‘t*exp(t)’;‘t^2*exp(-t)’;‘4’};
362  Differential Equations: A Problem Solving Approach Based on MATLAB

·, ... 0 0
13 0 0
12 1 0
o1 0 1

,, ,, ,,
B; " . - ,, B. " • •
,, ,,
EIganv_ (.) & E Iganv8C~f'I (2) .. MaUl. DEFECTIVE:
Generali:e<leo_eaors ftlqJltedI

,,, ,, ,, ,,
8.' .. _.
1\<:1. Goooo_-, , ,, ,, ,,
AIgebr* muIbpIicily {pi of It-. . . . . .IJ. A ~ """''''"tic rnllipUcily (m)
... G.n_lzecl9ge .... donI ... lOlJbl.of [ (A - A/.r I__ 0

General .alutlone end unknown conetanta


Ho~ solutions HI

-e (2c\t-cl + 4c,t)
€ (C:!+c1t+2 C:!t)
e (ea+CI t+2C:!t)
,
J (2 ", +2", Ii·~, 1'+2 ",")

eo...,- __ klM ..1 (homogoRl,....... . pa11o.1tar)

"12 c\ t -c, + 4C2 t) - "'cl"'~"f-"e'"-''')


-.,-
e' (C:! + CI t + 2C:! t) + I"e- ~t+3) '
.• I
.,- ea+c1 t + Ol t -
2) e-' (61- 61"';>' -<lI"""'+61' +3)
12
.. <I ,'J e<{2c,+2 ", I+ClI'+ 2c, fI) _ 4
3+12+ 2
~tlc , . c2 ,c S _c.
(1-li3)
First Order Coupled Differential Equations with Constant Coefficients 363

Particular

(t)
364  Differential Equations: A Problem Solving Approach Based on MATLAB

""i
(. -1)
' (-"+1 •• 1)
(. - 1)'

--
l .. _ ...
o! (_lo'_,"•••o-lI)

.. ( ...., .....o-lI)

." (••-..... +I., ...-.................... o-lI)
'" 12
3e' - e;. + If- + 'if - I ~ - 4

c~"- of ..... yIkot) SoIullorw


.. ( ..J~ ... ~ .. "l)

- .. ...•
(. ~ ..• ".)
~

· .(........ ".,"',.""·_. ~,,,.v ..)


- ¥ + r!f + ""1f - ,.I -
. ... .. ".)
3ft - 4

SGluliOn:
-<.~ y.~)

y~~y.~~ U)
- •
-
( . ,~

.
~

"( , ~"'o' .....)

• • (., . ..... +II, .... "" .... . ..... . ..... )


Ii

-
~T,._
. .............\
-
(

.
"( ' ''-410' ..... )

,:~:!.~~ (D · .........,....'.....................
.(
Ii
)

¥ + r!f +I'.i _''' _4


3.1 -
First Order Coupled Differential Equations with Constant Coefficients 365

,
.. (- '''- 31'+g'+3)

~:~--
o
.
-,
-- ~

,~L-------------------------c---~
00.511.52 3
r_

,
"(_"_3"+3.+3)

'"I

.j---_..--
~~~~~--~--~--~~
o M 1 15 25 3
r_
366  Differential Equations: A Problem Solving Approach Based on MATLAB

.-' (8 ' - I~"" +l~t""-(I" oi"_' .....' +f"+3)


"

.l -----
~ ~--~--~------~------~
00.511.52 3
T_
First Order Coupled Differential Equations with Constant Coefficients 367

Example # 5.43
A=[1,0,0,0;0,1,0,0;1,4,-3,0;-1,-2,0,-3];x0=[1 1 1 -1];gt={‘exp(-3*t)’;‘t*exp(3*t)’;‘exp(t)‘;’
t+exp(t)’};
368  Differential Equations: A Problem Solving Approach Based on MATLAB

Particular

(t)
First Order Coupled Differential Equations with Constant Coefficients 369

Lapl..::. T..... - . . . _ SoIoIllon . . .1ng 11'1_ ~_ T..-.......

,. d ,.-p o' _ lIot l .14


(,,-,,'(0- 1)

,-,
l!': .... ,

(,,0"-"'14)
oJ

•- (a'-.' '''t32'''-tll ''''. IIi)
Iii

i - tit +~-!ff+"j - tf -,

....-
-~
I EIfOtI_I>,", Y.~)
-... (.,-. ,,.,,..... . -. ,......
if + "'!~'- "
)

j -'Ii' + ~- 'II' +or - 'f- j

-
~ , ~Y.~)

Y~~'.'~ 0)
'1'-.;
.. (II ...........)
_.

j-

,.
~( . , _ .. ' ... +JII ... _ .

'Ii' + ~ - 'II' + or - 'f - j


, ... _ )

'1' - .;
""" < .. (" ...........1

,.
• " (.,-" ,''',.,-.,,, -I
370  Differential Equations: A Problem Solving Approach Based on MATLAB

~ - . -,1,
~ • •
~
j-.- ~.' .¢d, j 0

§
•" "
"

,, , , ,
"' "
Th"

,- I:-:-c.:-,·, k'.

+ o"{2'_ ')

,- . -, 'g
-I
-
•-
§
"
-
,~~~-!",~---.J
au

-U 22~3
First Order Coupled Differential Equations with Constant Coefficients 371

.... , (3G._:NIL "'+31"'-4$ "" .115)

'"
,·1

,~

•• .. ,.
T~
,

•~L------------------c----c----"
OO-'11-'22~3
~.
372  Differential Equations: A Problem Solving Approach Based on MATLAB

Example # 5.44
A=[0,0,1,0;0,0,0,1;2,1,1,1;-5,2,5,-1];x0=[0 0 0 -1];gt={‘t’;‘exp(-t)’;‘5’;‘cos(t)’};
First Order Coupled Differential Equations with Constant Coefficients 373

Particular

(t)
374  Differential Equations: A Problem Solving Approach Based on MATLAB

t..o,...T... _ _ _ "hM ,...Ing~_'.'=Tr __

,
l\f - i + ~ + ~ + W+ 'f + .,111'+f) - 2
Y+ ¥ _Ill:''' +1Uj' -~ - ~ +~ +i..!f- - ~
'\If -'II' -'IIi" -'+\f- 'f - "1'<'L I
n:r - ~+.Jt' +~ -'I + ~ - i!f- +1
~_"'_~I_,*-

~ - i of ~' +~ +tf -~ of' '111'·1- 2


Y - D,...~ of ":!: - ~ - Y+ ~ +to'W' '') - f
V - '\1'" - /- ~ of Y -!!f1- "'M+!lI - J
IIfi of Y +~ - Woft.;!!!-· ')JO#"n of I

-
~~y~)

V~Y.'~ 0)
~ - 1of ~ + ~ of U- - ~ +e" (1+ 1)- 2
y - D,~" +~ _ ~ _ Y +~ +." (y + If)-
V-~-/-~ of V - ~-·" (1+H)-l
lIfr +~ of ~ - U- +t.;tl -."' (y + If) +1
aw -1+ TI;'~ + U of U- +~ + "''1i+!l_ 2
'I of Hjf! - nr,;. + ~ -~- If +~ of Ilf! -
~ - ~ - ~ -1+ Y - tt! - "'''''''ll_ J
tIfr-~ + V+~- u.+~-IIf! +t
First Order Coupled Differential Equations with Constant Coefficients 375

,
376  Differential Equations: A Problem Solving Approach Based on MATLAB
First Order Coupled Differential Equations with Constant Coefficients 377

Example # 5.46
A=[0,0,0,0,1;0,0,0,1,1;0,0,0,1,1;0,2,0,-1,0;0,0,0,0,1];x0=[0 0 0 1 -
1];gt={‘t’;‘t’;‘t^2’;‘cos(t)’;‘5’};
378  Differential Equations: A Problem Solving Approach Based on MATLAB

up1c41 T............ _ SoIutIon ....IngIn_ Up...... T..- ........

." L_ _ __ , -_--:_ _ _ _ _ __
00511.52

- 1
First Order Coupled Differential Equations with Constant Coefficients 379

.~~~~~
o 15
T~
2 3

..... ..
.~ ~.~,~ -:,~~~,~,::~-:,-----:,---~,
T~
380  Differential Equations: A Problem Solving Approach Based on MATLAB

"" .. "
T_
, ,

~
4'" _ ~
ro 1-=-: 1
ro

-., •
> ro

••
~

,.
"
-,. ", , , ,
" "
T_
First Order Coupled Differential Equations with Constant Coefficients 381

5.6 Summary
First order coupled differential equations have been presented in this chapter. The
case of a pair of homogeneous first order equations is presented first. The analysis of
the properties of systems described by these equations is carried through the use of
phase portraits and state of equilibrium. The solution is obtained using the concept
of eigenvalues and eigenvectors with detailed attention given to the case of defective
coefficient matrices and generalized eigenvectors. The solution is also obtained by
converting the set of equations to a second order homogeneous differential equation
with the solution set obtained using the roots of the characteristic equation, thus
avoiding the need for generalized eigenvectors. The solution set is also obtained using
Laplace transforms, thus providing a very general means of obtaining and comparing
the solutions. Detailed examples are given, with each example annotated with the
appropriate theory, along with comparison of results and verification using Runge-
Kutta methods. The analysis is then extended to the case of a pair of non-homogeneous
first order differential equations with the particular solutions set obtained using the
method of variation of parameters. Once again, the solution set is validated through
the use of Laplace transforms and verified through the use of Runge-Kutta methods.
The study is extended to sets of multiple coupled first order non-homogeneous
systems. The solution is once again obtained using eigenvalues and eigenvectors with
an increase in complexity as one goes from a pair of equations to three, four and more.
The use of the eigenvalue based approach is limited to n<5 because of the computational
complexity associated with defective matrices. Laplace transform based solution has
been used as a means for verification and for sets with 5 or more equations, only the
Laplace transform method is used to obtain the solution. In every case, the solution
is further verified using the Runge-Kutta method.
The examples shown cover a wide array of possibilities with each example fully
annotated with the appropriate theory, explanations, justifications and even verification
carried out symbolically and displayed.

5.7 Exercises
1. For the set of values a and b given below, examine the phase plots and verify
that they reflect the state of equilibrium suggested by the eigenvalues.
a=[-3,-2,-1,0,1,2,3];
b=[4,-4,0,-2,1,-1];
A=[1,a;-1,b];
2. For all the cases above, obtain solutions to associated homogeneous system.
Verify your results using the Laplace transforms, conversion to a second order
differential equation and finally ode 45.
A=[A11,A12,A21,A22,x1(0),x2(0)]
A= [1, -3, -1, 1, -1, 1];
A= [-1, -3, 1, -1, -1, 1];
A=[1, 0, -1, -2,1,0];
A=[1, 2, 3, 2, -1, 0];
A=[2,-2, -1,-2,0, 1];
A=[ 1 3 -1 -1, -1, 1];
382  Differential Equations: A Problem Solving Approach Based on MATLAB

A=[0,3,1,2,-1,1];
3. Particular and complete solutions. A is A=[A11,A12,A21,A22,x1(0),x2(0)]
A= [1, -3, -1, 1, -1, 1];g1(t)=‘t*exp(2*t)’;g2(t)=‘t’;
A= [-1, -3, 1, -1, -1, 1];g1(t)=‘cos(t)’;g2(t)=‘sin(t)’;
A=[1, 0, -1, -2,1,0];g1(t)=‘t*exp(t)’;g2(t)=‘exp(-2*t)’;
A=[1, 2, 3, 2, -1, 3];g1(t)=‘exp(-t)’;g2(t)=‘4+t’;
A=[2,-2, -1,-2,1, 1];g1(t)=‘cosh(sqrt(6)*t)’;g2(t)=‘t’;
A=[ 3, 0, -4,-2, 0, 1];g1(t)=‘t’;g2(t)=‘t+5’;
A=[0,3,1,2,-1,1];g1(t)=‘t*exp(-t)’;g2(t)=‘exp(-t)’;
A=[3,0,1,-3,-1,1];g1(t)=‘cosh(3*t)’;g2(t)=‘sinh(3*t)’;
4. For the following coefficient matrices, obtain the general homogeneous solution
using the eigenvalues and eigenvectors. Provide the eigenvectors, eigenvalues and
state whether the matrix is defective and if generalized eigenvalues were used.
Provide the fundamental matrix as well. Compare the solution to one obtained
from MATLAB.
A=[1,1,-1;0,-1,0;1,0,1];
A=[1,-1,1;0,-1,0;1,0,1];
A=[1,1,1;-1,1,1;1,0,0];
A=[-3,0,-1;-1,1,0;1,0,0];
A=[-3,1,-1;-1,-1,-1;0,2,0];
A=[1,1,0,0;1,0,1,1;1,0,0,1;0,0,1,0];
A=[1,1,0,0;1,1,1,1;1,0,0,-1;0,1,0,1];
A=[1,0,0,4;1,0,-1,-1;-1,0,0,1;2,0,0,3];
A=[0,-2,0,0;2,0,0,0;4,0,0,0;0,0,1,0];
A=[0,0,0,6;1,0,0,0;0,0,0,-2;0,0,5,0];
A=[1,1,3,1;0,0,0,1;0,1,0,1;0,0,0,5];
A=[1,0,0,0;1,-3,0,0;0,-4,0,0;0,0,2,0];
A=[1,-1,0,0;-3,-1,0,0;0,-4,0,0;0,0,2,0];
5. For the coupled first order differential equations characterized by the coefficient
matrix, obtain the particular solution sets and complete solutions using (1)
eigenvalues and eigenvectors (2) Laplace transforms and (3) ode45 methods
with the given set of forcing functions and initial values.
A=[1,1,-1;0,-1,0;1,0,1]; x0=[0 -1 -1];g(t)={‘cos(t)’;‘sin(t)’;‘exp(-t)’};
A=[1,-1,1;0,-1,0;1,0,1];x0=[0 1 -1];g(t)={‘t’;‘t^2’;‘exp(-t)’};
A=[1,1,1;-1,1,1;1,0,0];x0=[0 -1 1];g(t)={‘4’;‘t’;‘t*exp(t)’};
A=[-3,1,-1;-1,-1,-1;0,2,0];x0=[1 -1 -1];g(t)={‘exp(-2*t)’;‘4’;‘t’};
A=[1,1,0,0;1,0,1,1;1,0,0,1;0,0,1,0];x0=[0 1 -1 -1]; g(t)={‘t’;‘exp(-2*t)’;‘4’;‘t^2’};
A=[1,0,0,4;1,0,-1,-1;-1,0,0,1;2,0,0,3];x0=[0 -1 1 -1]; g(t)={‘5’;‘0’;‘t’;‘0’};
A=[0,-2,0,0;2,0,0,0;4,0,0,0;0,0,1,0];x0=[0 -1 -1 0]; g(t)={‘cos(2*t)’;‘sin(2*t)’
;‘t’;‘5’};
A=[0,0,0,6;1,0,0,0;0,0,0,-2;0,0,5,0];x0=[0 0 -1 0]; g(t)={‘t’;‘t^2’;‘t’;‘t+2’};
A=[1,-1,0,0;-3,-1,0,0;0,-4,0,0;0,0,2,0]; x0=[0 0 -1 0]; g(t)={‘t’;‘exp(-
2*t)’;‘exp(2*t)’;‘4’};

Appendices

Appendix A

Numerical Techniques for Solving


Differential Equations

A-1 Euler’s Method 385


A-2 Runge-Kutta Method 386
A-2.1 Runge-Kutta methods for coupled first order systems 391
A-2.2 Runge-Kutta methods for higher order differential equations 393

A-1 Euler’s Method
Analytical solutions to differential equations might not always exist and it becomes
necessary to use numerical methods to obtain solutions to differential equations.
Numerical methods also offer a means to verify solutions obtained using other
approaches. One of the simplest methods relies on the Taylor series expansion for a
function and it can be used as a starting point for obtaining an approximate solution
to a differential equation. Consider the case of a first order differential equation
dy
= y=' f ( t , y ) , y ( 0=
) y0 . (A.1)
dt
In eqn. (A.1), t is the independent variable and f(.) depends on both t and the dependent
variable y. The initial condition is given as y0. For a small change in time ∆t, the Taylor
series provides

( ∆t )
2

y ( t + ∆=
t ) y ( t ) + y ' ( t ) ∆t + y '' ( t )
+ . (A.2)
2!
If the series is truncated by ignoring the terms in quadratic and higher order in ∆t,
eqn. (A.2) becomes
y ( t + ∆=
t ) y ( t ) + y ' ( t ) ∆t + O ( ∆t ) . (A.3)
386  Differential Equations: A Problem Solving Approach Based on MATLAB

The last term in eqn. (A.3) represents the error in limiting the expansion to the
linear term in ∆t. Ignoring the error, eqn. (A.3) becomes
y ( t + ∆=
t ) y ( t ) + y ' ( t )=
∆t y ( t ) + f ( t , y ) ∆t . (A.4)

If the time window where the solution exists is divided into n-segments, eqn. (A.4)
can be interpreted as follows

ym ( t )= ym −1 ( t ) + f ( t , ym −1 ) ∆t , m ≤ n . (A.5)

Thus, the solution to the differential equation can be obtained at different time instants
in [0, t] in steps of ∆t. It can be seen from eqn. (A.5), the accuracy of the solution will
depend on the step size and the nature of y(t). If y(t) is highly non-linear, the linear
approximation provided in eqn. (A.5) will be insufficient and error in the solution will
increase. Equation (A.5) represents the numerical solution based on Euler’s method.
The numerical approach to the solution of the differential equation can be improved
if there is a better way to estimate f(t,y) for each iteration. In other words, while Euler’s
method uses the local value of f(t,yn-1), an improved method would require that the
estimate of f(t,yn-1) is made by taking more samples of f(t,y) from the neighborhood.
Euler’s method uses uniform step sizes and if step sizes could be adjusted, the errors
are likely to be less because varying step sizes will model nonlinear functions better.
Another approach lies in using an improved average value of the function at each step.
One such method is the Runge-Kutta method. Depending on the number of terms
used for averaging, it is possible to have a 2nd order, 3rd order, 4th order method, etc.
The 4th order method which is extensively used (normally called the Runge-Kutta
method) is described below.

A-2 Runge-Kutta Method
The Runge-Kutta method uses a weighted average as the local estimate. Equation
(A.5) is modified as
ym ( t ) =ym −1 ( t ) + f ( t , y )av ∆t . (A.6)

The average value of the local estimate is


k1 + 2k2 + 2k3 + k4
f ( t , y )av =
6
k1 = f ( tm −1 , ym −1 )
 ∆t ∆t 
k2 =f  tm −1 + , ym −1 + k1  (A.7)
 2 2 
 ∆t ∆t 
k3 =f  tm −1 + , ym −1 + k2 
 2 2 
=k4 f ( tm −1 + ∆t , ym −1 + k3 ∆t )
Appendices 387

The notion of the average is clear from eqn. (A.7).


In the adaptive step size approach, the step size can be automatically adjusted
as the calculation proceeds based on the local truncation error (LTE), defined as the
difference in the numerical value of the solution at any point and its actual value. These
procedures will now be explained using an example which compares the Euler’s and
the Runge-Kutta methods. A first order differential equation is
dy
=3 + 2t − y, y ( 0 ) =2 . (A.8)
dt
The analytical solution to the differential equation is
y ( t ) = e − t + 2t + 1 . (A.9)

Two step sizes (∆t=0.4 and 0.1) are used. The local truncation error (LTE) at each
step is given by
erk =yk ( analyt ) − yk ( numer ) , k =
1, 2,... . (A.10)

The mean square error is


1
∑ [er ]
2
MSE = k . (A.11)
N k

In eqn. (A.11), N is the total number of steps. A MATLAB® code that obtains the
solution using both Euler’s and Runge-Kutta methods and examination of the errors
is given below. MATLAB automatically chooses the appropriate number of step sizes
needed in ode45(.).
function euler_ode_demo
% dy/dt=3+2t-y, y(0)=2
% Comparison of Euler’s and Runge-Kutta methods. Two steps sizes are used
% for Euler’s while the step size is automatically chosen (adaptive sizing)
% by MATLAB. The local truncation errors and the mean square errors are
% compared. It is seen that while the error with Euler’s declines with
% reduction in step size, Runge-Kutta method uses the lowest number of
% steps and provides the most accurate estimate of the solution
% P M Shankar, August 2016
close all
tmin=0;%initial time
tMax=2;%maximum value of time
% test the error with two step sizes for Euler
dt1=0.4;
t1=tmin:dt1:tMax; % steps, size 0.4
dt2=.2;
t2=tmin:dt2:tMax; % steps, size 0.2
y0=2; % initial condition
y1(1)=y0; % initial condition restated
y2(1)=y0; % initial condition restated
388  Differential Equations: A Problem Solving Approach Based on MATLAB

N1=length(t1);N2=length(t2);
for k=2:N1 % step size 0.4
yy=ode_eulerfun1(t1(k-1),y1(k-1));
y1(k)=y1(k-1)+dt1*yy;
end;
for k=2:N2 % step size 0.1
yy=ode_eulerfun1(t2(k-1),y2(k-1));
y2(k)=y2(k-1)+dt2*yy;
end;
% Runge-Kutta (ODE45)
tm=[0:tMax]; % MATLAB chooses the step size
[T,YDE]=ode45(@ode_eulerfun1,tm,y0);
% now verify the accuracy of the methods
% Symbolic solution ----> dy/dt=3+t-y, y(0)=2
syms x y t
y=dsolve(‘Dy=3+2*t-y’,’y(0)=2’);
yys=MATLABFunction(y);
% disp([‘Analytical solution of dy/dt= 3+2t-y, y(0)=2 is y(t)=’ ,yyt])
% Convertion to MATLAB Function for plotting and error calculations
% create samples of analytical solution at appropriate time instants
ya1=yys(t1);% samples at step size 0.4
ya2=yys(t2); % samples at step size 0.1
yad=yys(T);% % samples at the instants generated by Runge-Kutta (ODE)
figure, plot(t1,ya1,t1,y1,‘k*’,t2,y2,‘bd’,T,YDE,‘rs’)
xlabel(‘time t’),ylabel(‘solution y(t)’)
leg1=[‘Euler’’s \Deltat = ‘,num2str(dt1)];
leg2=[‘Euler’’s \Deltat = ‘,num2str(dt2)];
leg3=[‘Runge-Kutta’];
legend(‘Analytical’,leg1,leg2,leg3,‘location’,‘best’)
text(0.78,2.52,’y(t) = ‘,’fontsize’,12)
text(1,2.5,[‘$’ latex(y) ‘$’],‘interpreter’,‘latex’,‘fontsize’,14)
N3=length(T);% number of samples from ODE
text(0.2,4.2,[leg1,’, N = ‘,num2str(N1)])
text(0.2,4,[leg2,’, N = ‘,num2str(N2)])
text(0.2,3.8,[leg3,’, N = ‘,num2str(N3)])
% Error calculations
Appendices 389

er1=y1-ya1;
er2=y2-ya2;
er3=YDE-yad;
MSE1=sum(er1.^2)/N1;
MSE2=sum(er2.^2)/N2;
MSEOD=sum(er3.^2)/N3;
tit=[‘Anylt Numer LTE’];
val1=[ya1;y1;er1]’;
val2=[ya2;y2;er2]’;
val3=[yad,YDE,er3];
figure,xlim([0,5]),ylim([0,5])
title(‘Error Analysis: Comparison of raw data’,‘backgroundcolor’,‘w’)
text(.5,4.5,tit,‘color’,‘b’)
text(3,4.5,tit,‘color’,‘b’)
text(1,1.2,tit,‘color’,‘b’)
text(.5,3.5,num2str(val1))
text(3,3,num2str(val2))
text(1,0.65,num2str(val3))
text(.5,4.8,[leg1,’, N = ‘,num2str(N1)],’color’,’r’,’fontweight’,’bold’)
text(3.3,4.8,[leg2,’, N = ‘,num2str(N2)],’color’,’r’,’fontweight’,’bold’)
text(1.1,1.5,[leg3,’, N = ‘,num2str(N3)],’color’,’r’,’fontweight’,’bold’)
%text(4.2,0.1,’p m shankar’,’color’,’g’)
axis off
figure,plot(t1,er1,’k*’,t2,er2,’bd’,T,er3,’rs’)
xlabel(‘time t’)
ylabel(‘Local Truncation Error [y_{Analyt}-y_{numerical}]’)
ylim([-.1,.1])
legend(leg1,leg2,leg3,’location’,’best’)
title(‘Error Analysis’)
text(0.2,.05,[leg1,’, MSE = ‘,num2str(MSE1)])
text(0.2,.04,[leg2,’, MSE = ‘,num2str(MSE2)])
text(0.2,.03,[leg3,’, MSE = ‘,num2str(MSEOD)])
end
function dy= ode_eulerfun1(t,y)
%dy/dt=3+2*t-y
dy=3+2*t-y;
end
390  Differential Equations: A Problem Solving Approach Based on MATLAB

E!MI'" aI_ 0". N • 8


E!MI'" a l _ 0.2. N • 11
Ru.O:UIa, N _3

y(t) - 2t+e- '+ l

0.2 0" O~ M 1 12 ,
"'" , "
Error A ... lyala: Compoorison '" raw d.l1JI

..,., ,-, ,'"


Eu ..... .CIU G... N · .
.,., ,-
Eu_ .CII . 0.2, N • 11

..-
, ,'"
2.4103 ,. ..0.01032
2.2187
2.4103
2.2 ..oD18731
u•

-
3.00193 ~ ~~m
2.7488 2.712 ..o.00(IlI12
3.7012 l .515 ..o.0IIII11M

.-
3.00193 3.0096 ..0.039129

.-.- .=. ..
4..co19 4.3296 ..o1J1Z297
$.13113 ~.o711! ..o1ll'i7!i1!i
3.31179
,~,
"m
3.6621
-0-0010199

<m_
4.04019 -0.1)3.4124
4.7342 ..0.03 1081
$.1:163 5.1074 -o.Q27l161
",,_Kulla, N • 3

, , ,
An)II N....... lTe

U57' 3.3411'f 4.S607.08


$.1353 5.1353 3.301~08
Appendices 391

A-2.1 Runge-Kutta methods for coupled first order systems


Runge-Kutta methods can easily be applied to solve coupled first order differential
equations. An example of a system with a two first order non-homogeneous equation
is given. Consider a system defined by the coefficient matrix A, initial conditions x1(0)
and x2(0), and forcing functions gt1 and gt2 as
1 1
A=  . (A.12)
 4 1
 x1 ( 0 )   0 
  =   . (A.13)
 x2 ( 0 )   −1
 gt1  e − t 
 gt  =   . (A.14)
 2  t 
The set of differential equations associated with the coefficient matrix and forcing
functions is
x1' ( t ) = x1 ( t ) + x2 ( t ) + e − t , x1 ( 0 ) = 0
. (A.15)
x2' ( t ) =
4 x1 ( t ) + x2 ( t ) + t , x2 ( 0 ) =
−1
392  Differential Equations: A Problem Solving Approach Based on MATLAB

The example in eqn. (A.15) has been solved using the Runge-Kutta method and the
MATLAB script and results are given below. The numerical solution set is compared
to the analytical solution set obtained using dsolve(.).
function example_rungekutta_coupled
% define variables
close all
syms x_1(t) x_2(t)
xt=[x_1(t);x_2(t)];
D1y=diff(x_1,t);
D2y=diff(x_2,t);
A=[1,1;4,1]; % coefficient matrix
gt=[exp(-t);t]; % forcing functions
Dy=[D1y;D2y];% initial conditions
diffX=[Dy==A*xt+gt]; % create the differential equation set
[x1,x2]=dsolve(diffX,[x_1(0)==0;x_2(0)==-1]); % solve in MATLAB
x1=simplify(x1,‘steps’,100);
x2=simplify(x2,‘steps’,100);
mf1=MATLABFunction(x1); % create inline function solution x1(t)
mf2=MATLABFunction(x2);% create inline function solution x2(t)
tspan=[0 5]; % time span for numerical integration
[tt,yy]=ode45(@fun2f,tspan,[0; -1]);
% yy is the numerical solution in two columns. First column corresponds
% to x_1(t) and the second one to x_2(t)
plot(tt,mf1(tt),‘-k’,tt,yy(:,1),‘k*’,tt,mf2(tt),‘--r’,tt,yy(:,2),‘ro’)
legend(‘x_1(t)-Analyt’,‘x_1(t)-Runge-Kutta’,...
‘x_2(t)-Analyt’,‘x_2(t)-Runge-Kutta’,‘location’,‘best’)
xlabel(‘time’),ylabel(‘solution’)
title(‘Solutions(s): Analytical vs. Numerical’,‘color’,‘b’)
xx1=[x_1(t)==x1]; % create equation for display
xx2=[x_2(t)==x2];% create equation for display
% display the differential equations
text(0.5,-1e5,[‘$’ latex(feval(symengine,‘rewrite’,diffX,‘D’)) ‘$’],...
‘interpreter’,‘latex’,‘fontsize’,12,‘color’,‘b’)
% display the solutions
text(.5,-5e5,[‘$’ latex(xx1) ‘$’],‘interpreter’,‘latex’,‘fontsize’,16,‘color’,‘b’)
text(.5,-6e5,[‘$’ latex(xx2) ‘$’],‘interpreter’,‘latex’,‘fontsize’,16,‘color’,‘b’)
end
function dxdt=fun2f(t,x)
% create the function for numerical evaulation
dxdt=zeros(2,1);
dxdt(1,1)=x(1,1)+x(2,1)+exp(-t);
dxdt(2,1)= 4*x(1,1)+x(2,1)+t;
end
Appendices 393

A-2.2 Runge-Kutta methods for higher order differential equations


Runge-Kutta methods are applicable to a set of first order differential equations as
seen above. This means that a higher order differential equation must be decomposed
to several first order differential equations before the Runge-Kutta numerical method
can be applied. Consider a 3rd order differential equation
A3 y '''+ A2 y ''+ A1 y '+ A=
0y f (t ), y '' (=
0 ) y2 , y ' (=
0 ) y1 , y (=
0 ) y0 . (A.16)
Rewriting the differential equation as
A2 A A f (t )
y '''+ y ''+ 1 y '+ 0 y= ⇒ y '''+ ay ''+ by '+ cy= h ( t ) (A.17)
A3 A3 A3 A3
In eqn. (A.17),
A2
a=
A3
A1
b=
A3
. (A.18)
A0
c=
A3
f (t )
h (t ) =
A3
394  Differential Equations: A Problem Solving Approach Based on MATLAB

For the decomposition, defining


x1 = y
x=
2 y=' x1' (A.19)
x=
3 y='' x2 '
Equation (A.19) becomes

h (t ) .
x3 '+ ax3 + bx2 + cx1 = (A.20)

Combining eqns. (A.19) and (A.20), the decomposition of the higher order equation
into three first order differential equations becomes
x1 ' = x2
x2 ' = x3 . (A.21)
− [ ax3 + bx2 + cx1 ] + h ( t )
x3 ' =
The coefficient matrix A is expressed as
0 1 0

A= 0 0 1  .
(A.22)
 −c −b −a 
In matrix notation (see Appendix E), the differential equation in eqn. (A.17) becomes

 x1 '  0 1 0   x1   0 
 x ' 0  
= 2   0 1   x2  +  0  . (A.23)
 x3 '  −c −b −a   x3   h ( t ) 
The initial conditions become the vector
 y0 
X ( 0 ) =  y1  . (A.24)
 y2 
As a specific example, consider the following 3rd order differential equation with
initial conditions
2 y '''+ 4 y ''+ 3 y '=
+ y cos(t ), y=
(0) 1, y =
'(0) 0, y ''(0)
= -1 (A.25)
The coefficient matrix A is

 
 0 1 0
 
A= 0 0 1  . (A.26)
 1 3 
− − −2 
 2 2 
The example has been worked out in MATLAB. The solution has been obtained using
the Runge-Kutta method and verified by comparing it to the solution obtained using
Appendices 395

dsolve(.) in MATLAB. Two different approaches exist for implementing the Runge-
Kutta method. One uses the coefficient matrix in eqn. (A.26). In the other case, the
direct conversion of higher order differential equation into appropriate first order
differential equations is carried out in MATLAB. This will be shown following the
discussion of the example of a second order differential equation.
A second order differential equation is

A2 y ''+ A1 y '+ A=
0y ( 0 ) y2 , y ' =
f (t ), y ''= ( 0 ) y1 . (A.27)
Proceeding similarly, the coefficient matrix becomes

 0 1 
A =  A0 A  . (A.28)
− − 1
 A2 A2 
The decomposition leads to
 0 1   0 
 x1 '     x1   
=    A0 A + f ( t )  . (A.29)
 x2 '  − A − 1   x2  
 2 A2   A2 
The initial conditions become
y 
X ( 0 ) =  0  . (A.30)
 y1 
Consider the example
te − t , y (0) =
y ''+ 4 y '+ 3 y = −1 .
1, y '(0) = (A.31)

The two examples, the 3rd order differential equation in eqn. (A.25) and the 2nd order
differential equation in eqn. (A.31) are solved in MATLAB. The analytical solutions
obtained using dsolve(.) are compared to the corresponding solutions obtained using
the Runge-Kutta method. All the steps in the MATLAB script are commented at the
appropriate lines of the script. The script also demonstrates the creation of symbolic
differential equations matching the given examples so that one can use the MATLAB
function odeToVectorfield(.) to create the inline function needed for the Runge-Kutta
method. For the case of the 3rd or equation, the external function based approach is
also used. The use of MATLABFunction(.) to convert the symbolic solution to an
inline form is also shown.
function higherorder_ode_example

Part 1: 3rd order differential equation and Part 2: 2nd order equation
Part 1: example of solution of a 3rd order differential equations using Runge-
Kutta method. Results are verified using dsolve(.) by plotting the results.
2y’’’+4y’’+3y’+y=cos(t), y(0)=1,y’(0)=0,y’’(0)=-1 There are two ways of generating
the function for ODE45 input. One is the traditional approach creating the function
externally and the other is based on odeToVectorField(.) which can decompose a
higher order differential equation into several first order ones. Both approaches are
implemented.
396  Differential Equations: A Problem Solving Approach Based on MATLAB

close all
A=[0,1,0;0,0,1;-1/2,-3/2,-2];%The coefficient matrix A
X0=[1;0;-1]; % initial conditions
tspan=[0 2]; [T1,yy2]=ode45(@higherorderf,tspan,X0);
% note that yy(:,1) is the solution and other columns are the first and
% second derivatives
% now get the analytical solution using dsolve for verification
syms t y
yt1=dsolve(‘2*D3y+4*D2y+3*Dy+y-cos(t)=0’,‘y(0)=1’,‘Dy(0)=0’,‘D2y(0)=-1’);
yt1=simplify(yt1,‘steps’,100);
% now verify the solution by plotting
yyt1=MATLABFunction(yt1);% create an inline function of the symbolic solution
plot(T1,yyt1(T1),‘k’,T1,yy2(:,1),‘r*’)
xlabel(‘time’),ylabel(‘Solution y(t)’),legend(‘Analyt’,‘Numerical’)
title(‘2y’’’’’’+4y’’’’+3y’’+y=cos(t), y(0)=1,y’’(0)=0,y’’’’(0)=-1’)
text(.2,.5,‘Using external function’)
% it is also possible to create an inline function using the following
% approach
clear y t
syms y(t)
% define the differentials
Dy=diff(y);D2y=diff(y,2);D3y=diff(y,3);
ff1=[2*D3y+4*D2y+3*Dy+y-cos(t)==0]; % create a symbolic differential equation
V1 = odeToVectorField(ff1);% break higher order DE into 3 first order ones
FF1 = MATLABFunction(V1,‘vars’, {‘t’,‘Y’});% create inline Function for ODE
[T2,yx1]=ode45(FF1,tspan,X0);
figure,plot(T2,yyt1(T2),‘k’,T2,yx1(:,1),‘r*’)
xlabel(‘time’),ylabel(‘Solution y(t)’),legend(‘Analyt’,‘Numerical’)
title(‘2y’’’’’’+4y’’’’+3y’’+y=cos(t), y(0)=1,y’’(0)=0,y’’’’(0)=-1’)
text(.2,.5,‘Using odeToVectorField’)
% part 2 example of a second order differential equation
clear all
% y”+4y’+3y=texp(-t),y(0)=1,y’(0)=-1;
y0=1;y1=-1;
syms y(t)
Dy=diff(y);D2y=diff(y,2); % define the differentials
ff2=[D2y+4*Dy+3*y-t*exp(-t)==0]; % create a symbolic differential equation
V2 = odeToVectorField(ff2);% break higher order DE into 3 first order ones
FF2 = MATLABFunction(V2,’vars’, {‘t’,‘Y’});% create inline Function for ODE
tspan=[0 2];
[T3,yx2]=ode45(FF2,tspan,[y0;y1]);
% get the solution using dsolve
yt2=dsolve(‘D2y+4*Dy+3*y-t*exp(-t)=0’,‘y(0)=1’,‘Dy(0)=-1’);
yt2=simplify(yt2,’steps’,100);
% now verify the solution by plotting
yyt2=MATLABFunction(yt2);% create an inline function of the symbolic solution
figure,plot(T3,yyt2(T3),‘k’,T3,yx2(:,1),‘r*’)
xlabel(‘time’),ylabel(‘Solution y(t)’),legend(‘Analyt’,‘Numerical’)
title(‘y’’’’+4y’’+3y=te^{-t}, y(0)=1,y’’(0)=-1’)
Appendices 397

function dy = higherorderf(t,x)
% external function for the 3rd order differential equation
dy=zeros(3,1);% this corresponds to the first order derivatives x1’,x2’,x3’
A=[0,1,0;0,0,1;-1/2,-3/2,-2];%The coefficient matrix A
ff=[0;0;cos(t)/2];
dy=A*x+ff;% three first order differential equations
end
398  Differential Equations: A Problem Solving Approach Based on MATLAB

•• 1-
, =..1
••
_0.1
~
.§ 0.6
•'" 0.5

•••

· 'L~~
.,o
... ~ OA M OA \ 12 1. lA lA 2

Appendix B

Laplace and Inverse Laplace


Transforms for Solving Differential
Equations

B-1 Laplace and Inverse Laplace Transforms 399


B-1.1 Second order differential equation 401
B-1.2 Higher order differential equations 404
B-1.3 Coupled first order equations 406

B-1 Laplace and Inverse Laplace Transforms


The Laplace transform F(s) of a temporal function y(t) is the integral

( t ) Y=
L  y = (s) ∫ y ( t )e
− st
dt . (B.1)
0

In eqn. (B.1), L[] represents the Laplace operator and Y(s) is the Laplace transform
of y(t). Often, y(t) is defined to be in the ‘t’ domain and Y(s) is defined to be in the
‘s’ domain. Behavior of linear systems could be analyzed using Laplace transforms
by taking advantage of their properties which allow a differential equation to be
converted to an algebraic equation in the ‘s’ domain. Such an algebraic equation can
then be rearranged to obtain an expression for Y(s) which can be inverted to obtain
the solution to the differential equation. This concept is illustrated in Figure B1 below.

d n y (t )
Figure B.1 Use of Laplace Transforms for solving differential equation D n ( y ) = .
dt n
400  Differential Equations: A Problem Solving Approach Based on MATLAB

The usefulness of the Laplace transform arises from its properties, some of which
are listed below.
Linearity
L  af ( t ) + bg ( t )  = aL  f ( t )  + bL  g ( t )  = aF ( s ) + bG ( s ) (B.2)

Scaling by tn, n=1, 2, 3, …

L t n f ( t )  = ( −1) F[
n]
(s)
n
(B.3)

dn
F[
n]
(s) = F (s)
ds n
. (B.4)
dn
f [ ] (t ) = n f (t )
n

dt
Differentiation
L  f =
'
( t ) sF ( s ) − f ( 0 )
. (B.5)
L  f [ ] (=
t )  s n F ( s ) − s n −1 f ( 0 ) − s n − 2 f [ ] ( 0 ) −  − sf [ ] ( 0 ) − f [ ] ( 0 )
n 1 n−2 n −1

For the special case of the derivative of second order


L  f 2 ( t )  = s 2 F ( s ) − sf ( 0 ) − f [ ] ( 0 ) .
1
(B.6)
Multiplication by an exponential function
L ebt f (=
t )  F ( s − b ) (B.7)
The Table of Laplace transforms is given in Table B.1. Some of the additional properties
are listed in Table B.2. These tables were generated using MATLAB®.
Table B.1  Laplace Transforms.
Appendices 401

Table B.2  Some additional properties of Laplace Transforms.

Use of the Laplace transform method requires that the differential equations are
given along with the initial conditions. This means that if the differential equation is
of nth order, there must be n initial values as seen from eqn. (B.5). The conceptual
approach to the solution of a second order differential equation will be described first
before examining differential equations of lower and higher orders and coupled first
order differential equations. It is assumed that all these differential equations are linear
with constant coefficients. A second order non-homogeneous differential equation
with constant coefficients is
'+ cy h ( t ) ; =
ay ''+ by = y ( 0 ) y0 , y=
' ( 0 ) y1 (B.8)

Applying the property in eqn. (B.5), the Laplace transform of the differential equation
in eqn. (B.8) becomes
a  s 2Y ( s ) − sy0 − y1  + b  sY ( s ) − y0  + cY ( s ) =
H ( s ) . (B.9)

The Laplace transform of y(t) is obtained by simplifying eqn. (B.9) as


( as + b ) y0 + ay1 H (s) P (s)
Y (=
s) + = (B.10)
2
as + bs + c as + bs + c Q ( s )
2

The quantities P(s) and Q(s) are introduced to indicate that the transform of y(t) will be
the ratio of two polynomial functions in s. The ratio P(s)/Q(s) needs to be decomposed
into simpler forms of rational functions using the method of partial fractions so that
the Table of Laplace transforms may be used. Laplace and inverse Laplace transforms
are readily available in the Symbolic Toolbox of MATLAB.

B-1.1 Second order differential equation


Consider the following second order differential equation
2e − t , y ( 0 ) =
y ''− 3 y '− 4 y = 1, y ' ( 0 ) =
−1 (B.11)

Using eqn. (B.10), the Laplace transform of y(t) becomes


2
( s − 3) − 1 ( s − 4) 2
Y (s) = 2 + 2 s +1 = 2 + 2 (B.12)
s − 3s − 4 s − 3s − 4 s − 3s − 4 ( s − 3s − 4 ) ( s + 1)
402  Differential Equations: A Problem Solving Approach Based on MATLAB

Decomposing into partial fractions gives,


( s − 4) 1
2
= (B.13)
s − 3s − 4 s +1
2 2 2 2
= − − (B.14)
(s 2
− 3s − 4 ) ( s + 1) 25 ( s − 4 ) 5 ( s + 1)2 25 ( s + 1)

Taking the inverse Laplace transforms (from the Laplace transform Table) leads to
( t ) y1 ( t ) + y2 ( t )
y= (B.15)

−1  1 
y1 ( t ) L=
= −t
 s + 1 e (B.16)
 
 2 2 2  2 4t 2 − t 2 − t
y2 ( t ) = L−1  − − = e − te − e (B.17)
 25 ( s − 4 ) 5 ( s + 1) 25 ( s + 1)  25
2
5 25

Combining and simplifying, the solution becomes


23 − t 2 4t 2 − t
y (t ) =
e + e − te . (B.18)
25 25 5
It should be noted that partial fractions can also be obtained from MATLAB. For
example, the decomposed components in eqn. (B.14) can be obtained as follows:
syms y(t) t s
f=laplace(2*exp(-t),t,s)
f1=f/(s*s-3*s-4)
p = feval(symengine,‘partfrac’,f1,‘s’)
MATLAB generates the following output
f = 2/(s + 1)
f1 =-2/((s + 1)*(- s^2 + 3*s + 4))
p = 2/(25*(s - 4)) - 2/(5*(s + 1)^2) - 2/(25*(s + 1))
The MATLAB code which performs the solution is given below.
% May 7, 2016
clear all
% solve ‘D2y-3*Dy-4*y=2*exp(-t)’,‘y(0)=1’,‘Dy(0)=-1’
syms y(t) t s
ff=(s*s-3*s-4);% the denominator as^2+bs+c
term1=(s-4)/ff;
disp(‘display the Laplace transform of term 1’)
disp(term1)
pp = feval(symengine,‘partfrac’,term1,‘s’);% decompose into partial fractions
pretty(pp)
y1=ilaplace(term1,s,t) % inverse Laplace transform of term 1
f=laplace(2*exp(-t),t,s) % get the Laplace transform of the forcing function
Appendices 403

term2=f/ff;
disp(‘display the Laplace transform of term 2’)
disp(term2)
y2=ilaplace(term2);% inverse Laplace directly without decomposition
p = feval(symengine,‘partfrac’,term2,‘s’); % decompose into partial fractions
pretty(p) % only for display purposes
% get the solution using Laplace transform method
yLap=simplify(y1+y2,‘steps’,100);
disp(‘display the solution obtained using Laplace transforms’)
disp(yLap)
% solution using dsolve(.) in MATLAB
yd=dsolve(‘D2y-3*Dy-4*y=2*exp(-t)’,‘y(0)=1’,‘Dy(0)=-1’);
disp(‘display the solution obtained using dsolve’)
disp(yd)
% verify that the solutions match: find the difference between the two
% solutions
disp(‘Verify that the Laplace solution is correct: Obtain the symbolic difference between
the two solutions’)
disp(‘Difference will be 0 if the approach is correct’)
disp(simplify(yLap-yd)) % verify that the solution is correct; must be equal to 0
display the Laplace transform of term 1
-(s - 4)/(- s^2 + 3*s + 4)

1
-----
s+1
y1 =
exp(-t)
f=
2/(s + 1)
display the Laplace transform of term 2
-2/((s + 1)*(- s^2 + 3*s + 4))

2 2 2
---------- - ---------- - ----------
25 (s - 4) 2 25 (s + 1)
5 (s + 1)
display the solution obtained using Laplace transforms
(exp(-t)*(2*exp(5*t) - 10*t + 23))/25
display the solution obtained using dsolve
(23*exp(-t))/25 + (2*exp(4*t))/25 - (2*t*exp(-t))/5
Verify that the Laplace solution is correct: Obtain the symbolic difference between the two
solutions
Difference will be 0 if the approach is correct
0
404  Differential Equations: A Problem Solving Approach Based on MATLAB

A figure automatically generated form the MATLAB based results from Chapter 3
appears below.

B-1.2 Higher order differential equations


A higher order differential equation will now be solved using the concept of Laplace
transforms. A 4th order differential equation is
y ''''− y =cos ( t ) (B.19)

The initial conditions are


y ''' ( 0 ) =
1, y '' ( 0 ) =
0, y ' ( 0 ) =
−1, y ( 0 ) =
1 (B.20)

Taking Laplace transform of the differential equation leads to


s
s 4Y ( s ) − s 3 y ( 0 ) − s 2 y ' ( 0 ) − sy '' ( 0 ) − y ''' ( 0 ) − Y ( s ) = (B.21)
s2 + 1
Applying the initial conditions and collecting the terms in Y(s)
s
Y ( s )  s 4 − 1=
 + ( s 3 − s 2 + 1) (B.22)
s2 + 1
The Laplace transform of y(t) is

=Y (s)
(s 3
− s 2 + 1)
+
s
(B.23)
 s − 1
4
( s + 1)  s 4 − 1
2

Taking the inverse Laplace transform and writing it as the sum of two terms gives
( t ) y1 ( t ) + y2 ( t ) .
y= (B.24)
Appendices 405

 s3 − s 2 + 1 
y1 ( t ) = L−1  4  . (B.25)
 s −1 
 s 
y2 ( t ) = L−1  2  (B.26)
 ( s + 1)( s − 1) 
4

The solutions become


1 1 1
y1 ( t ) = e − t + cos ( t ) + et − sin ( t ) (B.27)
4 2 4
1 t 1 t
y2 ( t ) = e + e − t  − cos ( t ) − sin ( t ) (B.28)
8 4 4
The solution becomes
3 1 t
y (=
t) cosh ( t ) + cos ( t ) − sin ( t ) − sin ( t ) . (B.29)
4 4 4
The MATLAB code that generates the solution is given below.
clear all;close all;clc;
syms y(t) t s
term1=(s^3-s^2+1)/(s^4-1);
y1t=ilaplace(term1,s,t);
disp(‘display the inverse Laplace transform of term 1’)
disp(y1t)
term2=s/((s^4-1)*(s^2+1));
y2t=ilaplace(term2,s,t);
disp(‘display the inverse Laplace transform of term 2’)
disp(y2t)
yt=simplify(y1t+y2t,‘steps’,100);
disp(‘Solution using Laplace’)
disp(yt)
% solution directly using dsolve
yd=dsolve(‘D4y-y=cos(t)’,’D3y(0)=1’,‘D2y(0)=0’,‘Dy(0)=-1’,‘y(0)=1’);
disp(‘Solution using dsolve’)
disp(yd)
% verify that the solutions match: find the difference between the two
% solutions
disp(‘Verify that the Laplace solution is correct: Obtain the symbolic difference between
the two solutions’)
disp(‘Difference will be 0 if the approach is correct’)
disp(simplify(yt-yd,‘steps’,100)) % must be zero

display the inverse Laplace transform of term 1


exp(-t)/4 + cos(t)/2 + exp(t)/4 - sin(t)
display the inverse Laplace transform of term 2
exp(-t)/8 - cos(t)/4 + exp(t)/8 - (t*sin(t))/4
406  Differential Equations: A Problem Solving Approach Based on MATLAB

Solution using Laplace


cos(t)/4 + (3*cosh(t))/4 - sin(t) - (t*sin(t))/4
Solution using dsolve
(3*exp(-t))/8 - cos(3*t)/16 + (5*cos(t))/16 + (3*exp(t))/8 - sin(t) - sin(t)*(t/4 + sin(2*t)/8)
Verify that the Laplace solution is correct: Obtain the symbolic difference between the two
solutions
Difference will be 0 if the approach is correct
0

A figure automatically generated form the MATLAB based results from Chapter 3
appears below.

B-1.3 Coupled first order equations


As the final example, a set of coupled first order equations will now be considered.
For variables x, y, and z, a set of coupled first order differential equations with initial
conditions can be represented as
x ' = A11 x + A12 y + A13 z + f x ( t ) , x ( 0 ) = x0
y ' = A21 x + A22 y + A23 z + f y ( t ) , y ( 0 ) = y0 . (B.30)
z ' = A31 x + A32 y + A33 z + f z ( t ) , z ( 0 ) = z0
Appendices 407

Taking the Laplace transforms leads to


sX ( s ) =
− x0 A11 X ( s ) + A12Y ( s ) + A13 Z ( s ) + Fx ( s )
sY ( s ) −
= y0 A21 X ( s ) + A22Y ( s ) + A23 Z ( s ) + Fy ( s ) . (B.31)
sZ ( s )=
− z0 A31 X ( s ) + A32Y ( s ) + A33 Z ( s ) + Fz ( s )
The use of Laplace transforms in solving coupled first order equations will now be
demonstrated. Consider the following set of linear coupled first order equations.
Using matrix notation, eqn. (B.31) becomes
 X ( s )  A11 A12 A13   X ( s )   F ( s )   x0 
  A    
s Y (s) 
=  21 A22 A23   Y ( s )  +  F ( s )  +  y0  (B.32)
 Z ( s )   A31 A32 A33   Z ( s )   F ( s )   z0 

Rewriting the left side using the notion of an identity matrix I3 gives

1 0 0   X ( s )   A11 A12 A13   X ( s )   Fx ( s )   x0 


     
s 0 =1 0   Y ( s )  A
 21 A22 A23   Y ( s )  +  Fy ( s )  +  y0  . (B.33)
0 0 1   Z ( s )   A31 A32 A33   Z ( s )   Fz ( s )   z0 
Equation (B.33) is rewritten as
( sI − A)W ( s ) =
F ( s ) + w0 . (B.34)

In eqn. (B.34), A is the coefficient matrix, W(s) is the 3 x 1 matrix of the Laplace
transforms of x, y and z, F(s) is the [3 x 1] matrix of the Laplace transform of the
forcing functions and w0 is the [3x1] matrix with the initial conditions.
 A11 A12 A13 
A =  A21 A22 A23  (B.35)
 A31 A32 A33 

 X ( s )
 
W (s) = Y (s)  (B.36)
 Z ( s ) 

 Fx ( s ) 
 
F ( s ) =  Fy ( s )  (B.37)
 Fz ( s ) 

 x0 
w0 =  y0  (B.38)
 z0 

Pre-multiplying eqn. (B.34) by the inverse of the matrix ( sI − A ) , eqn. (B.34) becomes

W ( s ) = ( sI − A ) F ( s ) + ( sI − A ) w0
−1 −1
(B.39)
408  Differential Equations: A Problem Solving Approach Based on MATLAB

The solutions x(t), y(t) and z(t) are obtained by taking the inverse Laplace transform of
eqn. (B.39). The use of Laplace transforms in solving coupled first order equations will
now be demonstrated. Consider the following set of linear coupled first order equations
x ' =− x − 2 y + t , x ( 0 ) =−1
(B.40)
y ' = x − y + e−t , y ( 0 ) = 1

The coefficient matrix is


 −1 −2 
A=  (B.41)
 1 −1
The Laplace transform set of the forcing functions F(s) is

 s −2 
F (s) =  −1  . (B.42)
( s + 1) 
The initial conditions are
 −1
w0 =   (B.43)
1
The Laplace transform of the differential equation becomes
 ( s −2 − 1) ( s + 1) 1 + ( s − 1) 
−1

 − 2 
 X ( s )  s 2 + 2s + 3 s 2 + 2s + 3 
 = . (B.44)
 Y ( s )   ( s −2 − 1) ( s + 1) 1 + ( s − 1)  
−1

 s 2 + 2 s + 3 + s 2 + 2s + 3 
Taking the inverse Laplace transforms leads to

t et 7
x ( t ) = − − e − t cos
3 3 9
( 2t ) − 8 92 e −t
sin ( 2t ) + 19
(B.45)
t et 8
x ( t ) = + + e − t cos
3 3 9
( 2t ) − 187 e −t
sin ( 2t ) − 92
The results of the various steps and the solution set and verification of the solution
set appears with the appropriate MATLAB code below.
clear all;close all;clc
syms x(t) y(t) z(t) t s
A=[-1,-2;1,-1];% coefficient matrix
B=sym(s*eye(2)-A); % this sI-A
disp(‘B=sI-A’)
disp(‘ ’)
disp(B)
f=[t;exp(-t)];% forcing functions
F=laplace(f,t,s);
disp(‘Display the Laplace transform of the forcing functions’)
Appendices 409

disp(F)
w0=[-1;1];
disp(‘Display the initial conditions’)
disp(w0)
W=inv(B)*(F+w0);
disp(‘display the Laplace transform of x(t) and y(t) as a vector’)
disp(W)
w=ilaplace(W,s,t); % solution set
disp(‘Display the solution set using Laplace transforms’)
disp(w)
xt=w(1);
yt=w(2);
% get the solution using dsolve
[xtd,ytd]=dsolve(‘Dx=-x-2*y+t’,‘Dy=x-y+exp(-t)’,‘x(0)=-1’,‘y(0)=1’);
% verify that the solutions match: find the difference between the two
% solutions
disp(‘Display the solution set from dsolve’)
disp(simplify(xtd,‘steps’,100))
disp(simplify(ytd,‘steps’,100))
disp(‘Verify that the Laplace solution is correct: Obtain the symbolic difference between
the two solutions’)
disp(‘Difference will be [0;0] if the approach is correct’)
disp(simplify([xt-xtd;yt-ytd],‘steps’,100)) % must give a null vector if the solutions match
B=sI-A
[ s + 1, 2]
[ -1, s + 1]
Display the Laplace transform of the forcing functions
1/s^2
1/(s + 1)
Display the initial conditions
-1
1
display the Laplace transform of x(t) and y(t) as a vector
((1/s^2 - 1)*(s + 1))/(s^2 + 2*s + 3) - (2*(1/(s + 1) + 1))/(s^2 + 2*s + 3)
(1/s^2 - 1)/(s^2 + 2*s + 3) + ((1/(s + 1) + 1)*(s + 1))/(s^2 + 2*s + 3)
Display the solution set using Laplace transforms
t/3 - exp(-t) - (exp(-t)*(cos(2^(1/2)*t) + 11*2^(1/2)*sin(2^(1/2)*t)))/9 + 1/9
t/3 + (11*exp(-t)*(cos(2^(1/2)*t) - (2^(1/2)*sin(2^(1/2)*t))/22))/9 - 2/9
Display the solution set from dsolve
t/3 - exp(-t) - (exp(-t)*cos(2^(1/2)*t))/9 - (11*2^(1/2)*exp(-t)*sin(2^(1/2)*t))/9 + 1/9
t/3 + (11*exp(-t)*cos(2^(1/2)*t))/9 - (2^(1/2)*exp(-t)*sin(2^(1/2)*t))/18 - 2/9

Verify that the Laplace solution is correct: Obtain the symbolic difference between the two
solutions
Difference will be [0;0] if the approach is correct
0
0

Appendix C

Phase Plane Plots

C-1 Phase Planes 410

C-1 Phase Planes
While D-field plots provide insight into the behavior of a first order differential
equation, an analogous display can be used to understand the stability of systems
described by a pair of coupled first order differential equations or a second order
differential equation. While D-field displays the directional changes in t-y(t) domain,
the phase plane plots display the directional changes in the fields in the x(t)-y(t) domain
where x(t) and y(t) are the solutions of a pair of coupled first order equations. For the
case of a second order homogeneous system, the phase plane plots display the changes
in the y(t)-y’(t) domain. These plots can point to the state of equilibrium that exists
in the system described by the two first order equations or a second order differential
equation. Because the analytical solutions are always available for the case of a pair of
homogeneous first order linear differential equations and second order homogeneous
linear systems, the generation of these plots is simple and straightforward. Consider
a pair of first order homogeneous differential equations
  x1' ( t )  − x1 ( t ) + 2 x2 ( t ) 
= x ' ( t ) =    . (C.1)
 x2 ( t )   2 x1 ( t ) + x2 ( t ) 
'

The coefficient matrix associated with the system is


 −1 2 
A=  . (C.2)
 2 1
The first step is the creation of samples of the two differential equations. A grid of
x1-x2 values is chosen using meshgrid(.) and samples of the two equations at each of
these locations of the grid are calculated using the given set of differential equations.
As explained earlier in connection with the D-field patterns associated with first order
differential equations, quiver(.) allows the display of small arrows indicating the
direction in which the derivatives move. The analytical solutions can then be obtained
using dsolve(.) and are superimposed. Several samples of the analytical solutions are
obtained by choosing initial conditions (varying the unknown constants). The direction
of movement of the arrows with respect to the critical point suggests the stability of
the system. The critical point is defined by
Appendices 411

 0  − x1 ( t ) + 2 x2 ( t ) 
x ' (=
t ) =    . (C.3)
0   2 x1 ( t ) + x2 ( t ) 
The trajectories also suggest the nature of the critical point. This conclusion may be
drawn from the eigenvalues of the coefficient matrix. The MATLAB® code and results
are displayed below.
clear all;close all;
A=[-1,2;2,1];
[x1,x2]=meshgrid(-4:.5:4,-4:.5:4);
DX1=A(1,1)*x1+A(1,2)*x2;
DX2=A(2,1)*x1+A(2,2)*x2;
quiver(x1,x2,DX1,DX2,1),xlabel(‘x_1(t)’),ylabel(‘x_2(t)’)
hold on
syms x y t
[xt,yt]=dsolve(‘Dx=-x+2*y’,‘Dy=2*x+y’); % get the analytical solution
x1t=MATLABFunction(xt);
x2t=MATLABFunction(yt);
tt=0:.1:.5;
C=-4.5:1:4.5; % pick the unknown constants; use the same value for C1 and C2
L=length(C);
for k1=1:L
for k2=1:L
plot(x1t(C(k1),C(k2),tt),x2t(C(k1),C(k2),tt))
end;
end;
xlim([-4,4]),ylim([-4,4])
lambda=eig(sym(A))

lambda =

5^(1/2)
-5^(1/2)
412  Differential Equations: A Problem Solving Approach Based on MATLAB

One of the eigenvalues is positive indicating that the system is unstable as seen
by the trajectories moving away from the critical point [0,0]. Examining the plot also
demonstrates that the critical point is a ‘saddle point’.

Another example shown here corresponds to the coefficient matrix


 −2 −2 
A=  . (C.4)
3 1
The MATLAB code and the results are displayed below.
clear all;close all;
A=[-2,-2;3,1];
[x1,x2]=meshgrid(-4:.5:4,-4:.5:4);
DX1=A(1,1)*x1+A(1,2)*x2;
DX2=A(2,1)*x1+A(2,2)*x2;
quiver(x1,x2,DX1,DX2,1),xlabel(‘x_1(t)’),ylabel(‘x_2(t)’)
hold on
syms x y t
[xt,yt]=dsolve(‘Dx=-2*x-2*y’,‘Dy=3*x+y’); % get the analytical solution
x1t=MATLABFunction(xt);
x2t=MATLABFunction(yt);
tt=0:.1:.5;
C=-4.5:1:4.5; % pick the unknown constants; use the same value for C1 and C2
L=length(C);
for k1=1:L
for k2=1:L
plot(x1t(C(k1),C(k2),tt),x2t(C(k1),C(k2),tt))
end;
end;
xlim([-4,4]),ylim([-4,4])
lambda=eig(sym(A))
lambda =
- (15^(1/2)*1i)/2 - 1/2
(15^(1/2)*1i)/2 - 1/2
Appendices 413

It can be seen that the system is asymptotically stable as seen by the arrows moving
towards the center which is also the critical point. The stability is associated with the
fact that the real part of the eigenvalue is negative.
A phase portrait associated with a linear second order homogeneous differential
equation can be created similarly. The first step is to decompose the second order
differential equation into two first order ones as shown in Appendix B. This allows
the treatment of a second order differential equation as a pair of first order systems in
variables y(t) and y’(t). The rest of the procedure is similar to the one described above
in connection with the phase portraits of first order coupled systems.
The example below corresponds to the differential equation
y ''+ 2 y '+ 4 y =
0 . (C.5)

The MATLAB code and results are displayed.


clear all;close all;
% y”+2y’+4y=0
a=1;b=2;c=4;
A=[0,1;-c/a,-b/a];
[x1,x2]=meshgrid(-4:.5:4,-4:.5:4);
DX1=A(1,1)*x1+A(1,2)*x2;
DX2=A(2,1)*x1+A(2,2)*x2;
quiver(x1,x2,DX1,DX2,1),xlabel(‘y(t)’),ylabel(‘dy(t)/dt’)
hold on
syms y t
y=dsolve(‘D2y+2*Dy+4*y=0’);
dy=diff(y,t);
414  Differential Equations: A Problem Solving Approach Based on MATLAB

fy=MATLABFunction(y);
fdy=MATLABFunction(dy);
tt=0:.1:.5;
C=-4:1:4;
L=length(C);
for k1=1:L
for k2=1:L
plot(fy(C(k1),C(k2),tt),fdy(C(k1),C(k2),tt))
end;
end;
xlim([-4,4]),ylim([-4,4])

Appendix D

Elements of Linear Algebra

D-1 Concept of Matrices, Echelon and Reduced Echelon 415


forms, and, Determinants
D-2 Inverse of a Matrix 423
D-3 Characteristic Equation, Eigenvalues and Eigenvectors 424
D-4 Defective Matrices and Generalized Eigenvectors 427
D-5 Use of Eigenvalues and Eigenvectors 430
D-6 Generalized Eigenvectors and the Fundamental Matrix 435
D-7 Solutions to Coupled First Order Systems Using the Concept of the 441
Fundamental Matrix

D-1 Concept of Matrices, Echelon and Reduced Echelon Forms, and,


Determinants
A matrix is a collection of numbers arranged in a rectangular or square form. For
example, if there are m rows and n columns of numbers, the matrix has a size of [m
x n] and is written as
 a11 a12  a1n 
a a22  a2 n 
 21
A= . . .  . (D.1)
 
 . . . 
 am1 am 2  amn 
If the number of columns is 1, the matrix is of size [m x 1] and is also identified as a
vector (column vector). For example, if one takes the first column of the matrix A in
eqn. (D.1), the resulting vector is
 a11 
a 
 21 
 .  ⇒ R m . (D.2)
 
 . 
 am1 
416  Differential Equations: A Problem Solving Approach Based on MATLAB

Thus, any column of the matrix A is [m x 1] matrix or Rm vector. If m=n, the matrix
in eqn. (D.1) is a square one. If a new matrix C is obtained by scaling A by a constant
c, each element of the matrix is scaled by c,
 ca11 ca12  ca1n 
 ca 
 21 ca22  ca2 n 
C =  .
= cA . .  . (D.3)
 
 . . . 
cam1 cam 2  camn 

If there are two matrices, A of size [m x n] and B of size [r x p], the product AB
exists only when n=r and the resulting matrix will be of size [m x p]. Consider the
simple example with A being a [3 x 3] matrix and B being a [3 x 2] matrix. The product
AB will be of size [3 x 2] as shown clearly demonstrating the procedure requiring
multiplication and addition of elements.
3 4 5 
A =  6 7 8  (D.4)
 2 9 10 

a b
B =  c d  (D.5)
 e f 
3* a + 4 * c + 5* e 3* b + 4 * d + 5* f 
AB = 6 * a + 7 * c + 8* e 6 * b + 7 * d + 8* f  (D.6)
 2 * a + 9 * c + 10 * e 2 * b + 9 * d + 10 * f 
The multiplication principle clearly suggests that AB ≠ BA. In eqn. (D.6), * represents
the product.
Two matrices A and B are equal only when they have the same sizes and there
exists an element-by-element match between A and B.
The addition and subtraction of matrices requires that the matrices be of equal
sizes and the sum or difference is obtained by taking an element-by-element subtraction
or addition. Let the matrix C be a [3 x 3] matrix
 a1 b1 c1 
C =  d1 e1 f 1
  (D.7)
 g1 h1 k1 
The sum or the difference of the two matrices, A and C will be
 3 ± a1 4 ± b1 5 ± c1 
A ± C =  6 ± d1 7 ± e1 8 ± f 1  . (D.8)
 2 ± g1 9 ± h1 10 ± k1
Appendices 417

If the rows and columns of a matrix A are interchanged, the new matrix is its transpose,
expressed as AT. If a square matrix and its transpose are equal (element-by-element),
the matrix said to be symmetric. There are two other types of matrices that will be
seen in the study of differential equations. First one is a null matrix and the second
one is an identity matrix. If all the elements of a matrix are 0’s, the matrix is referred
to as a null matrix,
0 0 0
0 0 0 
Z = . (D.9)
0 0 0
 
0 0 0
Therefore, if two matrices are equal, the difference of the two matrices will be a null
matrix. An identity matrix on the other hand is a square matrix where the elements
along the diagonals are 1’s. Rest of the elements are 0’s. An [n x n] identity matrix
is represented as In,
1 0 0 0 
0 1 0 0 
I4 =   . (D.10)
0 0 1 0 
 
0 0 0 1 
A few other characteristics and properties associated with matrices also are useful. To
appreciate some of these features, consider the following matrix A
 2 −3 2 5 
A =  2 −2 −2 6  . (D.11)
 2 −3 2 8 
Matrices can be manipulated by performing row operations (no column operations!).
This principle comes from the fact that a set of linear equations are solved by adding,
subtracting or scaling the equations. For example eqn. (D.11) can be used to represent
a set of equations whose coefficients form the matrix A as in
2 x1 − 3 x2 + 2 x3 + 5 x4 =
b1
2 x1 − 2 x2 − 2 x3 + 6 x4 =b2 . (D.12)
2 x1 − 3 x2 + 2 x3 + 8 x4 =
b3
Equation (D.12) can be expressed as in the form of a matrix equation (also known as
a matrix-vector equation) as
 
Ax = b . (D.13)
 
In eqn. (D.13), x is a [4 x 1] matrix or R4 vector and b is a [3 x 1] matrix or R3 vector,
 x1 
x 

x =  2  . (D.14)
 x3 
 
 x4 
418  Differential Equations: A Problem Solving Approach Based on MATLAB

b 
  1
b = b2  . (D.15)
b3 
Square matrices have a few additional features and properties that are very useful
in the study of differential equations. For a square matrix, the determinant of a square
matrix is a single valued quantity. If P is a [2 x 2] matrix, its determinant is
a b 
 c d  ⇒ det ( P ) =
P= ad − bc . (D.16)
 
But, the determinants of sizes larger than [2 x 2] require additional manipulations.
Consider the matrix Q given by
a b c
Q =  d e f  (D.17)
 g h k 
Its determinant is given by
Q a * [ e * k − f * h ] - b [ d * k − f * g ] + c [ d * h - e * g ] (D.18)
det ( Q ) ==

In other words, the determinant of Q can be expressed in terms of determinants of


matrices of smaller sizes as
e f d f d e
=det ( Q ) a - b + c . (D.19)
h k g k g h
If the matrix W is of size [n x n] with elements wij, i=1,2,..,n and j=1,2,..,n, the
determinant of W is expressed as
n
det (W=) ∑ ( −1) w1 j det (W1 j ) .
1+ j
(D.20)
j =1

Note that in eqn. (D.20), W1j is the matrix obtained by removing the elements of
the 1st row and jth column of W. It should also be noted that a more general way of
representing eqn. (D.20) is
n

∑ ( −1) wij det (Wij ) , i =


det (W ) =
i+ j
1, 2, n . (D.21)
j =1

Equation (D.21) suggests that the det(W) can be evaluated using any one of the rows.
The results can be generalized to any row being replaced by a column in which case
the summation is carried over the rows. Equation (D.20) is also called a cofactor
expansion across the first row.
Another interesting and useful matrix arises from taking the product of a square
matrix with itself. If A is a square matrix, then the product of k (k being a positive
integer) copies of A is

Ak = 
A * A
*A . (D.22)
k − products
Appendices 419

If A is invertible (its determinant is not zero), it is possible to define negative powers


of A as

A− k
= (=
A )
−1 k
A−1 * A−1 * A−1
 . (D.23)
k − products

Observation of eqns. (D.22) and (D.23) results in


A− k * A=
k 0
A= I k . (D.24)
The powers of matrix will be used later when the topic of generalized eigenvectors
is discussed. The concept of the inverse of a matrix represented as A-1 will also be
discussed later.
Going back to the basic form of a matrix, one can obtain echelon form (row
echelon form) and reduced echelon form (row reduced echelon form) of the matrix.
For example, consider the matrix in eqn. (D.11). Using row manipulation (replacing
any row with the sum or difference of any other rows or replacing the row with all
elements of that row scaled by a constant or interchanging rows), one can get the
following matrix
 2 −3 2 5 
= A 1  0 1 −4 1 
  . (D.25)
 0 0 0 −3
The matrix A1 is said to be in echelon form of A in eqn. (D.11) since
1. All nonzero rows are above any rows of all zeros.
2. Each leading entry of a row is in a column to the right of the leading entry of the
row above it.
3. All entries in a column below a leading entry are zeros.
Further row operations leads to the matrix A2 as
1 0 −5 0 
= A2 0 1 −4 0  (D.26)
0 0 0 1 
The matrix M2 is referred to as the row reduced echelon form (RREF) of A in eqn.
(D.11) since
1. The leading entry in each nonzero row is 1.
2. Each leading 1 is the only nonzero entry in its column.
3. Columns # 1, 2 and 4 are pivot columns and the 1’s in these columns are location
of the pivots.
To understand the usefulness of row reduction techniques, consider a set of linear
equations,
a11 x1 + a12 x2 +  + a1n xn =
b1
a21 x1 + a22 x2 +  + a2 n xn =
b2
. (D.27)

am1 x1 + am 2 x2 +  + amn xn =
bm
420  Differential Equations: A Problem Solving Approach Based on MATLAB

The set of equations in eqn. (D.27) can be expressed in matrix form as

Ax b (D.28)

In eqn. (D.28), A is called the coefficient matrix of size [m x n] and x [n x 1] matrix

and b [m x 1] matrix are vectors.
 a11 a12  a1n 
a a22  a2 n 
 21
A= . . .  . (D.29)
 
 . . . 
 am1 am 2  amn 

 x1 
 
 x
x =  2 (D.30)
 
 
 xn 

 b1 
  b2 
b=  (D.31)
 
 
bm 
Using these representations, the system of equations can also be expressed as
 a11 a12  a1n   b1 
a   x1   
 21 a22  a2 n     b2 
x
 . . .   2  =  .  . (D.32)
  .   

 . . .    . 
x
 am1 am 2  amn   n  bm 
Equations (D.28) and (D.32) are the matrix equations or matrix-vector equations
corresponding
 to the system of equations in eqn. (D.27). By concatenation of A and
b leads to the augmented matrix D as
 a11 a12  a1n b1 
a a22  a2 n b2 
 21
D= . . . .  (D.33)
 
 . . . . 
a am 2  amn bm 
 m1
Note that if m < n, the number of equations is less than the number of variables
(underdetermined system) and if m > n, the number of equations exceed the number

of variables (over determined system). Note that a unique solution for x can exist
(not assured) only if m > n. In other words, a unique solution may or may not exist
Appendices 421

if m > n and with m < n, no unique solutions will ever exist. It is also possible that
the system of equations is inconsistent and no solution ever exists. All these can be

understood by performing row operations. Note that if b is a null vector (all elements
are zeros), eqn. (D.32) represents a homogeneous system. Otherwise, the system is
a non-homogeneous one.
Consider a homogeneous system with a coefficient matrix A from eqn. (D.11),
 x1 
 2 −3 2 5    0 
   x2  0 
 2 −2 −2 6   x  =   . (D.34)
 2 −3 2 8   x  0 
3

 4
Creating the augmented matrix and performing row reduction operation leads to
 2 −3 2 5 0  rref 1 0 −5 0 0 
 2 −2 −2 6 0  ⇒ 0 1 −4 0 0 
    . (D.35)
 2 −3 2 8 0  0 0 0 1 0 
It can be seen that the locations of the pivots in eqn. (D.35) are identical to those in eqn.
(D.26) and there is no pivot in the last column. The RREF shows the pivot locations
and those correspond to the basic variables (x1, x2 and x4) and x3 is the free variable.
To interpret these results, the augmented matrix in RREF can be converted into the
corresponding set of equations as
x1 + 0 x2 − 5 x3 + 0 x4 =
0
0 .
0 x1 + x2 − 4 x3 + 0 x4 = (D.36)
0 x1 + 0 x2 + 0 x3 + x4 =
0
Equation (D.36) can be rewritten in vector form as
 x1   5 
 x  4
= 2  =  x v x (D.37)
 x3  1  3 3 3

   
 x4   0 
Equation (D.37) connects the pivots with the basic variables and the notion of the

free variable and basic variables are understood. The vector v3 is identified as the null
space of the matrix A. The null space of a matrix A is the set of all solutions of the
homogeneous equation Ax = 0 .
Consider the case where homogeneous
 system in eqn. (D.34) is converted into a
non-homogeneous with a vector , b
 x1 
 2 −3 2 5    0 
   x2  5  . (D.38)
 2 −2 −2 6   x  = 
 2 −3 2 8   x   3 
3

 4
422  Differential Equations: A Problem Solving Approach Based on MATLAB

The RREF of the augmented matrix now becomes


 2 −3 2 5 0  rref 1 0 −5 0 3.5
   
 2 −2 −2 6 5  ⇒ 0 1 −4 0 4  . (D.39)
 2 −3 2 8 3  0 0 0 1 1 
Notice that the pivot locations remain the same as in eqn. (D.35) for the non-
homogeneous case and the RREF becomes
x1 + 0 x2 − 5 x3 + 0 x4 =3.5
0 x1 + x2 − 4 x3 + 0 x4 =4 . (D.40)
0 x1 + 0 x2 + 0 x3 + x4 =
1
Thus, free and basic variables are identical to those associated with the homogeneous
system and the solution can now be expressed as
 x1   5  3.5
 x  4  
 2  =  x +  4  =ν x + p . (D.41)
 x3  1  3  0  3 3

     
 x4   0  1 

In eqn. (D.41), the vector ν 3 has remained the same and the solution is expressed in

terms of the solution of the homogeneous part with the addition of the vector p . It
is clear that if the RREF of a square coefficient matrix of size [n x n] has n pivots,
the corresponding homogeneous equation only has trivial solutions and there is no
null space for such a matrix. If there is a pivot in the last column of the RREF of an
augmented matrix, the system is inconsistent and no solutions exist.
Consider an augmented matrix D and its RREF shown below.
 3 −7 −2 −7  rref 1 0 0 3 
 −3 5 1
D= 5  ⇒ 0 1 0 4  .
 (D.42)
 6 −4 0 2  0 0 1 −6 
The augmented matrix in eqn. (D.42) corresponds to a non-homogeneous system. It
can be seen that there are three pivots and three variables and therefore, the variables
are all basic. The solution is
 x1   3 
x  =  4 
 2    . (D.43)
 x3   −6 
The coefficient matrix in eqn. (D.42) is a [3 x 3] square matrix. The system of equations
in eqn. (D.42) has unique solutions. Such a system of equations can also be solved
using other approaches using the inverse of the matrix which is discussed next.
Appendices 423

D-2 Inverse of a matrix
Another important property of a matrix that becomes useful in solving coupled
differential equations is the inverse of a matrix introduced in eqn. (D23) and
eqn. (D.24). The inverse of a square matrix A exists only if
det ( A ) ≠ 0 . (D.44)

The matrix A and its inverse A-1 are related through the property (seen in eqn. (D.23))

AA−1= I= A−1 A . (D.45)


A 2 x 2 matrix and its inverse are
a b  −1 1  d −b 
A 
=  ⇒ A= . (D.46)
 c d  ( ad − bc )  −c a 
It can be seen that eqn. (D.45) is valid. Note that det(A) and det(A-1) are equal. For
matrices of size larger than 2 x 2, the inverse of the matrix is obtained through the
following procedure. If A is an n x n matrix, create a new matrix A by (horizontal)
concatenating it with an identity matrix (on the right) and calculate the RREF. The
inverse of A will be the n x n elements on the right and the remaining n x n elements
will constitute an identity matrix.
B =[ Anxn I n ] ⇒ rref ( B ) = I n A−1  . (D.47)

Consider the matrix


3 2 
A=  (D.48)
5 6 
Its determinant is 8 and hence, the matrix is invertible. An invertible matrix is also
called a nonsingular matrix while a square matrix that cannot be inverted is called a
singular matrix. Using eqn. (D.46), the inv(A) becomes
 3 1
− 
1  6 −2   4
−1 4
=A =   . (D.49)
8  −5 3   5 3 

 8 8 
Proceed along the lines of eqn. (D.47),
 3 1
 1 0 − 
 3 2 1 0  4 4
=B  ( B) 
 ⇒ rref =  . (D.50)
 5 6 0 1  0 1 − 5 3 
 8 8 
Comparing eqns. (D.49) and (D.50), it can be seen that eqn. (D.47) offers a means to
obtain the inverse of a square matrix.
424  Differential Equations: A Problem Solving Approach Based on MATLAB

Matrix inversion offers a simple means to solve a matrix vector equation such as
the one in eqn. (D.28). If A is a square matrix and determinant of A exists, multiplying
eqn. (D.28) from the left by A-1 leads to
 
A−1 Ax = A−1b . (D.51)
Using eqn. (D.45), eqn. (D.51) becomes
   
I n x = A−1b ⇒ x = A−1b . (D.52)

In other words, the solution to the matrix equation is obtained by taking the product

of A-1 with b .
The invertibility of matrix A also can be used in another way to obtain the solution
vector of the matrix equation in eqn. (D.28) using Cramer’s Rule. For the [n x n]
invertible matrix A, the unique solution consists of

det ( Ai ( b ) )
=xi = , i 1, 2, , n . (D.53)
det ( A )
In eqn. (D.53), the matrix Ai(b) is the matrix obtained by replacing the ith column of

A with the vector b .

D-3 Characteristic Equation, Eigenvalues and Eigenvectors


Another aspect of matrices that is useful in the study of differential equations is the
characteristic equation of a square matrix. Consider a square matrix A and assume that
 
it is possible to write the matrix equation Ax as a scaled version of x as in
 
Ax = λ x . (D.54)

In eqn. (D.54), A is a matrix of size [n x n] and x is vector of size [n x 1] and λ is a

scalar quantity. The right hand side can be rewritten by multiplying x from the left
by an identity matrix In as
  
= λ=
Ax x λ I n x . (D.55)

Rewriting eqn. (D.55) leads to



[ A − λ In ] x =
0 (D.56)

A non-trivial solution exists for eqn. (D.56) only when the determinant of the matrix
on the left hand side is zero,
A − λ In =
0 . (D.57)
Equation (D.57) is called the characteristic equation associated with the matrix and
its solutions are referred to as the eigenvalues of the matrix A. For example, consider
a [2 x 2] matrix
1 3 
A=  . (D.58)
2 2
Appendices 425

Equation (D.57) becomes



1 3  λ 0  1 − λ 3 
( A − λ I ) = −  = ⇒ det ( A − λ I ) =(1 − λ )( 2 − λ ) − 6 .
2 2  0 λ   2 2 − λ 
(D.59)
The characteristic equation becomes

λ 2 − 3λ − 4 = 0 ⇒ ( λ − 4 )( λ + 1) = 0 (D.60)

The solutions to eqn. (D.60) are the eigenvalues and in this case, the eigenvalues are
λ1=-1 and λ2=4. With the availability of eigenvalues, a solution to eqn. (D.56) can be
found. Equation (D.56) associated with the first eigenvalue is
 1 − λ1 3   0 
[ A − λ1 I n ]ν 0⇒
=
2 − λ1 
v=
0  . (D.61)
 2  
 2 3   0 
 2 3 v =  0  (D.62)
     

Note that in eqns. (D.61) and (D.62) v replaces x and the solution vector v is
identified as the eigenvector associated with the eigenvalue of λ1=-1. Writing eqn.
(D.62) using the concept of augmented matrices, the augmented matrix associated
with the matrix equation (D.61) is
 3 
 2 3 0  rref 1 0
2 3 0  ⇒ 2 . (D.63)
  
 0 0 0 
Note that the first row of eqn. (D.63) corresponds to the linear equation
3
v1 + v2 =
0 . (D.64)
2
This leads to
 3
 v1   − 
=
v   2  (D.65)
 2
 1 
The eigenvector associated with λ1=-1 is therefore,
 3


ν =  2  . (D.66)
 
 1 
The eigenvector is also obtained directly using the MATLAB® command null() as
shown below. The use of symbolic toolbox will yield the vector in rational form.
Both results are given.
426  Differential Equations: A Problem Solving Approach Based on MATLAB

v=null(sym([2,3;2,3]))
v=
-3/2
1
v=null([2,3;2,3])
v=
-0.8321
0.5547
Proceeding similarly, the eigenvector associated with λ2=4 becomes
 1
ν =   . (D.67)
1
Eigenvalues and eigenvectors can easily be obtained using MATLAB. The use of the
symbolic toolbox will make the numerical values appear as rational numbers.
[V,lambda]=eig(sym([1,3;2,2]))
V=
[ -3/2, 1]
[ 1, 1]
lambda =
[ -1, 0]
[ 0, 4]
If the symbolic toolbox is not used, the values appear in decimal notation as in

>> [V, lambda]=eig([1,3;2,2])


V=
-0.8321 -0.7071
0.5547 -0.7071
lambda =
-1 0
0 4
The first column of the matrix V is the eigenvector associated with the first eigenvalue
of -1 and the second column of V is the eigenvector associated with the second
eigenvalue of 4. Eigenvalues appear as diagonal elements of the matrix lambda. In
general, eigenvalues and eigenvectors can be real or complex. If complex eigenvalues
exist, they appear as a conjugate pair. Consider the matrix
1 −2 
A=  . (D.68)
3 1 
The eigenvalues and eigenvectors are
 0.8166 j 
λ=
1 + 2.4495 j; ν =
 
 1 
(D.69)
  −0.8166 j 
λ=
1 − 2.4495 j; ν =
 
1  
Appendices 427

The two examples discussed so far dealt with matrices with distinct eigenvalues and
distinct eigenvectors. It must be noted that when complex eigenvalues exist, they
appear as a conjugate pair and are therefore always distinct.

D-4 Defective Matrices and Generalized Eigenvectors


In solving coupled first order differential equations, cases arise when the eigenvalues
might be equal with the possibility that eigenvectors might be or might not be distinct.
Consider the case of a matrix B,
2 0
B=  . (D.70)
0 2
This leads to a pair of equal eigenvalues with distinct eigenvectors,
 0 
= λ1 2;=ν  
1 
(D.71)
 1 
= λ2 2;=ν  
0 
Now consider the case of a matrix A
 −1 1 
A=  . (D.72)
 −1 −3
The eigenvalues and eigenvectors are
  −1
λ1 =
−2; ν =
 
1
. (D.73)
 −1

λ2 =
−2; ν =
1
 
It is clear from eqn. (D.73) that the two eigenvectors are identical. In other words, the
number of distinct eigenvectors is only 1 even though the number of eigenvalues is 2.
A matrix with fewer distinct eigenvectors than the number of eigenvalues is referred
to as a defective matrix. In this case, the algebraic multiplicity (p) is 2 (number of
equal eigenvalues) while the geometric multiplicity (m) is only 1 (distinct pairs of
eigenvectors). Note that for symmetric matrices in eqn. (D.70), the algebraic and
geometric multiplicities are equal. Therefore, symmetric matrices will not be defective.
The matrix in eqn. (D.72) is not symmetric and it is defective.
Now consider the following matrix
2 4 3
 4 −6 −3 .
A =− (D.74)
 
 3 3 1 
428  Differential Equations: A Problem Solving Approach Based on MATLAB

The eigenvalues and eigenvectors are


1
λ1 = 1; ν =  −1

 1 
 −1
  
λ2 = −2; ν = 1 (D.75)
 0 
 −1
λ3 = 1
−2; ν =

 
 0 
In this case, there exist a pair of equal eigenvalues equal to -2 (algebraic multiplicity
p=2); But, the corresponding eigenvectors are not distinct (geometric multiplicity
m=1). There is an additional eigenvalue of unity and a corresponding distinct
eigenvector. Consider the case of the following matrix
 −3 −1 −6 
 2 −1 −4  .
A =− (D.76)
 
 1 0 1 
The corresponding eigenvalues and eigenvectors are
 −2 
λ1 =  −2 
−1; ν =

 
 1 
 −2 
λ2 =  −2 
−1; ν =

(D.77)
 
 1 
 −2 
λ3 =  −2 
−1; ν =

 
 1 
The defective matrix A has an algebraic multiplicity p=3 and geometric multiplicity
m=1. These matrices in eqn. (D.74) and eqn. (D.77) are also considered as defective
because m<p.
To accommodate defective matrices lacking distinct eigenvectors (we expect
each eigenvalue paired with an eigenvector), the concept of generalized eigenvectors
is needed. Generalized eigenvectors are solutions of
p 
[ A − λ I n ] ν =0, p =2,3, . (D.78)
Appendices 429

Note that for p=1, eqn. (D.78) is identical to eqn. (D.61). Now, consider the matrix
in eqn. (D.72) which has an algebraic multiplicity of 2 (p) and geometric multiplicity
of 1. Equation (D.78) becomes
p 
[ A − λ I ] ν =0, p =2 . (D.79)

Equation (D.79) becomes


2 2
   −1 1  1 0     1 1    0 0 
( A=
− λI ) v   − ( −2 )  =
2
   v  −1=
−1
v   vˆ (D.80)
  −1 −3 0 1    0 0 
Using the null(.) command in MATLAB, leads to the following result:
null([0,0;0,0])
ans =
1 0
0 1
1  0 
The generalized eigenvectors are 0  and 1  .
   
For the matrix in eqn. (D.74), a pair of generalized eigenvectors are needed for the
eigenvalue of -2. This means that we need to solve eqn. (D.78) for (p=2)
2 2
 2 4 3  1 0 0   4 4 3
   
[ A − λ I n ] ν =0 ⇒ ( A − λ I ) ν = −4 −6 −3 − ( −2 ) A 0 1 0  ν =−  
2  2 
 4 −4 −3 ν
 3 3 1  
  0 0 1    3 3 3 
(D.81)
Finding the null(.), we get the two generalized eigenvectors associated with the
 −1  −1
1  
eigenvalue of -2 as   and  0  .
 0   1 
For the matrix in eqn. (D.76), the algebraic multiplicity is 3 and geometric multiplicity
is 1. This means that eqn. (D.78) for (p=3)
3 3
  −3 −1 −6  1 0 0    −2 −1 −6 
   
( A − λ I ) ν =   −2 −1 −4 − ( −1) A 0 1 0   ν =  −2 0 −4 ν (D.82)
  
3  
 1 0 1  0 0 1    1 0 2 
 

This leads to
0 0 0 
0 0 0 ν = 0
  (D.83)
0 0 0 
430  Differential Equations: A Problem Solving Approach Based on MATLAB

The generalized eigenvectors are


1  0 0
0  , 1  , 0 
      . (D.84)
0  0  1 
It is clear that if the algebraic multiplicity p=n and geometric multiplicity m=1, the set
of generalized vectors match the columns of the identity matrix of size n.

D-5 Use of Eigenvalues and Eigenvectors


Eigenvalues and eigenvectors find extensive use in obtaining solutions for coupled
first order differential equations with constant coefficients. Consider a pair of first
order coupled homogeneous equations
x1 ' A11 x1 + A12 x2
=
(D.85)
x2 ' A21 x1 + A22 x2
=
The coefficient matrix
A A12 
A =  11 . (D.86)
 A21 A22 
For homogeneous equations, the expected solution will be of the form
 x1 ( t )   λt
x ( t ) =
=  ν e . (D.87)
 x2 ( t ) 

In eqn. (D.87), v is the eigenvector. It should be noted that there exist two solutions
associated with the characteristic equation
A − λI =
0 . (D.88)
 
If λ1 and λ2 are two distinct real eigenvalues with v1 and v2 being the corresponding
distinct eigenvectors, the general solution will be a linear combination of the solution
of the form in eqn. (D.87), one for each eigenvalue/eigenvector combination. Thus,
the general solution can be expressed as
 x (t )    v  v 
x ( t ) = 1  =C1ν 1eλ1t + C2ν 2 eλ2t =C1eλ1t  11  + C2 eλ2t  12  . (D.89)
 x2 ( t )  v21  v22 
Based on the elements of the coefficient matrix, it is possible that the eigenvalues and
therefore, also the eigenvectors are complex. When a set of eigenvalues are complex,
they will always form a conjugate pair. This means that a pair of eigenvalues can be
expressed as
λ1,2= λ±= α ± j β . (D.90)
Appendices 431

The corresponding eigenvectors (just as in the case of eigenvalues, these will also
form a conjugate pair) will be of the form
   
ν 1,2= ν ±= a ± jb . (D.91)
 
In eqn. (D.91), a and b are [2 x 1] and real,
  a1    b1 
= a =  , b b  (D.92)
 a2   2
The general solution can be expressed as
  x1 ( t )  α t   a1 cos ( β t ) − b1 sin ( β t )   a1 sin ( β t ) + b1 cos ( β t )  
x ( t ) =
=  e C1   + C2  
 x2 ( t )    a2 cos ( β t ) − b2 sin ( β t )   a2 sin ( β t ) + b2 cos ( β t )  .
(D.93)
The case of equal eigenvalues should be treated no differently if the eigenvectors are
distinct and the solution will be similar to eqn. (D.89) with λ1,2=α.
On the other hand, if the coefficient matrix is defective with a single eigenvector,
the solution requires the use of generalized eigenvectors. We will examine solutions
of a set of equations when the coefficient matrix is defective following the discussion
of the case of generalized vectors for larger matrices to get a general description of
solutions.
A few examples to demonstrate the use of linear algebra are now provided along
with appropriate MATLAB codes and verification.
First consider a coefficient matrix
2 3 
A=  . (D.94)
 3 −6 
The corresponding homogeneous system is
 
x ' = Ax . (D.95)
The eigenvalues and eigenvectors are obtained from MATLAB as
 1
λ1 =
−7, ν 1 =− 3 

 
 1  . (D.96)
  3
=λ2 3,=ν2  
1
The solution set corresponding to the linear system described by the coefficient matrix
in eqn. (D.94) is
 1
 −  3
=x ( t ) C1  3  e −7 t + C2   e3t . (D.97)
  1
 1 
432  Differential Equations: A Problem Solving Approach Based on MATLAB

clear all;clc;
% example worked out and verification using dsolve(.)
A=[2,3;3,-6];
[V,D]=eig(sym(A))
DD=diag(D) % eigenvalues
v1=V(:,1) % eigenvector 1 corresponding to DD(1)
v2=V(:,2)% eigenvector 2 corresponding to DD(2)
clear A
syms x y t C2 C1
[xt,yt]=dsolve(‘Dx=2*x+3*y’,‘Dy=3*x-6*y’);
xr=symvar(xt); % find the symbolic variables
yr=symvar(yt); % % find the symbolic variables
xt=subs(xt,[xr(1),xr(2)],[C2,C1]); % replace the constants to match the text
yt=subs(yt,[yr(1),yr(2)],[C2,C1]);
X=[xt;yt];
disp(X)
V=
[ -1/3, 3]
[ 1, 1]
D=
[ -7, 0]
[ 0, 3]
DD =
-7
3
v1 =
-1/3
1
v2 =
3
1
3*C2*exp(3*t) - (C1*exp(-7*t))/3
C2*exp(3*t) + C1*exp(-7*t)

The next example looks at the case of a symmetric coefficient matrix as


2 0
A=  . (D.98)
0 2
Because this is a symmetric matrix, the eigenvalues are equal with distinct eigenvectors
 1 
=λ1 2,=ν1  
0
. (D.99)
 0
=λ2 2,=ν2  
1 
Appendices 433

The solution set corresponding to the coefficient matrix in eqn. (D.95)


 1  0  C 
x ( t ) = C1   e 2t + C2   e 2t =  1  e 2t . (D.100)
0  1   C2 

The MATLAB implementation is shown below.


clear all;clc
A=[2,0;0,2];
[V,D]=eig(sym(A))
DD=diag(D); % eigenvalues
v1=V
clear A B
syms x y t C2 C1
[xt,yt]=dsolve(‘Dx=2*x’,’Dy=2*y’)
xr=symvar(xt) % find the symbolic variables
yr=symvar(yt) % % find the symbolic variables
xt=subs(xt,xr(1),C1); % replace the constants to match the text
yt=subs(yt,yr(1),C2);
X=[xt;yt];
disp(X)
V=
[ 1, 0]
[ 0, 1]
D=
[ 2, 0]
[ 0, 2]
v1 =
[ 1, 0]
[ 0, 1]
xt =
C3*exp(2*t)
yt =
C4*exp(2*t)
xr =
[ C3, t]
yr =
[ C4, t]
C1*exp(2*t)
C2*exp(2*t)

Consider, the coefficient matrix


 4 3
A=  . (D.101)
 −3 4 
The eigenvalues and eigenvectors are complex. The eigenvalues are
λ± =α + j β =4 ± 3 j (D.102)
434  Differential Equations: A Problem Solving Approach Based on MATLAB

The eigenvectors are

  1  0
a ± jb =   ± j   . (D.103)
0  1 
The solution set is

   a cos ( β t ) − b1 sin ( β t )   a1 sin ( β t ) + b1 cos ( β t )  


=x ( t ) eα t C1  1  + C2   . (D.104)
  a2 cos ( β t ) − b2 sin ( β t )   a2 sin ( β t ) + b2 cos ( β t )  
Substituting for eigenvalues and eigenvectors, the solution set becomes

  cos ( 3t )  4t  sin ( 3t ) 
=x ( t ) e 4t C1   + e C2   . (D.105)
 − sin ( 3t )  cos ( 3t ) 
The MATLAB portion including verification using dsolve(.) appears below.
clear all;
A=[4,3;-3,4];
[V,D]=eig(sym(A))
DD=diag(D) % eigenvalues
v1=V(:,1) % eigenvector 1 corresponding to DD(1)
v2=V(:,2)% eigenvector 2 corresponding to DD(2)
clear A
syms x y t C2 C1
[xt,yt]=dsolve(‘Dx=4*x+3*y’,‘Dy=-3*x+4*y’)
xr=symvar(xt) % find the symbolic variables
yr=symvar(yt) % % find the symbolic variables
xt=subs(xt,[xr(1),xr(2)],[C2,C1]); % replace the constants to match the text
yt=subs(yt,[yr(1),yr(2)],[C2,C1]);
X=[xt;yt];
disp(X)
V=
[ j, -j]
[ 1, 1]
D=
[ 4 – 3j, 0]
[ 0, 4 + 3j]
DD =
4 – 3j
4 + 3j
v1 =
j
1
v2 =
-j
1
Appendices 435

xt =
C4*cos(3*t)*exp(4*t) + C3*sin(3*t)*exp(4*t)
yt =
C3*cos(3*t)*exp(4*t) - C4*sin(3*t)*exp(4*t)
xr =
[ C3, C4, t]
yr =
[ C3, C4, t]
C1*cos(3*t)*exp(4*t) + C2*sin(3*t)*exp(4*t)
C2*cos(3*t)*exp(4*t) - C1*sin(3*t)*exp(4*t)

The final example deals with a coefficient matrix A


2 4
A=  . (D.106)
 −1 −2 
It has two equal eigenvalues, each equal to 0. But there is only a single distinct
eigenvector,
 2
ν =   . (D.107)
 −1
This means that we need another vector, one from the two generalized vectors obtained
by solving

 2 4
( A − λ I2 )
2
u=0⇒ u =
0 . (D.108)
 −1 −2 
The generalized eigenvectors are
 1 0 
νg =   . (D.109)
0 1 
The solution to the set of equations represented by eqn. (D.106) will be presented
following a formal discussion of generalized eigenvectors and the fundamental matrix.

D-6 Generalized Eigenvectors and the Fundamental Matrix


The approach of eigenvalues and eigenvectors can be extended to coupled first order
homogeneous systems of larger sizes. If the coefficient matrix is [n x n] and if the
eigenvectors are real and distinct, the solution set is expressed in vector form as
n
 
x ( t ) = ∑ Ckν k eλk t . (D.110)
k =1
436  Differential Equations: A Problem Solving Approach Based on MATLAB

If n is even and all the eigenvalues are complex conjugate distinct pairs,

 n/2
  a cos ( β k t ) − b1k sin ( β k t )   a1k sin ( β k t ) + b1k cos ( β k t )  
x ( t ) ∑ eα k t C1k  1k  + C2 k  
k =1   a2 k cos ( β k t ) − b2 k sin ( β k t )   a2 k sin ( β k t ) + b2 k cos ( β k t )  .
(D.111)
In eqn. (D.111), α k ± j β k represent the eigenvalues and a’s and b’s are the elements
of the eigenvectors.
When more than 2 coupled variables exist, the simple approach described earlier
requires generalization using the concept of the fundamental matrix, particularly when
the matrix is defective. Going back to the solution of a homogeneous system with
distinct eigenvectors, the solution in (D.89) can be expressed as

     v     v  
x ( t ) =C1 x1 ( t ) + C2 x2 ( t ) =C1 eλ1t  11   + C2 eλ2t  12   . (D.112)
 v21    v22  
In other words, if two distinct eigenvectors exist,the solution set is a linear combination

of a fundamental set of vectors X 1 ( t ) and X 2 ( t ) . The fundamental matrix X(t)
associated with the coefficient matrix A is expressed as
 
X ( t ) =  X 1 ( t ) X 2 ( t )  . (D.113)
 
In eqn. (D.113), x1 ( t ) and x2 ( t ) are given by

λ1t  v11  v 
 
= X 1 ( t ) e= v  X 2 ( t ) eλ2t  12  . (D.114)
 21  v22 
This concept can be extended to a case of a coupled differential equation in n-variables
and the general solution set of the differential equation will be
  n  n

x ( t ) X=
= (t ) C
=
n
k 1=
n
k 1
∑C =
X ( t ) ∑ C eλ ν
. (D.115)n
nt
n

 
In eqn. (D.115), xn is the eigenvector associated with the eigenvalue λn and C is the
vector of constants. As discussed earlier, it is not necessary to have distinct eigenvalues.
But, eigenvectors must be distinct. For the case of n=2,

  x (t ) 
x ( t ) =  1  . (D.116)
 x2 ( t ) 
For the case of a pair of complex conjugate eigenvalues, the components of the
 
fundamental matrix x1 ( t ) and x2 ( t ) can be written using eqn. (D.104) as

α t  a1 cos ( β t ) − b1 sin ( β t )   a sin ( β t ) + b1 cos ( β t ) 
 
X 1 ( t ) e=   X 2 ( t ) eα t  1 
 a2 cos ( β t ) − b2 sin ( β t )   a2 sin ( β t ) + b2 cos ( β t ) 
(D.117)
Appendices 437

The fundamental matrix can be generalized to n-variables as


  
X ( t ) =  X 1 ( t ) X 2 ( t )  X n ( t )  . (D.118)
  
The components of the fundamental matrix X 1 ( t ) , X 2 ( t ) , , X n ( t ), need to be modified
when the matrix defective by determining the generalized eigenvectors. If vˆgk are the
generalized vectors for k=1,2,..,n, the components of the fundamental matrix will be

   t2 2  t p −1 p −1  
X k ( t=
) eλt ν gk + t ( A − λ I n )ν gk + ( A − λ I n ) ν gk +  ( A − λ I n ) ν gk 
 2! ( p − 1)!  .
(D.119)

In eqn. (D.119), p is the algebraic multiplicity and ν gk are the solutions (generalized
eigenvector) of
p 
( A − λ In ) u = 0 . (D.120)

Note that when algebraic multiplicity is unity, eigenvectors are distinct. In this case,
only the first term in eqn. (D.119) will be retained because

( A − λ In ) v =
0 . (D.121)

Note also that n-distinct eigenvectors are obtained from eqn. (D.120) with p=1.
Several examples of coupled first order equations defined by the coefficient
matrix are examined as to whether the coefficient matrix is defective. As the size
of the coefficient matrix exceeds 3, the number of possibilities for the relationships
among the eigenvalues and eigenvectors become much more intricate and deliberate
processing is needed to identify the defective matrices and determine the algebraic
and geometric multiplicities of the specific eigenvalues. These examples were created
in MATLAB. Starting from the coefficient matrix, the results display eigenvalues and
eigenvectors, geometric and algebraic multiplicities if the matrix is defective, identify
the eigenvalues associated with the generalized eigenvectors and specific algebraic
multiplicity and generalized eigenvectors. Use of these generalized vectors can be
seen in Chapter 5.
A=[4,6,6;1,3,2;-1,-5,-2];
438  Differential Equations: A Problem Solving Approach Based on MATLAB

A=[0 1 0 0;0 0 1 0;0 0 0 1;-1 0 -2 0];

A=[0,1,2;-5,-3,-7;1,0,0];
Appendices 439

A=[2 1 -2 1;0 3 -5 3;0 -13 22 -12;0 -27 45 -25];

A=[1,-1;1,3];
440  Differential Equations: A Problem Solving Approach Based on MATLAB

A=[-2 -7 -7 -5;-3 -8 -7 -7;1 1 0 1;2 8 8 6];


Appendices 441

D-7 Solutions to Coupled First Order Systems Using the Concept of


the Fundamental Matrix
Let us now go back to eqn. (D.106) which represents a defective matrix. The
fundamental matrix X(t) can be created from the eigenvalue of 0 and the generalized
eigenvectors in terms of eqn. (D.118) and eqn. (D.119).
 1   2 4  1  1   2  1 + 2t 
X 1 ( t ) = eλt {vg1 + t ( A − λ I 2 ) vg1} =   + t 
 
  =  +t  =  
0   −1 −2  0  0   −1  −t 
(D.122)

 0   2 4  0  0   4   4t 
X 2 ( t ) = eλt {vg 2 + t ( A − λ I 2 ) vg 2 } =   + t 
 
  =  +t  =  
1   −1 −2  1  1   −2  1 − 2t 
(D.123)
The fundamental matrix X becomes
1 + 2t 4t 
X =  . (D.124)
 −t 1 − 2t 
The general solution to the first order coupled system represented by the coefficient
matrix in eqn. (D.106) is

   1 + 2t   4t 
x ( t ) =c1 x1 ( t ) + c2 x2 ( t ) =c1   + c2 1 − 2t  (D.125)
 − t   
Consider the following coefficient matrix representing a set of coupled first order
differential equations,
1 0 0 
A = 0 −2 −1 (D.126)
0 0 −2 
The eigenvalues and eigenvectors are
1 
  
λ1 1=
= v1 0  (D.127)
0 

0 
λ2,3 = 1 
−2 v2,3 =

(D.128)
 
0 
The coefficient matrix is therefore defective with the eigenvalue of -2 having an
algebraic multiplicity (p) of 2 and geometric multiplicity (m) of 1, requiring the need
for generalized eigenvectors. Generalized eigenvectors are obtained as solutions of

= 0 ⇒ ( A − ( −2 ) I 3 ) = 0
2
( A − λ I3 )
p
(D.129)
442  Differential Equations: A Problem Solving Approach Based on MATLAB

The two generalized eigenvectors are


0  0 
vg2 =1  vg3 0  .
 
= (D.130)
 
0  1 
The basic solution set can now be expressed as

1 
 t  
X 1 ( t ) = e 0 
0 
 0  0   0 
 −2 t   
) 1   e−2t
X 2 ( t ) e  1  + t ( A − (−2) I 3=
=  1 
  (D.131)
  0  
  0   0 
 0 0   0  0   0
 −2 t       −2t       −2t  −t 
X 3 ( t ) e   0  + t ( A − (−2) I 3=
= ) 0  e  0 +=  −t   e  
 1    
  1    1   0    1 
The solution to the coupled first order equations represented by the coefficient matrix is

 0   c1e 
t
1  0
    t   −2 t   −2 t    −2t −2 t 
x=( t ) c1 X 1 ( t ) + c2 X 2 ( t ) + c3 X 3 =
( t ) c1e 0 + c2 e 1  + c3e  −= t  c2 e − c3te 
0  0   1   c3 e −2t 

(D.132)
Additional examples and applications will be seen in Chapters 3 and 5.
We can use the concept of the fundamental matrix to find the particular solution
to a non-homogeneous first order system,
If X(t) is the fundamental matrix, the solution given in eqn. (D.115) implies that
an analogous solution to the non-homogeneous part can be obtained by replacing the
 
constant C by a time dependent vector p p ( t ) as
 
x ( t ) = X ( t ) p ( t ) (D.134)

Differentiating eqn. (D.144) and substituting in eqn. (D.133),


   
X ' ( t ) p ( t ) + X ( t ) p ' ( t ) = AX ( t ) p ( t ) + g ( t ) (D.135)

Note that X(t) is the fundamental matrix and therefore,


X ' ( t ) = AX ( t ) (D.136)

Substituting eqn. (D.136) in eqn. (D.135), we have


 
X ( t ) p ' ( t ) = g ( t ) (D.137)
Appendices 443

Taking the inverse of the fundamental matrix, eqn. (D.137) simplifies to


 
p ' ( t ) = X −1 ( t ) g ( t ) (D.138)
The unknown vector satisfying eqn. (D.134) is now obtained as
 
p ( t ) = ∫ X −1 (τ ) g (τ )dτ (D.139)

The particular solution to the non-homogeneous differential equation is obtained from


eqn. (D.134) as
 
x p ( t ) = X ( t ) ∫ X −1 (τ ) g (τ )dτ (D.140)

The solution in eqn. (D.140) is identified as the particular solution based on the
method of variation of parameters (similarity to the method based on Wronskian seen
in Chapters 2 and 4).

Suggested Readings

A number of excellent books and monographs devoted to the topic of differential equations and linear
algebra might provide supplementary information beyond what is covered in this book. Additionally,
several books are also available that describe the use of MATLAB® in differential equations and linear
algebra. A good source of information on the application of MATLAB is available within the help window
of MATLAB itself. A partial list of some of these resources is provided below for additional reading.

Butcher, J. C. 2016. Numerical Methods for Ordinary Differential Equations, Wiley.


Chatelin, F. (Ed.). 2012. Eigenvalues of Matrices: Revised Edition. Society for Industrial and Applied
Mathematics.
Courant, R. and Hilbert, D. 2008. Methods of Mathematical Physics, Volume 2: Differential Equations, Wiley.
Farlow, J., Hall, J. E., McDill, J. M. and West, B. H. 2007. Differential Equations & Linear Algebra, Pearson.
Golubitsky, M. and Dellnitz, M. 1999. Linear Algebra and Differential Equations Using MATLAB, Cengage.
Hairer, E., Lubich, C. and Roche, M. 2006. The Numerical Solution of Differential-algebraic Systems by
Runge-Kutta Methods. Vol. 1409, Springer.
Hunt, B. R., Llpsman, R. L., Osborn, J. E., Outing, D. A. and Rosenberg, J. M. 2012. Differential Equations
with MATLAB, Wiley.
Iseries, A. 2009. A First Course in the Numerical Analysis of Differential Equations. Cambridge University
Press.
Kreyszig, E. 2010. Advanced Engineering Mathematics, Wiley.
Lang, S. 2012. Introduction to Linear Algebra, Springer.
Lopez, C. 2014. MATLAB Differential Equations, Springer.
McKibben, M. and Webster, M. O. 2014. Differential Equations with MATLAB: Exploration, Applications,
and Theory, CRC Press.
Polking, J. C. and Arnold, O. 2003. Ordinary Differential Equations Using MATLAB, Pearson.
Ralston, A. 1962. Runge-Kutta Methods with Minimum Error Bounds. Mathematics of Computation
16(80): 431–437.
Robinson, J. C. 2004. Introduction to Ordinary Differential Equations. Cambridge University Press.
Stanoyevitch, A. 2004. Introduction to Numerical Ordinary and Partial Differential Equations Using
MATLAB, Wiley.
Tennenbaum, M. and Pollard, H. 1985. Ordinary Differential Equations, Dover.
Xie, W-C. 2010. Differential Equations for Engineers. Cambridge University Press.

Index

A Directional field 6, 27, 32, 34–36


dsolve(.) 2, 10, 18–26, 77, 99, 200, 298, 331
Asymptotically stable 32, 37, 38, 40–42, 88–90,
97, 242, 243, 246–249, 251, 263, 264, 268 E
Autonomous 1, 2, 5, 7, 31, 32, 34–36, 43, 44, 46,
77, 79 Echelon form 3
Auxiliary equation 82 Eigenvalues 3, 86–88, 236–239, 241–252, 254,
256, 258, 260, 261, 263, 265–267, 269, 271,
B 272, 276, 278, 280–282, 284, 285, 287, 288,
290, 291, 293, 295, 298, 331, 381, 382
Basic variables 421 Eigenvectors 3, 86–88, 236–239, 248, 250, 251,
Boundary conditions 10, 12, 16 254, 256, 258, 259–263, 265, 267, 269, 270,
C 272, 276, 278, 280–282, 284, 285, 287, 288,
291, 293, 295, 298, 331, 381, 382
Characteristic equation 2, 81–84, 86, 88, 89, 97, Equilibrium points 31, 32, 46, 90, 240
99, 119, 120, 122, 124, 177, 178, 181–183, Equilibrium solutions 31, 44
189–191, 193, 195–200, 233, 234, 239, 240, Euler’s method 3
252, 254, 256, 261, 263, 265, 267, 298, 381 Exact solution 10, 12, 77, 83, 121
Characteristic polynomial 3, 82 Explicit solution 18–26, 28, 29
Coefficient matrix 3, 85–88, 237–239, 241, 242,
245, 246, 248, 250, 252–263, 265–267, F
269–273, 275, 276, 278–280, 282, 284, 285, First order 1–6, 8, 9, 17, 26, 31, 32, 35, 44, 77,
287, 290, 292, 293, 295, 296, 298, 382 78, 81, 84, 85, 89, 122, 177, 186, 187, 195,
Complex eigenvectors 238 200, 236–240, 250, 268, 269, 274, 275,
Complex roots 34–36, 90, 261 279–281, 296, 298, 325, 331, 381, 382
Constant Coefficients 2, 81, 82, 97, 99, 177, 178, Forcing functions 3, 120, 179, 195, 237, 268–
181, 182, 185, 233, 236, 239, 240, 250, 268, 270, 272, 274, 275, 279–281, 296, 382
274, 279, 280, 298 Free variables 421
Coupled first order 2, 3, 84, 85, 122, 177, 236,
240, 269, 274, 275, 281, 296, 325, 331, 381, G
382
Cramer’s Rule 3 General solution 83, 97, 127, 178, 182, 199, 200,
Critical points 31, 32, 34–36, 88, 90, 97, 240– 238–240, 256, 260, 270, 271, 281, 289, 291,
251, 253, 257, 259, 262–264, 266, 268, 274, 294, 298, 331
276, 277, 279 Generalized eigenvectors 87, 239, 256, 258, 260,
265, 281, 285, 287, 288, 293, 295, 298, 331,
D 381
Gompertz’s Law 32
Defective matrix 239, 293
Dependent variable 1, 5, 9, 17, 31, 77, 81, 236 H
Dependent vectors 280
Determinant of the matrix 275 Homogeneous 2, 3, 81–85, 88, 97, 99, 119–124,
D-fields 2, 5–9, 26, 33, 35, 44, 46, 47, 77, 79 126, 127, 177, 178, 181, 182, 185, 189, 190,
Differential Equations 1–10, 17, 18, 26, 28, 31, 192–194, 196, 200, 233, 234, 236–240, 250,
32, 34–36, 44, 46, 77–79, 81–86, 88–90, 268–281, 283, 285, 286, 288, 289, 291, 294,
97, 98, 119–124, 126, 177–179, 181–200, 298, 325, 331, 381, 382
233, 234 Homogeneous linear systems 236
448  Differential Equations: A Problem Solving Approach Based on MATLAB

I P
Identity matrix 87, 239, 240, 293 Partial fractions 401
Implicit solution 10, 18, 26, 29, 30, 45, 46, 77 Particular solution 2, 3, 10, 81, 119–127, 177,
Independent solutions 238, 239 179, 181, 182, 185, 189, 191, 192, 194, 200,
Independent variable 1, 5, 9, 17, 31, 77, 81 233, 234, 268, 270, 271, 273, 278–281, 283,
Integrating factor 2, 5, 9, 10, 17, 77, 78 285, 286, 289, 291, 294, 381, 382
Inverse Laplace transform 84, 98, 99, 122, 126, Phase portraits 2, 3, 89, 90, 97, 177, 178, 240–
187, 190, 191, 193, 195, 197, 240, 253, 255, 242, 245, 246, 248, 250, 253, 255, 257, 258,
257, 258, 262, 263, 266, 267, 269, 270, 272, 262, 277, 381
273, 284, 286, 290, 292, 295, 331 Pivot columns 419
Pivots 419
L
R
Laplace transforms 2–4, 81, 84, 98, 99, 121, 122,
126, 127, 177, 179–182, 185–188, 190, 191, Reduced Row echelon form 419
193, 195–197, 199, 200, 233, 235, 236, 240, Roots 2, 3, 34–36, 43, 44, 46, 81–84, 86–91, 97,
252–258, 262, 263, 266, 267, 269, 270, 272, 99, 119, 120, 122–124, 177–180, 182–185,
273, 281, 284, 286, 290, 292, 295, 296, 298, 188–191, 193, 195–200, 233, 234, 240, 252,
331 381, 382 254, 256, 261, 263, 265, 267, 298, 381
L’Hospital Rule 32 Row vectors 179, 182
Linear 1–6, 9, 17, 77, 81, 82, 85, 97, 119, 120, Runge-Kutta method 3, 26, 85, 88, 122, 182, 185,
123, 126, 127, 181, 236, 238, 274 187, 195, 196, 233, 381
Local Truncation Error 387
S
M
Saddle points 251
Matrix 3, 85–88, 186–188, 237–242, 245, 246, Second order differential equations 2, 81, 177,
248–250, 252–263, 265–276, 278–282, 284, 254
285, 287, 288, 290–293, 295, 296, 298, 331, Separable functions 2, 9, 18, 26, 77
382 Stable, unstable, semi stable equilibrium 32
Matrix equation 88, 188, 237, 281 Superposition principle 83
Matrix inverse 419 Symmetric matrix 248
Matrix vector equation 281 System of differential equations 258
Method of undetermined coefficients 2, 119–122, System of equations 420
124–126, 177, 179, 185
Method of variation of parameters 2, 3, 119, 121, T
123, 124, 126, 127, 177, 179, 185, 200, 268,
Taylor series 385
381
Transpose of a matrix 417
Multiplicity 185, 293, 331
Multiplicity, Algebraic 293, 331
U
Multiplicity, Geometric 331
Unique solution 185
N
V
Newton’s Law 77
Node 251 Vectors 26, 28, 44, 85, 122, 124, 126, 179, 180,
Non-homogeneous 2, 81, 82, 119, 121, 122, 126, 182, 183, 189, 191, 192, 194, 199, 234,
177, 181, 185, 236, 237, 268, 269, 271, 237–240, 274, 279, 280, 281
274–280, 325, 381
Null matrix 274 W
Null space 421
Numerical methods 3, 177 Wronskian 121, 123, 126, 185, 186, 189, 190,
192, 194, 233, 234
O
Z
Oscillatory solutions 242
Zero matrix 86, 186, 275

You might also like