# Preface

This is a tutorial made solely for the purpose of education and it was designed for students taking Applied Math 0340. It is primarily for students who have some experience using Mathematica. If you have never used Mathematica before and would like to learn more of the basics for this computer algebra system, it is strongly recommended looking at the APMA 0330 tutorial. As a friendly reminder, don't forget to clear variables in use and/or the kernel.

Finally, the commands in this tutorial are all written in bold black font, while Mathematica output is in regular fonts. This means that you can copy and paste all commands into Mathematica, change the parameters and run them. You, as the user, are free to use the scripts to your needs for learning how to use the Mathematica program, and have the right to distribute this tutorial and refer to this tutorial as long as this tutorial is accredited appropriately. The tutorial accompanies the textbook Applied Differential Equations. The Primary Course by Vladimir Dobrushkin, CRC Press, 2015; http://www.crcpress.com/product/isbn/9781439851043

Introduction to Linear Algebra

# Variation of Parameters

Suppose that we know a fundamental matrix $${\bf X} (t)$$ of the vector system of homogeneous linear differential equations:

$\dot{\bf x} = {\bf P} (t)\, {\bf x} + {\bf f}(t) ,$
Here $${\bf P} (t)$$ is $$n\times n$$ matrix with continuous entries, $${\bf x} (t)$$ is an $$n-$$ column vector of unknown functions to be determined, and $${\bf f} (t)$$ is given driven column vector.

The variation of parameters method suggests to represent a particular solution of the given nonhomogeneous system of differential equations in the form
${\bf x}_p (t) = {\bf X} (t)\, {\bf u}(t) .$
To determine the unknown column-vector $${\bf u} (t),$$ we substitute this form of solution into the driven vector equation to obtain
$\dot{\bf x}_p (t) = \dot{\bf X} (t)\,{\bf u}(t) + {\bf X} (t)\, \dot{\bf u}(t) = {\bf P} (t)\,{\bf X} (t)\, {\bf u}(t) + {\bf f} (t).$
Since $$\dot{\bf X} (t) = {\bf P} (t)\, {\bf X}(t),$$ we have
${\bf X} (t)\, \dot{\bf u}(t) = {\bf f} (t) \qquad\mbox{or} \qquad \dot{\bf u}(t) = {\bf X}^{-1} (t)\, {\bf f} (t) .$
Integration yields
${\bf u} (t) = \int {\bf X}^{-1} (t)\,{\bf f}(t) \, {\text d}t + {\bf c} ,$
where $${\bf c}$$ is a column vector of arbitrary constants of integration. Then the general solution of the given driven system of differential equations becomes
${\bf x} (t) = {\bf X} (t)\,\int {\bf X}^{-1} (t)\,{\bf f}(t) \, {\text d}t + {\bf X} (t)\,{\bf c} .$
Here the term $${\bf x}_h (t) = {\bf X} (t)\,{\bf c}$$ is the general solution of the corresponding homogeneous vector equation, $$\dot{\bf x} (t) = {\bf P} (t)\,{\bf x},$$ and $${\bf x}_p (t) = {\bf X} (t)\,\int {\bf X}^{-1} (t)\,{\bf f}(t) \, {\text d}t$$ is a particular solution of the nonhomogeneous vector equation $$\dot{\bf x} (t) = {\bf P} (t)\,{\bf x} + {\bf f} (t).$$

Example:

# Variation of Parameters for constant matrices

Consider a non-homogeneous vector differential equstion with constant coefficients:

$\dot{\bf y} = {\bf A}\, {\bf y} + {\bf f} (t) ,$
where A is a given constant matrix and f(t) is a known vector-function.

Example:

A = {{0, 1, 0}, {0, 0, 1}, {-3, 11/2, 3/2}}
Out[1]= {{0, 1, 0}, {0, 0, 1}, {-3, 11/2, 3/2}}
f = {t^2 , 10, E^t}
Out[2]= {t^2, 10, E^t}
Eigensystem[A]
Out[3]= {{3, -2, 1/2}, {{1/9, 1/3, 1}, {1/4, -(1/2), 1}, {4, 2, 1}}}
MatrixExp[A t]
Out[4]= {{-(1/25) E^(-2 t) (-3 - 24 E^(5 t/2) + 2 E^(5 t)),
1/25 E^(-2 t) (-7 + 4 E^(5 t/2) + 3 E^(5 t)),
2/25 E^(-2 t) (-1 + E^(5 t/2))^2}, {-(6/25)
E^(-2 t) (-1 + E^(5 t/2))^2,
1/25 E^(-2 t) (14 + 2 E^(5 t/2) + 9 E^(5 t)),
2/25 E^(-2 t) (-2 - E^(5 t/2) + 3 E^(5 t))}, {-(6/25)
E^(-2 t) (-2 - E^(5 t/2) + 3 E^(5 t)),
1/25 E^(-2 t) (-28 + E^(5 t/2) + 27 E^(5 t)),
1/25 E^(-2 t) (8 - E^(5 t/2) + 18 E^(5 t))}}

Therefore, the matrix A has three distinct real eigenvalues: 3, -2, and 1/2
We seek a particular solution in the form:
yp = K0 + K1*t +K2*t^2 + K3*E^t ,
where vector columns K0, K1, K2, and K4 should satisfy the following (algebraic) equations

K1 = A K0 + {0,10,0}
2*K2 = A K1
0 = A K2 + {1,0,0}
K3 = A K3 + {1,0,1}

Let us denote Kj = {k1j,k2j,k3j}, then