\documentclass[10pt,addpoints]{exam}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{enumerate}
\usepackage{mathrsfs}
\pagestyle{head}
\usepackage{hyperref}
%\headrule
%\header{MATH 11}{Exam 1}{Fall 2016}
\begin{document}
\begin{coverpages}
\begin{center}\huge MATH 4590 - EXAM 2 - SPRING 2018\\
SOLUTION
\end{center}
\begin{flushleft}\vspace{0.5in}
23 March 2018 \\
Instructor: Tom Cuchta
\end{flushleft}
\textbf{Instructions:}
\begin{itemize}
	\item  Show all work, clearly and in order, if you want to get full
	credit. If you claim something is true \textbf{you must show work backing up your claim}. I reserve the right to take off points if I cannot see how you arrived at your answer (even if your final answer is correct).
	\item Justify your answers algebraically whenever possible to ensure full credit. 	
	\item  Circle or otherwise indicate your final answers.
	\item  Please keep your written answers brief; be clear and to the point.
	\item  Good luck!
\end{itemize}
\vspace*{10pt}
\end{coverpages}

\begin{questions} 
\question[15] Write the definition.
\begin{parts}
\part[3] Let $(M,d)$ be a metric space and let $S \subset M$. Define what a limit of $S$ is. \\
\textit{Solution}: We say that $p \in M$ is a limit of $S$ provided there is a sequence $(p_n)$ in $S$ such that $p_n \rightarrow p$.
\part[3] Let $(M,d)$ be a metric space and let $S \subset M$. Define what it means for $S$ to be a closed set. \\
\textit{Solution}: We say that $S$ is closed if it contains all of its limits.
\part[3] Let $(M,d)$ be a metric space and let $S \subset M$. Define what it means for $S$ to be an open set. \\
\textit{Solution}: We say that $S$ is open if $\forall p \in S \exists r>0$ so that $\{q \in M \colon d(p,q)<r \} \subset S$. 
\part[3] Define what $\displaystyle\lim_{t \rightarrow a} f(t)=L$ means. \\
\textit{Solution}: $\forall \epsilon >0 \exists \delta > 0$ such that$|t-a| < \delta$ implies $|f(t)-L|<\epsilon$.
\part[3] Let $f \colon \mathbb{R} \rightarrow \mathbb{R}$. Define the derivative of $f$ at $x$. \\
\textit{Solution}: $f'(x) = \displaystyle\lim_{t \rightarrow x} \dfrac{f(t)-f(x)}{t-x}$
\end{parts}
\question[18] For each, sketch a picture of $S$ and decide whether $S$ is open, closed, both open and closed, or neither open nor closed.
\begin{parts}
\part[6] Consider the metric space $(M,d)=(\mathbb{R}^2,d)$, where $d((x_1,y_1),(x_2,y_2))=\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$ is the (usual) Eulcidean metric. Let 
$$S=\{(x,y)\in\mathbb{R}^2 \colon 0<x <2, -1<y<1\}.$$
\textit{Solution}: 

