% 2015 Differential Equations 2280-2
\documentclass[11pt,leqno]{article}
\setlength{\oddsidemargin}{0in} \setlength{\evensidemargin}{0in}
\setlength{\textwidth}{6.4in} \setlength{\textheight}{9.5in}
\setlength{\parskip}{5pt} \setlength{\topmargin}{-90pt}
\setlength{\parindent}{0pt}
%\newenvironment{exercises}{\begin{list}{}{}}{\end{list}}
\newenvironment{solution}[1]{\protect\par{\bf Solution to Problem #1}.~\small\rm}{\protect\par\normalsize\rm}
%\long\def\answer#1{\begin{quote}\sf {\large\sf Answer:}\par #1\end{quote}}

\def\SeparatedPages#1{#1}
%\def\SeparatedPages#1{}
\def\prob#1#2{\item[{\normalsize\bf #1}] {\bf #2}}
\def\L{{\cal L}}
\def\dd{\displaystyle}
\def\BF#1{{\large\bf #1}}
\def\.#1{\mbox{\bf #1}}
\usepackage{linalg}
\newif\ifsolutions
\solutionstrue
\solutionsfalse
\ifsolutions
\def\Answer#1{\rule{0.2\linewidth}{0.05em}\\ {\bf Answer}: {\sf #1} \par\rule{\linewidth}{0.1em}}
\else
\def\Answer#1{\relax}
\fi

\begin{document}
\thispagestyle{empty} 
%{\large\bf Name}
%\underline{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\hfill
%{{\bf Time of your class}~\underline{~~~~~~~~~~} }
\def\EJECT{\SeparatedPages
{\vfill Use this page to start your solution.
Attach extra pages as needed, then staple.\newpage
\thispagestyle{empty} \hfill  2280 Sample Exam 2 S2015
%\newline{\large\bf Name}.
%\underline{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\hfill
}
}
%%% {\bf Time of your class}~\underline{~~~~~~~~~~} }
\def\EJECTEND{\SeparatedPages{\vfill Use this page to start your solution.
Attach extra pages as needed, then staple.\eject}}
%\def\EJECT{}\def\EJECTEND{}

\begin{center}\Large\bf
Differential Equations 2280 \\
\small Sample Midterm Exam 2 with Solutions\\
\small Exam Date: 3 April 2015 at 12:50pm
\end{center}

{\bf Instructions}: This in-class exam is 50 minutes. No
calculators, notes, tables or books. No answer check is expected.
Details count 3/4, answers count 1/4. Problems below cover the possibilities,
but the exam day content will be much less, as was the case for Exam 1.
%The first 5 problems are from
%a midterm exam in 2009, solutions appended to this PDF.
%The last two problems
%have solutions immediately after the problem statement. Last edit 23 Feb.

\begin{exercises}
\prob{1.}{(Chapter 3)} ~\newline
(a) [50\%] Find by any applicable method
the steady-state periodic solution for the current equation $
I'' + 2I' + 5I = -10\sin(t)$.
\newline
(b) [50\%] Find by variation of parameters a particular solution $y_p$ for the equation
$y''=1-x$. Show all steps in variation of parameters. Check the answer
by quadrature.

\ifsolutions
\Answer{~\newline
\BF{Part (a)} ~~ Answer: $ \dd I_{\mbox{ss}}(t) = \cos t-2\sin t.$
\\
\BF{Variation of Parameters}.\newline
 Solve $x''+2x'+5x=0$ to get $x_h=c_1x_1+c_2x_2$,
$x_1=e^{-t}\cos 2 t$, $x_2=e^{-t}\sin 2 t$.  Compute the
Wronskian $W=x_1x_2'-x_1'x_2=4e^{-2t}$. Then for
$f(t)=-10\sin(t)$,
$$
 x_p=x_1\int x_2\frac{-f}{W}dt+x_2\int x_1\frac{f}{W}dt.
 $$
 The integrations are too difficult, so the
 method won't be pursued.
\\
 \BF{Undetermined Coefficients}.
\\
The trial solution by Rule I is $I=d_1\cos t + d_2\sin t$. The homogeneous solutions
have exponential factions, therefore the Euler atoms in the trial solution cannot be solutions of the homogeneous problem, hence Rule II does not apply.
\\
Substitute the
trial solution into the non-homogeneous equation to obtain the answers $d_1=1$, $d_2=-2$. The
unique periodic solution $I_{\mbox{ss}}$ is extracted from the
general solution $I=I_h+I_p$ by crossing out all negative
exponential terms (terms which limit to zero at infinity). Because
$I_p=d_1\cos t + d_2\sin t = \cos t - 2\sin t$ and the homogeneous solution $x_h$ has negative exponential terms, then
$$
I_{\mbox{ss}}=\cos t - 2\sin t.
$$
\BF{Laplace Theory}.\newline
   Plan: Find the general solution, then extract the steady-state solution by dropping negative exponential terms. The computation can use initial data $I(0)=I'(0)=0$, because every particular solution contains the terms of the steady-state solution. Some details:
\\
   $\dd (s^2+2s+5)\L(I) = \frac{-10}{s^2+1}$ \newline
   $\dd \L(I) = \frac{-10}{(s^2+1)(s^2+2s+5)}$ \newline
   $\dd \L(I) = \frac{-10}{(s^2+1)((s+1)^2+4)}$ \newline
   $\dd \L(I) = \frac {s-2}{s^2+1}-\frac {s}{(s+1)^2+4}$ \newline
   $\dd \L(I) = \frac {s}{s^2+1}-2\frac{1}{s^2+1}-\frac {s+1}{(s+1)^2+4} + \frac12\frac {2}{(s+1)^2+4}$ \newline
   $\dd \L(I) = \L(\cos t)-2\L(\sin t)-\L(e^{-t}\cos 2t)+\frac12\L(e^{-t}\sin 2t)$ \newline
 $\dd I(t) = \cos t-2\sin t-e^{-t}\cos 2t+\frac12e^{-t}\sin 2t$, by Lerch's Theorem.
 \\
 Dropping the negative exponential terms gives the steady-state solution
 $ \dd I_{\mbox{ss}}(t) = \cos t-2\sin t.$
\\
\BF{Part (b)} ~~ Answer: $\dd y_p=\frac{x^2}{2} - \frac{x^3}{6}$.
\\
\BF{Variation of Parameters}.\newline
 Solve $y''=0$ to get $y_h=c_1y_1+c_2y_2$,
$y_1=1$, $y_2=x$.  Compute the
Wronskian $W=y_1y_2'-y_1'y_2=1$. Then for
$f(t)=1-x$,
\\
$\dd
 y_p=y_1\int y_2\frac{-f}{W}dx+y_2\int y_1\frac{f}{W}dx,
 $
\\
 $\dd
 y_p=1\int -x(1-x)dx+x\int 1(1-x)dx,
 $
\\
  $\dd
 y_p=-1(x^2/2-x^3/3)+x(x-x^2/2),
 $
\\
  $\dd
 y_p=x^2/2 - x^3/6.
 $
\\
This answer is checked by quadrature, applied twice to $y'' = 1-x$ with initial conditions zero.
}
\fi

\end{exercises}
\EJECT
\begin{exercises}
\prob{2.}{(Chapters 1, 2, 3)} ~\newline
% de:=2*diff(v(t),t)=-8+(2/(2*t+1))*v(t); ic:=v(0)=-4; dsolve({de,ic},v(t));
 (2a) [20\%] Solve $\dd 2v'(t)=-8 + \frac{2}{2t+1}v(t)$, $v(0)=-4$. Show
 all integrating factor steps.

 (2b) [10\%] Solve for the general solution: $y'' + 4y' + 6y=0$.

 (2c) [10\%] Solve for the general solution of the homogeneous constant-coefficient differential equation whose characteristic equation is $r(r^2+r)^2(r^2+9)^2=0$.

 (2d) [20\%] Find a linear homogeneous constant coefficient differential equation of lowest order which has a particular solution $y=x + \sin \sqrt2 x + e^{-x}\cos 3x$.

 (2e) [15\%] A particular solution of the equation $
mx'' + cx' + kx = F_0\cos(2t)$ happens to be $x(t)=11\cos 2t+ e^{-t}\sin \sqrt{11}t  -\sqrt{11} \sin 2t $.
Assume $m, c, k$ all positive. Find the unique periodic steady-state solution $x_{\mbox{ss}}$.

(2f) [25\%] Determine for $ y''' + y'' =
100x^2+\sin x$ the shortest trial solution for
$y_p$ according to the method of undetermined coefficients. Do not
evaluate the undetermined coefficients!

\Answer{~\newline
 (2a) $v(t) = -4 -8t$
 \newline
 (2b) $r^2+4r+6=0$, $y=c_1y_1+c_2y_2$, $y_1=e^{-2x}\cos \sqrt2 x$, $y_2=e^{-2x}\sin \sqrt2 x$.
\newline
 (2c) Write as $r^3(r+1)^2(r^2+9)^2=0$.
 Then $y$ is a linear combination of the atoms
 $1$, $x$, $x^2$, $e^{-x}$, $xe^{-x}$,
 $\cos 3x$, $x\cos 3x$,
 $\sin 3x$, $x\sin 3x$.
\newline
 (2d) The atoms that appear in $y(x)$ are $x, \sin\sqrt2x, e^{-x}\cos 3x$. Derivatives of these atoms create a longer list:
 $1,x, \cos\sqrt2x, \sin\sqrt2x, e^{-x}\cos 3x, e^{-x}\sin 3x$. These atoms correspond to characteristic equation roots $0,0$; $\sqrt2 i$, $-\sqrt2 i$, $-1+3i$, $-1-3i$. Then the characteristic equation has factors $r, r$; $x^2+2$; $((r+1)^2+9)$. The product of these factors is the correct characteristic equation, which corresponds to the differential equation of least order such that $y(x)$ is a solution. Report $r^6+2r^5+12r^4+4r^3+20r^2=0$ as the characteristic equation or $y^{(6)}+2y^{(5)}+12y^{(4)}+4y'''+20y''=0$ as the differential equation.
\newline
 (2e) It has to the terms left over after striking out the transient terms, those terms with limit zero at infinity. Then $x_{\mbox{ss}}(t)=11\cos 2t  -\sqrt{11} \sin 2t $.
 \newline
 (2f) The homogeneous solution is a linear combination of the atoms $1$, $x$, $e^{-x}$
because the characteristic polynomial has roots $0$, $0$, $-1$.
\newline
{\bf Rule \fbox{1}~} An initial trial solution $y$ is constructed for
atoms $1$, $x$, $x^2$, $\cos x$, $\sin x$ giving 3 groups, each group having the same base atom:
$$\begin{array}{lcl}
 y &=& y_1+y_2+y_3,\\•••••••••
 y_1 &=& d_1+d_2x+d_3x^2,\\
 y_2 &=& d_4\cos x,\\
 y_3 &=& d_5\sin x.
\end{array}
$$
Linear combinations of the listed independent atoms are supposed
to reproduce, by specialization of constants, all derivatives of the
right side of the differential equation.
\newline
{\bf Rule \fbox{2}~} The correction rule is applied individually to each of
$y_1$, $y_2$, $y_3$.\newline
Multiplication by $x$ is done repeatedly, until the replacement atoms do not appear in
atom list for the homogeneous differential equation. The result is the {\bf shortest trial
solution}
$$ y = y_1+y_2+y_3=(d_1x^2+d_2x^3+d_3x^4) + (d_4\cos x) + (d_5\sin x). $$
Some facts: (1) If an atom of the homogeneous equation appears in a group, then it is removed because of
$x$-multiplication, but replaced by a new atom having the same base atom. (2) The number of terms in each of $y_1$ to $y_3$ is unchanged from Rule I to Rule II.
}
\end{exercises}
\EJECT

\begin{exercises}
\prob{3.}{(Laplace Theory)} ~\newline
\BF{(a)} [50\%] Solve by Laplace's method
$x'' + 2x' + x = e^t$, $x(0)=x'(0)=0$.

\BF{(b)} [25\%] Assume $f(t)$ is of exponential order. Find $f(t)$ in the relation
$$\dd\left.\frac{d}{ds}\L(f(t))\right|_{s \to (s-3)}=\L(f(t)-t).$$

\BF{(c)} [25\%] Derive an integral formula for $y(t)$ by Laplace transform
methods, explicitly using the Convolution Theorem, for the problem
$$y''(t)+4y'(t)+4y(t)=f(t),\quad y(0)=y'(0)=0.$$

\Answer{~\newline
\BF{(a)}  \newline
$x \left( t \right) =-1/4\,{{\rm e}^{-t}}-1/2\,{{\rm e}^{-t}}t+1/4\,{
{\rm e}^{t}}$
\\
An intermediate step is $\L(x(t)) = \dd\frac{1}{(s-1)(s+1)^2}$. The solution uses partial fractions $\dd\frac{1}{(s-1)(s+1)^2} = \frac{A}{s-1}+\frac{B}{s+1}+\frac{C}{(s+1)^2}$, with answers
$A=1/4$, $B=-1/4$, $C=-1/2$.
\\
\BF{(b)}  \newline
Replace by the shift theorem and the $s$-differentiation theorem the given equation by
$$\dd\L\left((-t)f(t)e^{3t}\right)=\L(f(t)-t).$$
Then Lerch's theorem cancels $\L$ to give $-te^{3t}f(t) = f(t)-t$. Solve for
$$f(t) = \dd\frac{t}{1+te^{3t}}.$$
\\
\BF{(c)}  \newline
The main steps are:
\\
$\dd (s^2+4s+4)\L(y(t)) = \L(f(t)),$ \newline
$\dd \L(y(t)) = \frac{1}{(s+2)^2}\L(f(t))$, \newline
$\dd \L(y(t)) = \L(te^{-2t})\L(f(t))$, by the first shifting theorem,\newline
$\dd \L(y(t)) = \L(\mbox{convolution of $te^{-2t}$ and $f(t)$})$, by the Convolution Theorem, \newline
$\dd \L(y(t)) = \L\left(\int_0^t xe^{-2x}f(t-x)dx\right)$, insert definition of convolution, \newline
$y(t) =\dd\int_0^t xe^{-2x}f(t-x)dx$, by Lerch's Theorem.
}
\end{exercises}
\EJECT
\begin{exercises}
\prob{4.}{(Laplace Theory)} ~\newline
  (4a) [20\%] Explain Laplace's Method, as applied to the differential
 equation $x'(t) + 2x(t) = e^t$, $x(0)=1$.

  (4b) [15\%] Solve $\L(f(t))=\dd\frac{100}{(s^2+4)(s^2+9)}$ for $f(t)$.

  (4c) [15\%] Solve for $f(t)$ in the equation
  $\L(f(t))=\dd\frac{1}{s^2(s+3)}$.

  (4d) [10\%] Find $\L(f)$ given $f(t)=(-t)e^{2t}\sin(3t)$.

  (4e) [20\%] Solve $x'''+x''=0$, $x(0)=1$, $x'(0)=0$, $x''(0)=0$ by
 Laplace's Method.

  (4f) [20\%] Solve the system $x'=x+y$, $y'=x-y+2$, $x(0)=0$, $y(0)=0$
 by Laplace's Method.


\Answer{~\newline
(4a) Laplace's method explained.\newline
The first step transforms the equation using the parts formula and initial data to get
$$(s+2)\L(x) = 1 + \L(e^t).$$
The forward Laplace table applies to evaluate $\L(e^t)$. Then write, after a division, the isolated formula for $\L(x)$:
$$\L(x) = \frac{1+1/(s-1)}{s+2}=\frac{s}{(s-1)(s+2)}.$$
Partial fraction methods plus the backward Laplace table imply
$$\L(x) = \frac{a}{s-1}+\frac{b}{s+2}=\L(ae^t+be^{-2t})$$
and then $x(t)=ae^t+be^{-2t}$ by Lerch's theorem. The constants are $a=1/3$, $b=2/3$.
\\
(4b) $\L(f)=\frac{100}{(u+1)(u+4)}=\frac{100/3}{u+1}+\frac{-100/3}{u+4}$ where $u=s^2$.
Then $\L(f)=\frac{100}{3}(\frac{1}{s^2+1}-\frac{1}{s^2+4})=\frac{100}{3}\L(\sin t - \frac12\sin 2t)$ implies $f(t)=\frac{100}{3}(\sin t- \frac12\sin 2t)$.
\\
(4c) $\L(f)=\frac{a}{s}+\frac{b}{s^2}+\frac{c}{s+3}=\L(a+bt+ce^{-3t})$ implies $f(t)=a+bt+ce^{-3t}$.
The constants, by Heaviside coverup, are $a=-1/9$, $b=1/3$, $c=1/9$.
\\
(4d) $\L(f)=\frac{d}{ds}\L(e^{2t}\sin 3t)$ by the $s$-differentiation theorem.
The first shifting theorem implies $\L(e^{2t}\sin 3t)=\left.\L(\sin 3t)\right|_{s\to(s-2)}$. Finally, the forward table
implies $\L(f)=\frac{d}{ds}\left(\frac{1}{(s-2)^2+9}\right)=\frac{-2(s-2)}{((s-2)^2+9)^2}$.
\\
(4e) The answer is $x(t)=1$, by guessing, then checking the answer. The Laplace details jump through hoops to arrive at
$\dd (s^3+s^2)\L(x(t))=s^2+s$, or simply $\L(x(t))=1/s$. Then $x(t)=1$.
% de:=diff(x(t),t,t,t)+diff(x(t),t,t)=0;ic:=x(0)=1,D(x)(0)=0,D(D(x))(0)=0;dsolve({de,ic},x(t));
\\
(4f) The transformed system is
$$\begin{array}{rcrcl}
(s-1)\L(x) &+& (-1)\L(y) &=& 0,\\
(-1)\L(x) &+& (s+1)\L(y) &=& \L(2).
\end{array}
$$
Then $\L(2)=2/s$ and Cramer's Rule gives the formulas
$$\dd \L(x) = \frac{2}{s(s^2-2)},\quad \L(y) = \frac{2(s-1)}{s(s^2-2)}.
$$
% des:=diff(x(t),t)=x(t)+y(t), diff(y(t),t)=x(t)-y(t)+2;ic:=x(0)=0,y(0)=0;
% dsolve({des,ic},{x(t),y(t)})
% # x = \cosh(\sqrt2 t)-1, y = \sqrt2\sinh(\sqrt2 t) - \cosh(\sqrt2 t)
After partial fractions and the backward table,
$$ x = -1+\cosh(\sqrt2 t),\quad y = \sqrt2\sinh(\sqrt2 t) - \cosh(\sqrt2 t)+1.$$
}
\end{exercises}
\EJECT
\begin{exercises}
\prob{5.}{(Laplace Theory)} ~\newline
  (a) [30\%] Solve $\L(f(t))=\dd\frac{1}{(s^2+s)(s^2-s)}$ for $f(t)$.
  \newline
  (b) [20\%] Solve for $f(t)$ in the equation
  $\L(f(t))= \dd \frac{s+1}{s^2+4s+5}$.
  \newline
   (c) [20\%] Let $u(t)$ denote the unit step. Solve for $f(t)$ in the
   relation
  $$\L(f(t))=\dd\frac{d}{ds}\L(u(t-1)\sin 2t)$$
   (d) [30\%] Compute $\L(e^{2t}f(t))$ for
  $$f(t)=\dd\frac{e^t-e^{-t}}{t}.$$

\Answer{~\newline
(a) $f(t) = \sinh(t)-t = \frac12 e^t -\frac12e^{-t} - t$
% F:=1/((s^2+s)*(s^2-s));invlaplace(F,s,t);
\\
(b) $f(t) = e^{-2t}(\cos(t)-\sin(t))$
% F:=(s+1)/(s^2+4*s+5);invlaplace(F,s,t);
\\
(c) Replace $d/ds$ by factor $(-t)$ in the Laplace integrand:
$$\L(f(t))=\dd\L((-t)\sin (2t)u(t-1))$$
Apply Lerch's theorem to cancel $\L$ on each side, obtaining the answer
$$f(t))=(-t)\sin (2t)u(t-1).$$
(d) The first shifting theorem reduces the problem to computing $\L(f(t))$.
\\
$\dd \L(tf(t))=\L(e^t-e^{-t}) = \frac{1}{s-1}-\frac{1}{s+1}$
\\
$\dd -\frac{d}{ds}\L(f(t)) = \frac{1}{s-1}-\frac{1}{s+1}$, by the $s$-differentiation theorem,
\\
Then $F(s)=\L(f(t))$ satisfies a first order quadrature equation $F'(s) = h(s)$ with solution
$F(s)=\ln|s+1|-\ln|s-1|+c=\ln\left| \frac{s+1}{s-1}\right| + c$ for some constant $c$. Because $F=0$
at $s=\infty$ (a basic theorem for functions of exponential order) and $\ln|1|=0$, then $c=0$ and
$\L(f(t))=F(s)=\ln|s+1|-\ln|s-1|=\ln\left| \frac{s+1}{s-1}\right| $. Then the shifting theorem implies
$$ \L\left(e^{2t}f(t)\right) = \left.\L(f(t))\right|_{s:=s-2} = \ln\left| \frac{s-1}{s-3}\right|.$$
}
\end{exercises}
\EJECTEND

\begin{exercises}
\prob{6.}{(Systems of Differential Equations)} ~\newline
 The eigenanalysis method says that, for a $3\times 3$ system
$\.x' = A\.x$, the general solution is $\.x(t)=c_1\.v_1e^{\lambda_1
t}+c_2\.v_2e^{\lambda_2 t}+c_3\.v_3e^{\lambda_3 t}$. In the
solution formula, $(\lambda_i,\.v_i)$, $i=1,2,3$, is an eigenpair
of $A$.  Given
$$A=\left[\begin{array}{rrr}
 4 & 1 &  1  \\
 1 & 4 &  1  \\
 0 & 0 &  4
 \end{array}\right],$$
 then \newline
 (a) [75\%] Display eigenanalysis details for $A$. \newline
 (b) [25\%] Display the solution $\.x(t)$ of $\.x'(t)=A\.x(t)$.
 (c) Repeat (a), (b) for the matrix
$A=\left[\begin{array}{rrr}
 5 & 1 &  1  \\
 1 & 5 &  1  \\
 0 & 0 &  7
 \end{array}\right]$.

\ifsolutions
\Answer{~\newline
(a): The details should solve the equation $|A-\lambda I|=0$ for three values $\lambda=5,4,3$. Then solve the three systems $(A-\lambda I)\vec{v}$=\vec{0}$ for eigenvector $\vec{v}$, for $\lambda=5,4,3$.
\\
The eigenpairs are
$$
 5,  \colvector{1\\ 1\\ 0};\quad 4, \colvector{-1\\ -1\\ 1};\quad
  3, \colvector{1\\ -1\\ 0}.
$$
(b): The eigenanalysis method implies
$$
\.x(t)=c_1e^{5t}  \colvector{1\\ 1\\ 0}+ c_2e^{ 4t} \colvector{-1\\ -1\\
1}+ c_3e^{3t} \colvector{1\\ -1\\ 0}.
$$
(c):  The eigenpairs are
$$
 6,  \colvector{1\\ 1\\ 0};\quad 7, \colvector{1\\ 1\\ 1};\quad
  4, \colvector{1\\ -1\\ 0}.
$$ 
and
The eigenanalysis method implies
$$
\.x(t)=c_1e^{6t}  \colvector{1\\ 1\\ 0}+ c_2e^{ 7t} \colvector{1\\ 1\\
1}+ c_3e^{4t} \colvector{1\\ -1\\ 0}.
$$
}
%A:=<5,1,1|1,5,1|0,0,7>^+;LinearAlgebra[Eigenvectors](A);
%P:=<1,1,0|-1,-1,1|1,-1,0>;DD:=<5,0,0|0,4,0|0,0,3>;A:=P.DD.P^(-1);
%# A.P=P.DD
\fi


\end{exercises}
\EJECT

\begin{exercises}
\prob{7.}{(Systems of Differential Equations)} ~\newline
(a) [40\%]  Find the eigenvalues of the matrix
$A=\left[\begin{array}{rrrr}
 4 & 1 & -1 & 0 \\
 1 & 4 & -2 & 1 \\
 0 & 0 &  2 & 0 \\
 0 & 0 &  2 & 4
 \end{array}\right]$.
%with(linalg):
%B:=matrix([[4,1,-1,0],[1,4,-2,1],[0,0,2,0],[0,0,2,4]]);
%eigenvals(B);
%dsolve({diff(y(x),x)=2*y(x),y(0)=1},y(x));
%dsolve({diff(y(x),x)=3*y(x)+exp(2*x),y(0)=0},y(x));
%dsolve({diff(y(x),x)=4*y(x)+(-exp(-x)+1)*exp(3*x),y(0)=0},y(x));
%dsolve({diff(y(x),x)=5*y(x)+(1/2*exp(-2*x)-exp(-x)+1/2)*exp(4*x),y(0)=0},y(x));

(b) [60\%] Display the general solution of $\.u'=A\.u$ according to Putzer's
spectral formula. Leave matrix products unexpanded, in order to save time.
However, do compute the coefficient functions $r_1$, $r_2$, $r_3$, $r_4$.
 The correct answer for $r_4$, using $\lambda$ in increasing magnitude,
is
$ y(x) = \frac16e^{5t}-\frac12e^{4t}+\frac12e^{3t}-\frac16e^{2t}$.

\ifsolutions
\Answer{~\newline
(a) Define
$$A=\left[\begin{array}{rrrr}
 4 & 1 & -1 & 0 \\
 1 & 4 & -2 & 1 \\
 0 & 0 &  2 & 0 \\
 0 & 0 &  2 & 4
 \end{array}\right].$$
Subtract $\lambda$ from the diagonal elements of $A$ and expand
the determinant $\det(A-\lambda I)$ to obtain the characteristic
polynomial $(2-\lambda)(3-\lambda)(4-\lambda)(5-\lambda)=0$. The
eigenvalues are the roots: $\lambda=2,3,4,5$. Used here was the
{\em cofactor rule} for determinants. Also possible is the special result for block matrices, $\left|\begin{array}{cc} B_1 & 0\\ C & B_2\end{array}\right|=|B_1||B_2|$. Sarrus' rule does not apply
for $4\times 4$ determinants (an error) and the triangular rule
likewise does not directly apply (another error).
\\
(b) 
Define functions $r_1$, $r_2$, $r_3$, $r_4$ to be the components of the
vector solution $\vec{\.r}(t)$ to the initial value problem
$$\vec{\.r}\,'=B\vec{\.r},\quad \vec{\.r}(0)=\colvector{1\\ 0\\ 0\\ 0} \quad\mbox{where}\quad
B=\left[\begin{array}{rrrr}
 2 & 0 & 0 & 0 \\
 1 & 3 & 0 & 0 \\
 0 & 1 &  4 & 0 \\
 0 & 0 &  1 & 5
 \end{array}\right]
.$$
The linear integrating factor method applied to the four differential equations gives
$$ r_1=e^{2t},\quad r_2=-e^{2t}+e^{3t}, \quad r_3=\frac12e^{4t}-3e^{3t}+\frac12e^{2t},$$
$$ r_4=\frac16e^{5t}-\frac12e^{4t}+\frac12e^{3t}-\frac16e^{2t}.$$
Define $\lambda_1=2, \lambda_2=3, \lambda_3=4, \lambda_1=5$ and
$$P_1=I,\quad P_2=A-\lambda_1I,\quad P_3=(A-\lambda_1I)(A-\lambda_2I), \quad P_4=(A-\lambda_1I)(A-\lambda_2I)(A-\lambda_3I).$$
Then 
$$ \vec{\.u}=\left(r_1P1+r_2P_2+r_3P_3+r_4P_4\right)\vec{\.u}_0.$$ 
}
%de:=diff(r1(t),t)=2*r1(t),
%diff(r2(t),t)=3*r2(t)+r1(t),
%diff(r3(t),t)=4*r3(t)+r2(t),
%diff(r4(t),t)=5*r4(t)+r3(t);
%ic:=r1(0)=1,r2(0)=0,r3(0)=0,r4(0)=0;
%dsolve([de,ic]);
\fi
\end{exercises}
\EJECTEND

\begin{exercises}
\prob{8.}{(Systems of Differential Equations)}
\newline
\BF{(a)} [30\%]  The eigenvalues are $3$, $5$ for the matrix
$A=\left[\begin{array}{rrrr}
 4 & 1   \\
 1 & 4
 \end{array}\right]$.
%with(linalg):
%C:=matrix([[4,1],[1,4]]); eigenvals(C);

Display the general solution of $\.u'=A\.u$ according to Putzer's
spectral formula. Don't expand matrix products, in order to save time.
% However, do compute the coefficient functions $r_1$, $r_2$.

\BF{(b)} [20\%] Using the same matrix $A$ from part (a), display the solution
of $\.u'=A\.u$ according to the Cayley-Hamilton-Ziebur Method. To save time,
write out the system to be solved for the two vectors, and then stop,
without solving for the vectors. Assume initial condition $\vec{u}_0 = \colvector{1\\ -1}$.

\BF{(c)} [30\%] Using the same matrix $A$ from part (a), compute explicitly all four entries of the
exponential matrix $e^{At}$ by any known method. Use either Putzer's formula or the
formula $e^{At}=\Phi(t)\Phi^{-1}(0)$, where $\Phi$ is a fundamental matrix.

\BF{(e)} [20\%] Display the solution of $\.u'=A\.u$, $\vec{u}(0)=\colvector{1\\ -1}$.

\Answer{~\newline
(a) $\dd \.u(t)=e^{At}\.x(0)$, $\dd e^{At}=e^{3t}I + \frac{e^{3t}-e^{5t}}{3-5}(A-3I)$.
% Functions $r_1$, $r_2$ are computed from $r_1'=3r_1$, $r_1(0)=1$, $r_2'=5r_2+r_1$, $r_2(0)=0$.
\\
(b) $\dd\.u(t) = e^{3t}\vec{\.c}_1+e^{5t}\vec{\.c}_2$. Differentiate once and use $\vec{\.u}'=A\vec{\.u}$, then set $t=0$. The resulting system is
$$
\begin{array}{lcl}
 \vec{\.u}_0 &=& e^{0}\vec{\.c}_1+e^{0}\vec{\.c}_2 \\
  A\vec{\.u}_0 &=& 3e^{0}\vec{\.c}_1+5e^{0}\vec{\.c}_2
  \end{array}
 $$
This is the answer to the problem. We stop would here.
\newline
{\bf Alternate Method}. The coefficients $\vec{\.c}_1, \vec{\.c}_2$ can be found from the memorized formula
 $$\left[\vec{\.c}_1 | \vec{\.c}_2\right] = \left[\vec{u}_0 | A\vec{u}_0\right]\left(W(0)^T\right)^{-1}$$
 where $W$ is the Wronskian matrix of the atoms $e^{3t}, e^{5t}$. Symbol $[\vec{v}_1|\vec{v}_2]$ is the augmented matrix of the column vectors $\vec{A}, \vec{B}$. This is the answer to the problem. We would stop here. 
\newline
{\bf Remark}. This system implies
 % W:=<exp(3*t),exp(5*t)|3*exp(3*t),5*exp(5*t)>^+;W1:=subs(t=0,%);1/(W1^+);
 $$\left[\vec{\.c}_1 | \vec{\.c}_2\right]=\left( \begin {array}{rr} 1&3\\ \noalign{\medskip}-1&-3\end {array}
 \right)\left(\begin {array}{rr} \frac52&-\frac32\\ \noalign{\medskip}-\frac12&\frac12
\end {array} \right)=\left(\begin {array}{rr} 1&0\\ \noalign{\medskip}-1&0
\end {array} \right)$$
which implies that $\dd \vec{u}(t) = \colvector{1\\ -1}e^{3t}+\colvector{0\\ 0}e^{5t}=\colvector{e^{3t} \\ -e^{3t}}$.
% u0:=<1,-1>;A:=<4,1|1,4>^+;C:=<u0|A.u0>;latex(%);
% W:=<exp(3*t),exp(5*t)|3*exp(3*t),5*exp(5*t)>^+;W1:=subs(t=0,W);W11:=1/(W1^+);
% C.W11; LinearAlgebra[MatrixExponential](A,t).u0;
\\
(c) Putzer's result $\dd e^{At}=e^{3t}I + \frac{e^{3t}-e^{5t}}{3-5}(A-3I)$ implies
$$ e^{At} =  \frac12\left( \begin {array}{cc} {{\rm e}^{3\,t}}+{{\rm e}^{5\,t}}
&{{\rm e}^{5\,t}}-{{\rm e}^{3\,t}}\\\noalign{\medskip}{
{\rm e}^{5\,t}}-{{\rm e}^{3\,t}}&{{\rm e}^{3\,t}}+{
{\rm e}^{5\,t}}\end {array} \right).$$
(d) The answer by part (c) is 
$$\vec{u}(t) = e^{At}\vec{u}_0=\frac12\left( \begin {array}{cc} {{\rm e}^{3\,t}}+{{\rm e}^{5\,t}}
&{{\rm e}^{5\,t}}-{{\rm e}^{3\,t}}\\\noalign{\medskip}{
{\rm e}^{5\,t}}-{{\rm e}^{3\,t}}&{{\rm e}^{3\,t}}+{
{\rm e}^{5\,t}}\end {array} \right)\colvector{1\\ -1} = \colvector{e^{3t} \\ -e^{3t}}.$$ 
\newline
The Cayley-Hamiltion-Ziebur shortcut could also be used. Below, the solution is computed by this method.
\newpage
{\bf Cayley-Hamilton Ziebur Shortcut}. The method says that the components $x(t),y(t)$ of the solution to the system 
$$\vec{u}'=A\vec{u}, \quad\vec{u}(0)=\colvector{1\\ -1}$$ 
with 
$A=\left(\begin{array}{rrrr}
 4 & 1   \\
 1 & 4
 \end{array}\right)$ and $\vec{u}=\colvector{x(t)\\ y(t)}$ are linear combinations of the Euler atoms found from the roots of the characteristic equation $|A-rI|=0$. The roots are $r=3,5$ and the atoms are $e^{3t},e^{5t}$. The scalar system is
$$\left\{\begin{array}{lcl}
x'(t) &=& 4x(t) + y(t), \\
y'(t) &=& x(t) + 4y(t), \\
x(0) &=& 1, \\
y(0) &=& -1.
\end{array}\right.
$$
The method says that $x(t)=c_1e^{3t}+c_2e^{5t}$, but $c_1,c_2$ are not arbitrary constants: they are determined by the initial conditions $x(0)=1,y(0)=-1$. Then $x'=4x+y$ can be solved for $y$ to obtain $y(t)=x'(t) -4x(t)$. Substitute expression $x(t)=c_1e^{3t}+c_2e^{5t}$ into $y(t)=x'(t) -4x(t)$ to obtain
$$y(t)=x'(t) -4x(t) = 3c_1e^{3t}+5c_2e^{5t} - 4(c_1e^{3t}+c_2e^{5t}) = -c_1e^{3t}+c_2e^{5t}.$$
Then
\begin{equation}\label{scalar.answer}
\left\{\begin{array}{lcrcl}
x(t)&=&c_1e^{3t}&+&c_2e^{5t},\\
y(t) &=& -c_1e^{3t}&+&c_2e^{5t}.
\end{array}\right.\end{equation}
Initial data $x(0)=1,y(0)=-1$ are used in the last step, to evaluate $c_1,c_2$. Inserting these conditions produces a $2\times 2$ linear system for $c_1,c_2$
$$\left\{\begin{array}{lcrcl}
0&=&c_1e^{0}&+&c_2e^{0},\\
0 &=& -c_1e^{0}&+&c_2e^{0}.
\end{array}\right.$$
The solution is $c_1=1$ and $c_2=0$, which implies the final answer $x(t)=e^{3t}$, $y(t)=-e^{3t}$. This answer agrees with the previously posted answer which used the exponential matrix from part (c).
\newline
\rule{0.2\linewidth}{0.05em}
\newline
{\bf Remark on Fundamental Matrices}. The answer prior to evaluation of $c_1,c_2$ can be written as
$$\colvector{x(t)\\ y(t)} = \twobytwo{e^{3t}&e^{5t}}{-e^{3t}&e^{5t}}\colvector{c_1\\ c_2}.$$
The matrix $\Phi(t)=\twobytwo{e^{3t}&e^{5t}}{-e^{3t}&e^{5t}}$ is called a {\bf fundamental matrix}, because it is nonsingular and satisfies $\Phi'=A\Phi$ (its columns are solutions of $\vec{u}'=A\vec{u}$). In terms of $\Phi$, 
$$e^{At} = \Phi(t)\Phi^{-1}(0).$$
This formula gives an alternative way to compute $e^{At}$ by using the Cayley-Hamilton-Ziebur shortcut. Please observe that the columns of $\Phi$ are the formal partial derivatives of the vector solution $\vec{u}$ on the symbols $c_1,c_2$. Partial derivatives on symbols is a general method for discovering basis vectors. Therefore, $\Phi$ can be written directly from equations (\ref{scalar.answer}).
}
\end{exercises}
\EJECTEND

\end{document}
\endinput
