% 2017 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}}
\usepackage{linalg}
\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{\vec{#1}}
\newif\ifsolutions
\solutionstrue
%\solutionsfalse
\ifsolutions
\def\Answer#1{\rule{0.2\linewidth}{0.05em}\\ {\bf Answer}: {\sf #1} \par\rule{\linewidth}{0.1em}}
\def\SeparatedPages#1{\relax}
\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 Exam 2 S2017
%\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 \\
\ifsolutions
\small Midterm Exam 2 with Solutions\\
\else
\small Midterm Exam 2 Problems Only\\
\fi
\small Exam Date: 31 March 2017 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 31 Mar.

\begin{exercises}
\prob{1.}{(Chapter 3)} ~\newline
\BF{(a)} [70\%] Find by any applicable method
the steady-state periodic solution for the current equation $
I'' + 2I' + 5I = 10\cos(t)-100\sin(t)$.

% de:=diff(y(x),x,x)+ 2*diff(y(x),x) + 5*y(x) = 10*cos(x)-100*sin(x);
% dsolve([de,y(0)=1,D(y)(0)=0],y(x));
% y(x) = 4*exp(-x)*sin(2*x)-11*exp(-x)*cos(2*x)-19*sin(x)+12*cos(x)

\BF{(b)} [30\%] Linear algebra can find the solution of the current equation $
I'' + 2I' + 5I = 10\cos(t)-100\sin(t)$ having initial conditions $I(0)=1$, $I'(0)=0$.
Write the linear algebraic equations for $c_1, c_2$, but to save time don't solve for $c_1,c_2$.

\ifsolutions
\Answer{~\newline
\BF{Part (a)} ~~ Answer: $ \dd I_{\mbox{ss}}(t) = 12\cos t-19\sin t.$
\begin{quote}
\BF{Variation of Parameters}.\newline
To fit formulas for variation of parameters, we solve $x''+2x'+5x=10\cos(t)-100\sin(t)$.\\
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\cos(t)-100\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 factors, therefore the Euler solution 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=12$, $d_2=-19$. 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 = 12\cos t - 19\sin t$ and the homogeneous solution $x_h$ has negative exponential terms, then
$$
I_{\mbox{ss}}=12\cos t - 19\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{10s}{s^2+1}-\frac{100}{s^2+1}$ \newline
   $\dd \L(I) = \frac{10s-100}{(s^2+1)(s^2+2s+5)}$ \newline
   $\dd \L(I) = \frac{10s-100}{(s^2+1)((s+1)^2+4)}$ \newline
   $\dd \L(I) = \frac {as+b}{s^2+1}+\frac {c(s+1)+2d}{(s+1)^2+4}$ \newline
   $\dd \L(I) = a\L(\cos t)+b\L(\sin t)+c\L(e^{-t}\cos 2t)+d\L(e^{-t}\sin 2t)$ \newline
 $\dd I(t) = a\cos t+b\sin t+ce^{-t}\cos 2t+de^{-t}\sin 2t$, by Lerch's Theorem.
 \\
 Dropping the negative exponential terms gives the steady-state solution
 $ \dd I_{\mbox{ss}}(t) = a\cos t+b\sin t.$\newline
Remaining is to find the constants $a,b$ using partial fraction theory. The answers are $a=12$, $b=-19$.
\end{quote}
\BF{Part (b)} ~~ Answer: $c_1 + 12 = 1$, $-c_1+2c_2 - 19 = 0$.
\begin{quote}
\BF{Linear Algebra}.\newline
 The general solution is $I=I_h+I_p$ where $I_h(t)=c_1e^{-t}\cos(2t)+c_2e^{-t}\sin(2t)$ and $I_p(t)=12\cos(t)-19\sin(t)$ (from part (a)).
The equations for $c_1,c_2$ obtained from $I(0)=1,I'(0)=0$ are
$$\begin{array}{lcl}
c_1 + 12&=& 1, \\
-c_1+2c_2 - 19 &=& 0.
\end{array}
$$
It was not necessary to solve for $c_1,c_2$.
\end{quote}
}
\fi

\end{exercises}
\EJECT

\begin{exercises}
\prob{2.}{(Laplace Theory)} ~\newline
\BF{(a)} [40\%] Assume $f(t)$ is of exponential order. Find $f(t)$ in the relation
$$\dd\left.\frac{d^2}{ds^2}\L(f(t))\right|_{s \to (s-3)}=\frac{1}{s^2} + \L(t^2f(t)-t).$$
\\
\BF{(b)} [60\%] Solve by Laplace's method
$x'' + 2x' + x = e^{-t}$, $x(0)=x'(0)=0$.
\\
\ifsolutions
\Answer{~\newline
\BF{(a)}  \newline
Replace by the shift theorem and the $s$-differentiation theorem the given equation by
$$\dd\L\left((-t)^2f(t)e^{3t}\right)=\frac{1}{s^2}+\L(t^2f(t)-t).$$
Replace $\frac{1}{s^2}$ by $\L(t)$, then collect terms on the right.
Lerch's theorem cancels $\L$ to give $t^2e^{3t}f(t) = t+t^2f(t)-t$. Cancel terms to obtain
$$f(t) = 0.$$
\\
\BF{(b)}
\newline
The main steps are:
\\
$\dd (s^2+2s+1)\L(y(t)) = \L\left(e^{-t}\right),$ \newline
$\dd \L(y(t)) = \frac{1}{(s+1)^2}\L\left(e^{-t}\right)$, \newline
$\dd \L(y(t)) = \frac{1}{(s+1)^3}$, \newline
$\dd \L(y(t)) = \left.\frac{1}{s^3}\right|_{s:=s+1}$, a shift substitution,\newline
$\dd \L(y(t)) = \left.\L\left(\frac{t^2}{2}\right)\right|_{s:=s+1}$, by the backward Laplace table,\newline
$\dd \L(y(t)) = \L\left(\frac{t^2}{2}e^{-t}\right)$, by the shifting theorem,\newline
$\dd y(t) = \frac12t^2e^{-t}$, by Lerch's theorem.\newline
% de:=diff(y(t),t,t)+ 2*diff(y(t),t) + 1*y(t) = exp(-t);
% dsolve([de,y(0)=0,D(y)(0)=0],y(t));
}
\fi
\end{exercises}
\EJECT
\begin{exercises}
\prob{3.}{(Laplace Theory)} ~\newline
  \BF{(a)} [30\%] Solve $\L(f(t))=\dd\frac{10/s}{(s^2+1)(s^2+5)}$ for $f(t)$.

 \BF{(b)} [30\%] Solve $x'''+x'=0$, $x(0)=1$, $x'(0)=1$, $x''(0)=0$ by
 Laplace's Method.
% de2:=diff(y(x),x,x,x)+ diff(y(x),x)=0;ic:=y(0)=1,D(y)(0)=1,D(D(y))(0)=0;dsolve([de2,ic],y(x));


  \BF{(c)} [40\%] Solve the system $x'=4x+y+30$, $y'=x+4y+60$, $x(0)=0$, $y(0)=0$
 by Laplace's Method.
% des:=diff(x(t),t)=4*x(t)+y(t)+30,diff(y(t),t)=x(t)+4*y(t)+60;dsolve([des,x(0)=0,y(0)=0],[x(t),y(t)]);
% {x(t) = -5*exp(3*t)+9*exp(5*t)-4, y(t) = 5*exp(3*t)+9*exp(5*t)-14}

\ifsolutions
\Answer{~\newline
(3a) $\dd\L(f)=\frac{100}{s(s^2+1)(s^2+4)}=\frac{a}{s}+\frac{bs+c}{s^2+1}+\frac{ds+e}{s^2+4}$.
Then $\L(f)=\L\left(a + b\cos(t)+c\sin t +d\cos(2t)+\frac12e\sin (2t)\right)$ implies by Lerch's theorem
$f(t)=a + b\cos(t)+c\sin t +d\cos(2t)+\frac12e\sin (2t)$. It remains to find by partial fractions the answers for the constants:
% eq:=100/s/((s^2+1)*(s^2+4));convert(eq,parfrac);
$a=25/4, b=-100/3, c=0, d=25/3, e=0$.
\\
(3b) The answer is $x(t) = 1+\sin(t)$.
% de:=diff(x(t),t,t,t) +diff(x(t),t) = 0; ic:=x(0)=1,D(x)(0)=1,D(D(x))(0)=0; dsolve([de,ic],x(t));# x(t) = 1+sin(t)
\\
The transformed equation is $(s^3+s)\L(x) = 1+s+s^2$. Then $\L(x) = \dd\frac{1+s+s^2}{s(s^2+1)} = \frac{a}{s}+\frac{bs+c}{s^2+1}=\L\left( a + b\cos(t)+c\sin(t)\right)$. Lerch's theorem implies
$x(t)= a + b\cos(t)+c\sin(t)$. Partial fractions methods apply to solve for $a=1,b=0,c=1$. Then
$x(t) = 1+\sin(t)$.
\\
(3c) The answer is $x(t)=-5e^{3t}+9e^{5t}-4$, $y(t)=5e^{3t}+9e^{5t}-14$.\\
The transformed system $\.u'=A\.u + \.b$, with $A=\twobytwo{4&1}{5&9}$ and $\.b=\colvector{30\\ 60}$, is given by
$$\begin{array}{rcrcl}
(s-4)\L(x) &+& (-1)\L(y) &=& \L(30),\\
(-1)\L(x) &+& (s-4)\L(y) &=& \L(60).
\end{array}
$$
Then $\L(1)=1/s$ and Cramer's Rule gives the formulas
$$\dd \L(x) =\frac {30\,s-60}{ \left( s-3 \right)  \left( s-5 \right) s},
\quad \L(y)= \frac {-210+60\,s}{ \left( s-3 \right)  \left( s-5 \right) s}
.
$$
% des:=diff(x(t),t)=4*x(t)+y(t)+30, diff(y(t),t)=x(t)+4*y(t)+60;ic:=x(0)=0,y(0)=0;
% dsolve({des,ic},{x(t),y(t)})
After partial fractions and the backward table,
$$x(t)=-5e^{3t}+9e^{5t}-4, \quad y(t)=5e^{3t}+9e^{5t}-14.$$
}
\fi
\end{exercises}
\EJECT

\begin{exercises}
\prob{4.}{(Systems of Differential Equations)} ~\newline
 The Eigenanalysis Method (section 5.2) says that, for a $3\times 3$ system
$\frac{d}{dt}\vec{u} = A\vec{u}$, the general solution is $\vec{u}(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_1,\.v_1)$,  $(\lambda_2,\.v_2)$, $(\lambda_3,\.v_3)$ are eigenpairs
of $A$.  Assume given the $3\times 3$ matrix
$$A=\left[\begin{array}{rrr}
 4 & 1 &  1  \\
 0 & 4 &  1  \\
 0 & 0 &  5
 \end{array}\right].$$
% A:=<4,1,1|1,4,1|0,0,5>^+;LinearAlgebra[Eigenvectors](A);
 \BF{(a)} [50\%] Matrix $A$ has only two eigenpairs. Display eigenanalysis details for $A$. \newline
 \BF{(b)} [25\%] It is impossible to apply the Eigenanalysis Method (stated above). Explain why.\newline
 \BF{(c)} [25\%] Display the solution of $\frac{d}{dt}\vec{u}=A\vec{u}$ in case $A$ is $4\times 4$ and has eigenvalues $2,-1, 3, 5$ with corresponding eigenvectors
$$\colvector{1\\ 1\\ -1\\ 0}, \colvector{1 \\ 1 \\ 1 \\ 0}, \colvector{0 \\ 1 \\ -1 \\ 0}, \colvector{0 \\ -1 \\ 0 \\ 1}.$$

\ifsolutions
\Answer{~\newline
(a): The details should solve the equation $|A-\lambda I|=0$ for three eigenvalues $\lambda=5,4,4$. Then solve the  systems $(A-(5) I)\vec{v}=\vec{0}$ for eigenvector $\vec{v}=\.v_1$ and $(A-(4) I)\vec{v}=\vec{0}$ for eigenvector $\vec{v}=\.v_2$.
There is no eigenvector $\.v_3$.
\\
The eigenpairs are
$$
 \left(5,  \colvector{2\\ 1\\ 1}\right), \quad \left(4, \colvector{1\\ 0\\ 0}\right)
$$
(b): The eigenanalysis method applies only in case the matrix is diagonalizable. But $A$ has only $2$ eigenpairs, so it is not diagonalizable.
\newline
(c): The eigenanalysis method implies
$$\.u(t) = c_1e^{2t}\colvector{1\\ 1\\ -1\\ 0} + c_2e^{-t} \colvector{1 \\ 1 \\ 1 \\ 0} + c_3 e^{3t}\colvector{0 \\ 1 \\ -1 \\ 0}+c_4e^{5t} \colvector{0 \\ -1 \\ 0 \\ 1}.$$
}
\fi
\end{exercises}
\EJECT
\begin{exercises}
\prob{5.}{(Systems of Differential Equations)}
\newline
Systems $\frac{d}{dt}\vec{u} = A\vec{u}$ with $A$ an $n\times n$ real matrix can be solved by the following methods:

(1) Cayley-Hamilton-Ziebur method, from section 4.2. (2) Eigenanalysis method from 5.2. (3) Laplace's method, from chapter 7. (4) Exponential matrix, from 5.6

\BF{(a)} [50\%]  The eigenvalues are $4$, $6$ for the matrix
$A=\left[\begin{array}{rrrr}
 5 & 1   \\
 1 & 5
 \end{array}\right]$.
Display the general solution of $\frac{d}{dt}\vec{u}=A\vec{u}$ according to the Cayley-Hamilton-Ziebur shortcut (textbook chapters 4,5).
%with(LinearAlgebra):
%C:=Matrix([[5,1],[1,5]]); Eigenvectors(C);


\BF{(b)} [10\%] The $3\times 3$ system $\frac{d}{dt}\vec{u}=A\vec{u}$ is supplied with matrix $A$ having only two eigenpairs. It can be solved using the exponential matrix. What other methods are possible to use? Don't do any details, write a sentence.

\BF{(c)} [10\%] The $3\times 3$ system $\frac{d}{dt}\vec{u}=A\vec{u}$ is supplied with matrix $A$ having three eigenpairs, but only one real eigenvalue. It can be solved using the exponential matrix. What other methods are possible to use? Don't do any details, write a sentence.

\BF{(d)} [30\%] The $3\times 3$ system $\frac{d}{dt}\vec{u}=A\vec{u}$ is given by $A=\left(\begin{array}{rrr} 1 & 0 & 1 \\ 0 & 1 & 1 \\ 0 & 0 & 0 \end{array}\right)$.
Choose a method other than the exponential matrix and explain how you would solve for $\vec{u}$. It is not necessary to find the answer, but it is necessary to outline the method, not omitting any details.


\Answer{~\newline
(a)
{\bf Cayley-Hamilton Ziebur Shortcut}. The method says that the components $x(t),y(t)$ of the solution to the system
$$\frac{d}{dt}\vec{u}=A\vec{u}, \quad\vec{u}(0)=\colvector{1\\ -1}$$
with
$A=\left(\begin{array}{rrrr}
 5 & 1   \\
 1 & 5
 \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=4,6$ and the atoms are $e^{4t},e^{6t}$. The scalar system is
$$\left\{\begin{array}{lcl}
x'(t) &=& 5x(t) + y(t), \\
y'(t) &=& x(t) + 5y(t), \\
x(0) &=& 1, \\
y(0) &=& -1.
\end{array}\right.
$$
The C-H-Z method implies $x(t)=c_1e^{4t}+c_2e^{6t}$, but $c_1,c_2$ are not arbitrary constants: they are determined by the initial conditions $x(0)=1,y(0)=-1$. Then $x'=5x+y$ can be solved for $y$ to obtain $y(t)=x'(t) -5x(t)$. Substitute expression $x(t)=c_1e^{4t}+c_2e^{6t}$ into $y(t)=x'(t) -5x(t)$ to obtain
$$y(t)=x'(t) -5x(t) = 4c_1e^{4t}+6c_2e^{6t} - 5(c_1e^{4t}+c_2e^{6t}) = -c_1e^{4t}+c_2e^{6t}.$$
Then
\begin{equation}\label{scalar.answer}
\left\{\begin{array}{lcrcl}
x(t)&=&c_1e^{4t}&+&c_2e^{6t},\\
y(t) &=& -c_1e^{4t}&+&c_2e^{6t}.
\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}{rcrcl}
1&=&c_1e^{0}&+&c_2e^{0},\\
-1 &=& -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^{4t}$, $y(t)=-e^{6t}$.
\newline
(b) Available are methods (1) and (3). The eigenanalysis method does not apply, because the matrix is not diagonalizable.
Other methods are possible, for example the linear integrating factor method for cascades, provided the matrix is triangular.
\newline
(c) Methods (1), (2) and (3) apply.
\newline
(d) Any of methods (1), (2), (3) apply because the matrix is diagonalizable. The triangular matrix has eigenvalues $1,1,0$ and eigenpairs
$$\left(1,\colvector{1,0,0}\right), \left(1,\colvector{0,1,0}\right),\left(0,\colvector{-1,-1,1}\right).$$
By the eigenanalysis method,
$$\.u = c_1e^t\colvector{1,0,0} + c_2e^t\colvector{0,1,0} + e^0\colvector{-1,-1,1}.$$
\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 $\frac{d}{dt}\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
\iffalse
with(LinearAlgebra):
A:=<4,1,1|1,4,1|0,0,5>^+;LinearAlgebra[Eigenvectors](A);
A-5*IdentityMatrix(3);
ReducedRowEchelonForm(%);
B:=<1,1,0,0|1,1,1,-1|-1,1,-1,0|0,0,0,1>^+;
Determinant(B);
de:=diff(y(x),x,x)+ 2*diff(y(x),x) + 5*y(x) = 10*cos(x)-100*sin(x);
dsolve([de,y(0)=1,D(y)(0)=0],y(x));
dsolve(de,y(x));
de1:=diff(y(x),x,x)+ 2*diff(y(x),x) + 1*y(x) =exp(-x);dsolve(de1,y(x));

de2:=diff(y(x),x,x,x)+ diff(y(x),x)=0;ic:=y(0)=1,D(y)(0)=1,D(D(y))(0)=0;dsolve([de2,ic],y(x));
des:=diff(x(t),t)=4*x(t)+y(t)+30,diff(y(t),t)=x(t)+4*y(t)+60;dsolve([des,x(0)=0,y(0)=0],[x(t),y(t)]);

C:=<4,1|1,4>;Eigenvectors(C);
Eigenvectors(C);
\fi