\begin{tikzpicture}
\draw (-3,0) -- (3,0);
\draw (0,-3) -- (0,3);
\draw[dashed,thick] (0,-1) --(2,-1);
\draw[dashed,thick] (0,1) --(2,1);
\draw[dashed,very thick] (0,-1) -- (0,1);
\draw[dashed,thick] (2,-1) -- (2,1);
\fill[gray,opacity=.5] (0,-1) rectangle (2,1);
\end{tikzpicture} \\
\textbf{Open} -- for any $p \in S$ choose $r$ to be the shortest distance to the boundary and divide it by $2$. \\
\textbf{Not closed} -- the point $(1,0) \not\in S$ while the sequence $(0,1-\frac{1}{n})$ is in $S$ and its limit is $(1,0)$.
\part[6] Consider the metric space $(M,d)=(\mathbb{R},d)$, where $d(x,y)=|x-y|$ is the usual metric on the real line. Let $S=\displaystyle\bigcup_{n=1}^{\infty} \left( \dfrac{1}{n}, 1 \right]$.\\
\textit{Solution}: Notice that $S= \displaystyle\bigcup_{n=1}^{\infty} = \underbrace{\Big( 1,1 \Big]}_{\text{empty}} \cup \Big( \dfrac{1}{2}, 1 \Big] \cup \left( \dfrac{1}{3}, 1 \right] \cup \ldots = \Big( 0,1 \Big]$ \\
\begin{tikzpicture}[scale=2]
\draw (-1.5,0) -- (1.5,0);
%\draw[fill=black] (0,0) circle (0.1em);
\draw (0,-0.3) node {$0$};
\draw (1,-0.3) node {$1$};
%\draw[fill=black] (1,0) circle (0.1em);
\draw (0,0) node {$\Big($};
\draw (1,0) node {$\Big]$};
\draw[very thick] (0,0) -- (1,0);
\end{tikzpicture} \\
\textbf{Not open} -- if $p = 1$ then for \textit{any} radius $r$, the set $\{q \in \mathbb{R} \colon |1-q|<r\}$ always contains points to the right of $1$, so it is never a subset of $S$. \\
\textbf{Not closed} -- the point $0$ is a limit of $S$ because it is a limit of the sequence $( \frac{1}{n})$ but $0 \not\in S$.
\part[6] Consider the metric space $(M,d)=((0,1),d)$, where $d(x,y)=|x-y|$ is the usual metric on the real line. Let $S=[0.5,1)$. \\
\textit{Solution}: \\
\begin{tikzpicture}[scale=4]
\draw (0,0) -- (1,0);
%\draw[fill=black] (0,0) circle (0.1em);
\draw (0,-0.3) node {$0$};
\draw (0.5,-0.3) node {$0.5$};
\draw (1,-0.3) node {$1$};
%\draw[fill=black] (1,0) circle (0.1em);
\draw (0.5,0) node {$\Big[$};
\draw (1,0) node {$\Big)$};
\draw[very thick] (0.5,0) -- (1,0);
\end{tikzpicture} \\
\textbf{Not Open} -- on the left this is ``obvious"; taking $p=0.5$, the ball determined by radius chosen will include points to the left of $0.5$. \\
\textbf{Closed} -- not as obvious here. We cannot say that $1$ is a limit of $S$ because $1$ is not in $S$! Therefore, $S$ contains all of its limits. The sequence $p_n = 1-\frac{1}{n}$ here does not converge: there is nothing to converge to. Notice in the definition of $p$ being a limit of $S$ requires ``$p \in M$".
\end{parts}
\question[12] Prove that $\displaystyle\lim_{x \rightarrow 3} 2x^2+x-1 = 20$.  \\
\textit{Solution}: Let $\epsilon > 0$. Choose $0<\delta < \min \left\{\frac{\epsilon}{15},1 \right\}$. Compute
$$\begin{array}{ll}
|(2x^2+x-1)-20| &= |(2x^2-18)+(x-3)| \\
&=|2(x^2-9) + (x-3)| \\
&=|2(x-3)(x+3) + (x-3)| \\
&= |x-3| |2(x+3) + 1| \\
&=|x-3| |2(x+3-3+3)+1| \\
&=|x-3| |2(x-3 + 6) + 1| \\
&=|x-3| |2(x-3) + 13| \\
&\leq |x-3| (2|x-3|+13) \\
&< \delta (2\delta + 13) \\
&< 15\delta \\
&< \epsilon.
\end{array}$$
\question[12] Prove that the intersection of finitely many open sets is open. (\textit{note: you may use the result from HW5 that says that the union of finitely many closed sets is closed}). \\
\textit{Proof}: Let $\mathcal{O}_1,\ldots,\mathcal{O}_n$ be a finite list of open sets. Then $\mathcal{O}_1^c, \ldots, \mathcal{O}_n^c$ is a finite list of closed sets (since the complement of an open set is a closed set). By the result from HW5, we know that $\mathcal{O}_1^c \cup \ldots \cup \mathcal{O}_n^c$ is a closed set. Therefore $\left( \mathcal{O}_1^c \cup \ldots \cup \mathcal{O}_n^c \right)^c$ is an open set. But,
$$\left( \mathcal{O}_1^c \cup \ldots \cup \mathcal{O}_n^c \right)^c = (\mathcal{O}_1^c)^c \cap \ldots \cap (\mathcal{O}_n^c)^c = \mathcal{O}_1 \cap \ldots \cap \mathcal{O}_n$$
is an open set, completing the proof. $\blacksquare$

