# Topic 7 Linear systems

Given a linear system of first order differential equation with constant coefficients $\vec{y}'=A\vec{y},$ the general solution is in the form $\vec{y}=e^{At}\vec{c},$ where $e^{At}=\sum\limits_{n=0}^\infty \frac{A^nt^n}{n!}.$

It it known that for a matrix $$A$$, there is a matrix $$P$$ consists of eigenvectors and generalized eigenvectors such that $$PAP^{-1}$$ is in the form $\begin{pmatrix} J_1 & & \\ &\ddots & \\ & & J_r \end{pmatrix},$ where $$J_k$$ are the Jordan blocks.

For a $$2\times 2$$ matrix $$A$$, if it has two distinct eigenvalues $$\lambda_1$$ and $$\lambda_2$$, then $e^{At}=\begin{pmatrix} e^{\lambda_1 t}\vec{u} & e^{\lambda_1 t}\vec{v} \end{pmatrix}P^{-1},$ where $$\vec{u}$$ and $$\vec{v}$$ are eigenvectors associated to $$\lambda_1$$ and $$\lambda_2$$ respectively, and $$P=\begin{pmatrix}\vec{u} & \vec{v}\end{pmatrix}$$.

If it has a repeated eigenvalue $$\lambda$$, let $$\vec{u}$$ be a eigenvector and $$\vec{v}$$ a generalized eigenvector such that $$(A-\lambda I)\vec{v}=\vec{u}$$, then $e^{At}=\begin{pmatrix} e^{\lambda t}\vec{u} & te^{\lambda t}\vec{u} + e^{\lambda t}\vec{v} \end{pmatrix}P^{-1},$ where $$P=\begin{pmatrix} \vec{u} & \vec{v} \end{pmatrix}$$.

So to solve a linear system of first-order differential equations, we need to find eigenvalues and associated eigenvectors or generalized eigenvectors.

## 7.1 Eigenvalues and Eigenvectors

In Maple, eigenvalues, eigenvectors can be found using the command Eigenvectors which is supported by the package LinearAlgebra.

To construct a matrix or vector in Maple, one can use the Matrix() or Vector() command, or the shortcut notation <...>.

Example 7.1 Find the eigenvalues and associated generalized eigenvectors of the matrix $A:=\begin{pmatrix} -1&3\\-3&5 \end{pmatrix}$

Solution. Define the matrix using the shortcut notation.

A:=< <-1, -3> | <3, 5> > # or A:=Matrix(2,2, [-1,3,-3,5])

Load the package LinearAlgebra.

with(LinearAlgebra)

Find eigenvalues and eigenvectors of $$A$$.

Eigen:=Eigenvectors(A)

The output is ${\color{blue} {\begin{bmatrix} 2\\2 \end{bmatrix},\begin{bmatrix} 1 & 0 \\ 1 & 0 \end{bmatrix} }}.$

From the output, we see that $$1$$ is a repeated eigenvalue. The first colum in the square matrix is an eigenvector of the eigenvalue. Since the eigenvalue is repeated, there will be a generalized eigenvector. The following Maple codes shows how to find it.

IdM:=IdentityMatrix(2): # define a 2-by-2 identity matrix
u:=Column(Eigen,1): # extract the eigenvector
v:=LinearSolve(A-2*IdM, u); # solve for a generalized eigenvector

The output shows ${\color{blue}{ \begin{bmatrix} -\frac{1}{3}+\_t_{2} \\ \_t_{2} \end{bmatrix} }},$ where $$\_t_{2}$$ is a free variable that can take any value. For example, taking $$\_t_{2}=\frac13$$ and then multiply it by 3 yields an eigenvector $\begin{pmatrix} 0 \\ 1 \end{pmatrix}.$

Exercise 7.1 Find the eigenvalues and associated eigenvectors of the matrix $A:=\begin{pmatrix} 5&-3\\6&-4 \end{pmatrix}$

## 7.2 Solving Linear System of ODE

In Maple, to solve a linear system of first-order differential equations, one can use the command dsolve. Note that in Maple, the matrix multiplication operator is the . symbol instead of the * symbol. The * symbol is to be used for scalar multiplication.

Example 7.2 Solve the linear system $\begin{pmatrix} y_1' \\ y_2' \end{pmatrix} = \begin{pmatrix} -1&3\\-3&5 \end{pmatrix}\begin{pmatrix} y_1 \\ y_2 \end{pmatrix}.$

Solution. Define the linear system in matrix form.

M := Matrix(2, 2, [-1, 3, -3, 5]):
Y := <y(x), y(x)>:
LinSys := diff(Y, x) = M . Y;

Solve the linear system

dsolve(LinSys, Y);

The output shows the general solution as

${\color{blue} {\begin{pmatrix} y_1(x \\ y_2(x) \end{pmatrix} = \begin{pmatrix} \frac{e^{2 x}(3 \_C2 x +3 \_C1 -\_C2 )}{3} \\ e^{2 x}(\_C2 x +\_C1 ) \end{pmatrix} }}.$

Exercise 7.2 Solve the linear system $\begin{pmatrix} y_1' \\ y_2' \end{pmatrix} = \begin{pmatrix} 5&-3\\4&-2 \end{pmatrix}\begin{pmatrix} y_1 \\ y_2 \end{pmatrix}.$