\documentclass[12pt]{article}
\usepackage{amsfonts}


%new commands

% reference for equation labels
\newcommand{\eq}[1]{(\ref{#1})}

% abbreviations for equation environments
\newcommand{\be}{\begin{equation}}
\newcommand{\ee}{\end{equation}}
\newcommand{\bea}{\begin{eqnarray}}
\newcommand{\eea}{\end{eqnarray}}
\newcommand{\beann}{\begin{eqnarray*}}
\newcommand{\eeann}{\end{eqnarray*}}


% abbreviation for reals

\def\Cx{\mathbb{C}}
\def\Nl{\mathbb{N}}
\def\Ra{\mathbb{Q}}
\def\Rl{\mathbb{R}}
\def\Ts{\mathbb{T}}
\def\Ir{\mathbb{Z}}
\def\DD{\mathcal{D}}

% abbreviations for \varepsilon and \varphi
\newcommand{\eps}{\varepsilon}
\newcommand{\vphi}{\varphi}


%\pagestyle{empty}

\begin{document}



\centerline{\textsc{Advanced Calculus}}
\centerline{\textbf{Math 127B, Winter 2005}}
\centerline{\textbf{Solutions: Midterm 2}}

\bigskip\bigskip

\noindent
\textbf{1.} [10\%]  For each of the following statements, say if it is true or false. (No explanation is required.)

\smallskip\noindent
(a) If $f$ is differentiable at an interior point $x$ of its domain and $f^\prime(x)=0$,
then $f$ has a local maximum or minimum at $x$.

\smallskip\noindent
(b) If $f$ has a local maximum or minimum
at an interior point $x$ of its domain and $f$ is differentiable at $x$,
then $f^\prime(x)=0$.

\smallskip\noindent
(c) If $f$ is differentiable in an open interval, then $f$ is continuous in the interval.


\smallskip\noindent
(d) If $f$ is differentiable in an open interval, then $f^\prime$ is continuous
in the interval.


\bigskip\noindent
\textbf{Solution.}
\begin{itemize}
\item (a) False. (Counter-example: $f(x) = x^3$ at $x=0$.)
\item (b) True. (Follows from limit definition of the derivative.)
\item (c) True. (Differentiable implies continuous.)
\item (d) False. (Counter-example: the function $f(x) = x^2\sin(1/x)$ for $x\ne 0$
and $f(0)=0$ is differentiable on $\Rl$, but the derivative is discontinuous at $x=0$.)
\end{itemize}


\newpage\noindent
\textbf{2.} [15\%] State the mean value theorem. Prove that
\[
|\sin x - \sin y| \le |x- y|\qquad \mbox{for all $x,y\in \Rl$}.
\]

\bigskip\noindent
\textbf{Solution.}
\begin{itemize}
\item Mean Value Theorem: If $f : [a,b] \to \Rl$ is continuous on $[a,b]$ and
differentiable in $(a,b)$, then there exists $a<x<b$ such that
\[
f(b) - f(a) = f^\prime(x) (b-a).
\]

\item If $x\ne y$, then, since $(\sin x)^\prime = \cos x$,
the mean value theorem implies that there exists $z$ between $x$ and $y$
such that
\[
\sin x - \sin y = \cos z (x-y).
\]
Since $|\cos z| \le 1$, it follows that
\[
|\sin x - \sin y| = |\cos z| \,|x-y| \le |x-y|.
\]
If $x=y$, then the inequality is obviously true.
\end{itemize}


\newpage
\noindent
\textbf{3.} [15\%] Use L'Hospital's rule to evaluate the following limit:
\[
 \lim_{x\to 0^+} \frac{\log(-\log x)}{\log x} 
\]
Justify your steps.



\bigskip\noindent
\textbf{Solution.}
\begin{itemize}
\item The function $\log x$ in the denominator is differentiable in $x>0$ with nonzero derivative
and approaches $-\infty$ as $x\to 0^+$. The function $\log(-\log x)$ in the numerator is differentiable
in $0 < x < 1$ and approaches $\infty$ as $x\to 0^+$. Thus the hypotheses of L'Hospital's theorem are satisfied,
and
\beann
\lim_{x\to 0^+} \frac{\log(-\log x)}{\log x} &=&
\lim_{x\to 0^+} \frac{[\log(-\log x)]^\prime}{[\log x]^\prime}\\
&=&\lim_{x\to 0^+} \frac{1/(-\log x)(-1/x)}{(1/x)}\\
&=&\lim_{x\to 0^+} \frac{1}{\log x}\\
&=& 0.
\eeann
\end{itemize}




\newpage
\noindent
\textbf{4.} [20\%] Let 
\beann
f(x) &=& \cases{x\sin(1/x^3) & for $x\ne 0$,\cr
0 & for $x=0$,}\\
g(x) &=& \cases{x^3\sin(1/x) & for $x\ne 0$,\cr
0 & for $x=0$.}
\eeann
(a) Is $f(x)$ differentiable at $x=0$? If so, what is $f^\prime(0)$?

\smallskip\noindent
(b) Is $g(x)$ differentiable at $x=0$? If so, what is $g^\prime(0)$?



\bigskip\noindent
\textbf{Solution.}
\begin{itemize}
\item (a) $f$ is not differentiable at $0$ because the limit of
\[
\frac{f(x) - f(0)}{x-0} = \frac{x\sin(1/x^3) - 0}{x-0} = \sin(1/x^3)
\]
does not exist as $x\to 0$.

\item (b) $g$ is differentiable at $0$, with $g^\prime(0) = 0$, because the limit of
\[
\frac{g(x) - g(0)}{x-0} = \frac{x^3\sin(1/x) - 0}{x-0} = x^2 \sin(1/x)
\]
as $x\to 0$ exists and is equal to zero (since
\[
|x^2\sin (1/x)| \le |x|^2 \to 0
\]
as $x\to 0$).

\end{itemize}



\newpage
\noindent
\textbf{5.} [20\%]
(a) Consider the sine function $\sin x$ defined on the open interval $-\pi/2 < x < \pi/2$.
Show that this function is strictly increasing and hence
invertible. What is the domain of the inverse function?

\smallskip\noindent
(b) Prove that the inverse function is differentiable, and compute its
derivative.
 

\bigskip\noindent
\textbf{Solution.}
\begin{itemize}
\item We have $(\sin x)^\prime = \cos x > 0$ for $-\pi/2< x < \pi/2$, so $\sin x$ is strictly increasing on
$(-\pi/2,\pi/2)$, since a differentiable function with strictly positive derivative is strictly increasing.
The domain of the inverse function is the range of $\sin x$, or $(-1,1)$.

\item Since $\sin x$ is differentiable and the derivative of $\sin x$ is nonzero in the domain considered,
the inverse function is differentiable. The derivative is given by
\beann
(\sin^{-1})^\prime(\sin x) &=& \frac{1}{(\sin x)^\prime}\\
&=&   \frac{1}{\cos x}.
\eeann
Writing $y = \sin x$, and using
\[
\cos x = \sqrt{1-\sin^2 x} = \sqrt{1-y^2},
\]
(we take the positive square root because $\cos x > 0$ for $-\pi/2 < x < \pi/2$), we get that
\[
(\sin^{-1})^\prime(y) = \frac{1}{\sqrt{1-y^2}}
\]
\end{itemize}



\newpage
\noindent
\textbf{6.} [20\%] (a) Let $f(x) = \log(1+x)$ for $x > -1$. Use a proof by induction
to show that for $n \ge 1$
\[
f^{(n)}(x) = \frac{(-1)^{n+1} (n-1)!}{(1+x)^n}.
\]

\smallskip\noindent
(b) Write out the Taylor series of $f$ (at $x=0$).

\smallskip\noindent
(c) Assume that $x > 0$. Give an expression for the remainder $R_n(x)$ between
$f(x)$ and its Taylor polynomial of degree $n-1$ involving an intermediate
point $0 < y < x$.


\smallskip\noindent
(d) Prove that the Taylor series converges to
$f(x)$ if $0 < x \le 1$.

 

\bigskip\noindent
\textbf{Solution.}
\begin{itemize}
\item (a) The formula holds for $n=1$, since
\[
f^\prime(x) = \frac{1}{1+x}.
\]
Now suppose the formula holds for $n\in \Nl$. Then
\beann
f^{(n+1)}(x) &=& \frac{d}{dx} f^{(n)}(x)\\
&=& \frac{d}{dx}\left[\frac{(-1)^{n+1} (n-1)!}{(1+x)^n}\right]\\
&=& (-1)^{n+1} (n-1)!\left[\frac{-n}{(1+x)^{n+1}}\right]\\
&=&  \frac{(-1)^{n+2} n!}{(1+x)^{n+1}},
\eeann
so the formula holds for $n+1$. The result follows by induction.

\item (b) We have $f(0) = 0$ and $f^{(n)}(0) = (-1)^{n+1} (n-1)!$. Hence the Taylor
series of $f$ at $0$ is
\beann
\sum_{n=0}^\infty \frac{f^{(n)}(0)}{n!} x^n &=& \sum_{n=1}^\infty \frac{(-1)^{n+1}}{n} x^n \\
&=& x - \frac{1}{2} x^2 + \frac{1}{3} x^3 - \frac{1}{4} x^4 + \dots.
\eeann

\item (c) There exists $0 < y < x$ such that
\[
R_n(x) = \frac{(-1)^{n+1}x^n}{n(1+y)^n}.
\]


\item (d) If $0 < x \le 1$, then $0 < y \le 1$, and therefore
\[
|R_n(x)| = \frac{x^n}{n(1+y)^n} \le \frac{1}{n}.
\]
It follows that $R_n(x) \to 0$ as $n\to \infty$, so
the Taylor series converges to $\log(1+x)$.
\end{itemize}


\end{document}