\question[12] Use induction to prove that 
$$\dfrac{\mathrm{d}^n}{\mathrm{d}x^n} 
xe^{-x}= (-1)^n e^{-x}(x-n).$$
(\textit{note: you may use the basic rules from earlier calculus courses here -- no need to use the definition of the derivative}) \\
\textit{Proof}: Let $n=0$, then the left-hand side is
$$\underbrace{\dfrac{\mathrm{d}^0}{\mathrm{d}x^0} x e^{-x}}_{\text{``don't differentiate"}} = xe^{-x},$$
while the right-hand side is $(-1)^0 e^{-x} (x-0) = xe^{-x}$. Therefore the $n=0$ case holds. Now assume that the formula holds for $n=N$. Calculate
$$\begin{array}{ll}
\dfrac{\mathrm{d}^{N+1}}{\mathrm{d}x^{N+1}} &= \dfrac{\mathrm{d}}{\mathrm{d}x} \left[ \dfrac{\mathrm{d}^N}{\mathrm{d}x^N} xe^{-x} \right] \\
&= \dfrac{\mathrm{d}}{\mathrm{d}x} \left[ (-1)^N e^{-x} (x-N)\right] \\
&= (-1)^N \dfrac{\mathrm{d}}{\mathrm{d}x} \left[e^{-x}(x-N) \right] \\
&\stackrel{\text{prod. rule}}{=} (-1)^N \left[ -e^{-x}(x-N) + e^{-x} \right]  \\
&= (-1)^N e^{-x} [ N-x+1 ] \\
&= (-1)^{N+1} e^{-x} (x-(N+1)),
\end{array}$$
completing the proof. $\blacksquare$
\question[20] In this problem we investigate the Taylor approximation to the cosine function. 
\begin{parts}
\part[5] Find the 4th order Taylor polynomial of $f(x)=\cos(x)$. \\
\textit{Solution}: Calculate derivatives: $f'(x) = -\sin(x)$, $f''(x)=-\cos(x)$, $f'''(x)=\sin(x)$, $f^{(4)}(x)=\cos(x)$. Therefore the 4th order Taylor polynomial is
$$\begin{array}{ll}
\displaystyle\sum_{k=0}^4 \dfrac{f^{(k)}(x)}{k!} h^k &= \dfrac{f^{(0)}(x)}{0!} h^0 + \dfrac{f^{(1)}(x)}{1!} h + \dfrac{f^{(2)}(x)}{2!} h^2 + \dfrac{f^{(3)}(x)}{3!} h^3 + \dfrac{f^{(4)}(x)}{4!} h^4 \\
&=\cos(x) - \sin(x)h - \dfrac{\cos(x)h^2}{2!} + \dfrac{\sin(x)h^3}{3!} + \dfrac{\cos(x)h^4}{4!}.
\end{array}$$
\part[5] Set $x=0$ in the formula (this ``centers" it at zero). \\
\textit{Solution}: Setting $x=0$ yields
$$1 - 0 - \dfrac{h^2}{2!} + 0 + \dfrac{h^4}{4!}=1-\dfrac{h^2}{2!} + \dfrac{h^4}{4!}$$
\part[5] Use the Taylor approximation theorem to write a formula (in terms of $\theta$) for the remainder $R$ at $\dfrac{1}{2}$. \\
\textit{Solution}: $R \left( \dfrac{1}{2} \right)=\dfrac{f^{(5)}(\theta)}{5!} \left( \dfrac{1}{2} \right)^5 = \dfrac{-\sin(\theta)}{5!} \left( \dfrac{1}{2} \right)^5$
\part[5] Find a number $\xi \in \mathbb{R}$ such that $\left| R \left( \dfrac{1}{2}\right) \right| \leq \xi$. \\
\textit{Solution}: 
$$\left| R \left( \dfrac{1}{2} \right) \right| = \left| \dfrac{-\sin(\theta)}{5!} \left( \dfrac{1}{2} \right)^5 \right| \leq \dfrac{1}{2^5 5!}.$$
\end{parts}


\newpage
\begin{center}{\huge Pick ONE of these two problems to do -- \textbf{cross out} the one you don't want me to grade.}\end{center}
\question[11] Prove that if $F$ is closed and $K$ is compact, then $F \cap K$ is compact.\\
\textit{Proof}: Let $(a_n)$ be a sequence in $F \cap K$. Since $(a_n)$ is in $K$, it has a convergent subsequence $(a_{n_k})$ in $K$. But $(a_{n_k})$ is a subsequence of a sequence in $F \cap K$, so it also lies in $F \cap K$. Since $(a_{n_k})$ is a convergent sequence in $F$, it follows that its limit is also in $F$ and hence also in $F \cap K$. $\blacksquare$

\question[11] Prove that $|\sin(x)-\sin(y)| \leq |x-y|$ by applying the mean value theorem to the function $f(x)=\sin(x)$ on the interval $[x,y]$. \\
\textit{Proof}: By the mean value theorem, there is a $\theta \in [x,y]$ so that 
$$\dfrac{\sin(x)-\sin(y)}{x-y}=\sin'(\theta)=\cos(\theta).$$
Taking absolute value and multiplying by $|x-y|$ yields
$$|\sin(x)-\sin(y)| = \underbrace{|\cos(\theta)|}_{\leq 1} |x-y| \leq |x-y|. \blacksquare$$

\iffalse
\newpage
Let $(M,d)$ be a metric space and let $S \subset M$. We say that $p \in M$ is a limit of $S$ provided there is a sequence $(p_n)$ in $S$ such that $p_n \rightarrow p$. We say that $S$ is closed if it contains all of its limits. We say that $S$ is open if $\forall p \in S \exists r > 0$ so that $\{q \in M \colon d(p,q) < r \} \subset S$. We say that $S$ is compact if every sequence $(a_n)$ in $S$ has a convergent subsequence $(a_{n_k})$.
\hrule
\noindent \textbf{Theorem} {Mean Value Theorem}: If $f$ is continuous on $[a,b]$ and differentiable on $(a,b)$, then there exists $\theta \in (a,b)$ such that $f'(\theta) = \dfrac{f(b)-f(a)}{b-a}$.
\hrule
\noindent The $r$th order Taylor polynomial of a $r$-times differentiable function $f(x)$ is given by
$$P(h)=\displaystyle\sum_{k=0}^r \dfrac{f^{(k)}(x)}{k!} h^k.$$ 
Also recall that the remainder $R(h)$ is given by 
$$R(h)=f(x+h)-P(h),$$
and (assuing $f$ is $r+1$-times differentiable) that the \textbf{Taylor Approximation Theorem} says that there is some $\theta \in (0,h)$ so that 
$$R(h)=\dfrac{f^{(r+1)}(\theta)}{(r+1)!} h^{r+1}.$$
\hrule
\noindent $\displaystyle\lim_{x \rightarrow a} f(x) = L$ means that $\forall \epsilon > 0 \exists \delta > 0$ such that if $|x-a|<\delta$, then $|f(x)-L|<\epsilon$.
\hrule
\noindent The derivative of $f$ at $x$ is given by $f'(x)=\displaystyle\lim_{t \rightarrow x} \dfrac{f(t)-f(x)}{t-x}$. 

\noindent 
\fi
\end{questions}
\end{document} 