\documentclass[12pt,answers]{exam}
\usepackage{amsmath,amsfonts, times,amsthm,graphicx}

% \setlength{\textwidth}{6.5 in}
% \setlength{\oddsidemargin}{0pt}
% \setlength{\evensidemargin}{0pt}
% \setlength{\textheight}{8.5 in}
% \setlength{\headsep}{20pt}
% \setlength{\topmargin}{20pt}

\renewcommand{\theenumi}{\alph{enumi}}
\renewcommand{\labelenumi}{(\theenumi)}

\newcommand{\ds}{\displaystyle}
\newcommand{\ben}{\renewcommand{\theenumi}{\alph{enumi}}\renewcommand{\labelenumi}{(\theenumi)}\begin{enumerate}}
\newcommand{\een}{\end{enumerate}}

\newcommand{\ba}{\begin{longanswer}}
\newcommand{\ea}{\end{longanswer}}

\theoremstyle{theorem}
\newtheorem*{claim}{Claim}

\newcommand{\bp}{\addtocounter{problemnum}{1}\begin{problem}}
\newcommand{\ep}{\end{problem}}

\newcommand{\N}{\mathbb{N}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\id}{\operatorname{id}} 

\newcommand{\ra}{\rightarrow} 

\title{Midterm}
\target{Math 157}

\begin{document}


\begin{exam}{November 14, 2013}


\bp Define.  \textbf{[2 points each]}
\ben 
\item Let $s:[a,b] \to \R$ be a function.  What
  does it mean to say that $s$ is a \emph{step function}?
\ba
A function $s:[a,b]\to \R$ is a step function if and only if there exists a partition $P=\{x_0,x_1,
\ldots, x_n\}$ of the interval $[a,b]$ for which $s$ is constant on
the open subintervals $(x_{k-1},x_k)$.
\ea
\item Let $s:[a,b] \to \R$ be a step function.  Define $\ds\int_a^b
  s$.
\ba
Let $P=\{x_0,x_1,
\ldots, x_n\}$ be a partition of $[a,b]$ for which $s$ is constant on
the open subintervals $(x_{k-1},x_k)$.  Let $s_k$ be the constant
value of $s$ on $(x_{k-1},x_k)$.  Then $$\int_a^b s := \sum_{k=1}^n s_k
(x_k-x_{k-1}).$$  
\ea
\item Let $f:[a,b] \to \R$ be any bounded function.  Define the statement
\emph{$f$ is integrable}, and the expression $\ds\int_a^b f$.
\ba If there exists one and only one number $I$ satisfying 
$$\int_a^b s <I<\int_a^b t$$
for all step functions $s$ and $t$ with $s<f<t$, then we say $f$ is
integrable and we denote the number $I$ by $\ds \int_a^b f$.

\ea
\een
\ep


\bp \textbf{[2 points each]} Compute.  Do three out of four, or do all
four for a bonus.
\ben
\item $\ds \int_1^5 \left [ \frac{1}{2}x+1 \right]dx$
\ba The function $s(x)=\left [ \frac{1}{2}x+1 \right]$ is a step
function taking the value $1$ on $(1,2)$, the value $2$ on $(2,4)$ and
the value $3$ on $(4,5)$.  

$$\includegraphics[scale=0.5]{answerpic1.pdf}$$

So, $$\int_1^5 \left [ \frac{1}{2}x+1 \right]dx=1(1)+2(2)+3(1)=8.$$
\ea
\item $\ds \int_{0}^5 f$ where $f(x)=\begin{cases}1 &\text{ if }3\leq
    |x^2-4|\leq 5\\ 0 &\text{ otherwise}.\end{cases}.$
\ba Note that $$|x^2-4|\leq 5 \Leftrightarrow
-3\leq x \leq 3.$$  and $$3\leq |x^2-4| \Leftrightarrow -1\leq x \leq
1 \text{ or }x\leq -\sqrt{7} \text{ or }x\geq \sqrt{7}.$$
Therefore, $\ds 3\leq|x^2-4|\leq 5 \Leftrightarrow -3\leq x\leq
-\sqrt{7} \text{ or }-1\leq x \leq 1 \text{ or }\sqrt{7}\leq x \leq
3.$

$$\includegraphics[scale=0.5]{answerpic2.pdf}$$

So, $$\ds \int_{0}^5 f=1(1-0)+1(3-\sqrt{7})=4-\sqrt{7}.$$
\ea
\een
\ep

\addtocounter{problemnum}{-1}

\bp \textbf{Continued}.
\ben
\addtocounter{enumi}{2}
\item $\ds \int_0^4 |2x-6|dx$
\ba Since the function $f:[0,4]\to \R$ given by $f(x)=|2x-6|$ is
piecewise monotonic, it is integrable and since it's nonegative, the
integral is the area of the ordinate set of $f$.  Here's a picture of
the ordinate set, which is the union of two triangles of area
$\frac{1}{2}(6)(3)=9$ and $\frac{1}{2}(2)(1)=1$.
$$\includegraphics[scale=0.5]{answerpic3.pdf}$$
So, $$\int_0^4 |2x-6|dx=10.$$


\ea

\item $\ds \int_1^3 (3x^2-5x) dx$
We compute:
\begin{align*}
\int_1^3 (3x^2-5x) dx&=\int_0^3 (3x^2-5x) dx - \int_0^1 (3x^2-5x) dx \\
&=3\int_0^3 x^2 dx -5\int_0^3 x dx - 3\int_0^1 x^2
dx +5\int_0^1 x dx\\
&=3\frac{3^3}{3}-5 \frac{3^2}{2}-3\frac{1^3}{3}+5\frac{1^2}{2}\\
&=6.
\end{align*}

\een
\ep


\bp True or false : 
\textbf{[Right answer $+1$, wrong answer
  $-1$, no answer $+\frac{1}{2}$]}
\ben

\item For all functions $f,g,h:\R \to \R$, $f\circ (g+h)=f\circ
  g+f\circ h.$
\ba False.  For example, if $f(x)=1$, $g(x)=2$, $h(x)=2$, then $f\circ (g+h)(x)=1$
and $f\circ   g+f\circ h=2.$
\ea
\item For every function $f:[a,b]\to \R$, there exist step functions
  $s,t:[a,b]\to \R$ with $s\leq f\leq t$.
\ba False.  The function $f:[-1,1]\to \R$ given by $f(x)=\frac{1}{x}$
if $x\neq 0$ and $f(0)=5$ is unbounded and there are no step functions
$s$ with $s\leq f$ and no step function $t$ with $f\leq t$.
\ea

\item If $f$ is integrable and even, then $\ds\int_{-b}^b f(x)dx = 2
  \ds \int_{0}^b f(x)dx.$
\ba True.
\ea

\item If $s:[a,b]\to \R$ is a step function, then $s([a,b])$ is a
  finite set.
\ba True.  By definition, there's a partition $\{x_0,\ldots, x_n\}$ of
$[a,b]$ for which $s$ is constant on the $n$ open subintervals
$(x_{k-1},x_k)$.  Accounting for the possibly distinct values of $s$
at the $n+1$ endpoints shows that $s$ takes on at most $2n+1$ values.
\ea

\item If $s:[a,b] \to \R$ is a step function, then for any $y\in \R$,
  the set $s^{-1}(\{y\})$ is either empty or an interval.
\ba
False.  For example, if $s:[0,3]\to \R$ is given by $s(x)=1$ if $0\leq
x<1$, $x(x)=2$ if $1\leq x \leq 2$ and $s(x)=1$ if $2<x\leq 3$.  Then
we have $s^{-1}(\{1\})=[0,1)\cup (2,3]$ which is not an interval.
\ea
\een
\ep

\addtocounter{problemnum}{-1}
\bp \textbf{Continued}.
\ben
\addtocounter{enumi}{5}
\item Let $\pi_1:\R\times \R \to \R$ and $\pi_2:\R \times \R \to \R$
  be the canonical projections.  Let $A\subseteq \R\times \R$ be the ordinate set of a
  nonegative function $f$.  Then $$\pi_1(A)=\text{the
    domain of $f$}\quad\text{ and }\quad\pi_2(A)=\text{the range of $f$}.$$
\ba False.  Say $f:[0,1]\to \R$ is given by $f(x)=2$.  Then the
ordinate set $A$ of $f$ is the rectangle $A=\{(x,y):0\leq x \leq 1
\text{ and }0 \leq y \leq 2\}$.  We see $\pi_1(A)=[0,1]=\text{the
  domain of $f$}$ but $\pi_2(A)=[0,2]\neq \text{the range of $f$}=\{2\}.$
\ea
% \item For any $a,b,c,d\in \R$, $(ac+bd)^2\leq (a^2+c^2)(b^2+d^2).$

% \item If $A$ and $B$ satisfy $$\frac{17-6n}{3}\leq A \leq B \leq
%   \frac{17+6n}{3}$$ for every $n\in \N$, then $A=B$

\item For every $\epsilon>0$, there exists a step function $s:[0,1]\to
  \R$ with $$s(x)\leq x^2\text{ for all }x\in[0,1] \text{ and }\ds\int_0^1 s>\frac{1}{3}-\epsilon.$$
\ba True.  We know that the function given by $f(x)=x^2$ is integrable
on $[0,1]$ and $\int_0^1 x^2=\frac{1}{3}.$  So, the lower integral
$\underline{I}(f)=\frac{1}{3}$.  Since $\frac{1}{3}-\epsilon$ is less
than $\frac{1}{3}$, which is 
the least upper bound of $$S=\left\{\int_0^1 s:\text{ $s$ is a step
  function with $s\leq f$}\right\}$$
there must be an element of $S$ greater than $\frac{1}{3}-\epsilon.$
That is, a step function $s$ with $s\leq f$ and $\int_0^1 s >\frac{1}{3}-\epsilon.$
\ea
\item If $f,g:[a,b]\to \R$ are integrable, then so is $fg$ and $\ds
  \int_a^b fg = \left(\int_a^b f\right)\left(  \int_a^b g\right)$
\ba False.  If $f=g=$ the constant function $1$ and $[a,b]=[0,3]$,
then $$\int_a^b fg=\int_0^3 1=3 \text{ and }\left(\int_a^b f\right)\left(  \int_a^b g\right)=\left(\int_0^3 1\right)\left(  \int_0^3 1\right)=(3)(3)=9.$$
\ea
\een
\ep


\bp Consider the function $f:[0,1]\to \R$ whose graph consists of
straight lines connecting 
\begin{gather*}
\left(1,0\right) \text{ and }\left(\frac{1}{2},1\right)\\
\left(\frac{1}{2},1\right) \text{ and }\left(\frac{1}{3},0\right)\\
\left(\frac{1}{3},0\right) \text{ and }\left(\frac{1}{4},1\right)\\
\left(\frac{1}{4},1\right) \text{ and }\left(\frac{1}{5},0\right)\\
\vdots
\end{gather*}
The value of $f$ at zero is immaterial, say $f(0)=0$ if you like.  
One could give a formula for $f$ on each interval
$\ds\left(\frac{1}{n},\frac{1}{n+1}\right)$ but a picture is worth a
thousand words:

\bigskip

\includegraphics{sawtooth.pdf}

\ben
\item \textbf{[2 points]} Is $f$ is piecewise monotonic on $[0,1]$?
\ba No.
\ea
\item \textbf{[2 points]} Is $f$ integrable on $[0,1]$?
\ba Yes.
\ea
\een
\ep

\addtocounter{problemnum}{-1}
\bp \textbf{Continued}.
\ben
\addtocounter{enumi}{2}
\item \textbf{[2 bonus points]} Determine $\underline{I}(f)$ and $\overline{I}(f)$.

\ba
$f$ is integrable, so $\underline{I}(f)=\overline{I}(f)=\int_0^1
f=\frac{1}{2}$.

To see that $\int_0^1 f=\frac{1}{2}$, 
first note that the ordinate set of $f$ on
any interval of the form $\left[\frac{1}{n},1\right]$ consists of the
union of a finite number of triangles, hence $\int_{\frac{1}{n}}^1 f$
  is the sum of the areas of these finitely many rectangles.  Adding
  them up (from right to left) we have
\begin{align*}
\int_{\frac{1}{n}}^1 f
&=\frac{1}{2}\left(1-\frac{1}{3}\right)+\frac{1}{2}\left(\frac{1}{3}-\frac{1}{4}\right)
+\frac{1}{2}\left(\frac{1}{4}-\frac{1}{5}\right) +\cdots
\frac{1}{2}\left(\frac{1}{n-1}-\frac{1}{n}\right)\\
&=\frac{1}{2}\left(1-\frac{1}{n}\right).
\end{align*} 
Intuitively, as $n$ gets larger and larger, these ordinates sets
exhaust more and more of the ordinate set of $f$ and we guess that
$\int_0^1 f=\frac{1}{2}.$

To make this idea rigorous, we use step functions.  Since  $\frac{1}{2}\left(1-\frac{1}{n}\right)-\frac{1}{n}< \int_{\frac{1}{n}}^1 f$, 
we can find a step function $s$ with $s<f$ and 
$\int_{\frac{1}{n}}^1 s\geq
\frac{1}{2}\left(1-\frac{1}{n}\right)-\frac{1}{n}.$  By extending $s$
to take the value $0$ on $\left[0,\frac{1}{n}\right)$, we've found a
step function $\tilde{s}$ less than $f$ with $$\int_0^1 \tilde{s}\geq
\frac{1}{2}\left(1-\frac{1}{n}\right)-\frac{1}{n}=\frac{1}{2}-\frac{3}{2n}.$$
Similarly, we can find a step function $t$ with $t>f$ on
$\left[\frac{1}{n},1\right]$ with
$\int_{\frac{1}{n}}t<\frac{1}{2}\left(1-\frac{1}{n}\right)+\frac{1}{n}.$
By extending $t$ to take the value $1$ on
$\left[0,\frac{1}{n}\right)$, we've found a step function $\tilde{t}$,
greater than $f$ with $$\int_0^1 \tilde{t}\leq
\frac{1}{2}\left(1-\frac{1}{n}\right)+\frac{1}{n}+\frac{1}{n}=\frac{1}{2}+\frac{3}{2n}.$$
Since $\frac{1}{2}$ is the only number that lies between
$\frac{1}{2}-\frac{3}{2n}$ and $\frac{1}{2}+\frac{3}{2n}$ for every
$n$, we conclude that $f$ is integrable on $[0,1]$ and $\int_0^1 f =\frac{1}{2}.$

\ea
\een
\ep

\bp Short answer.  \textbf{[2 points each]}  Do three out of four.  Or
do all four for a bonus.
\ben
\item Find a rational number and an irrational number in the interval $\left(0,\frac{1}{2}\right)$.
\ba $\frac{1}{4}$ is a rational number, and $\frac{\sqrt{3}}{4}$ is an
irrational number, in
$\left(0,\frac{1}{2}\right)$.  The number $\frac{\sqrt{3}}{4}$ is
irrational since $\sqrt{3}$ is irrational and $\frac{1}{4}$ is rational and the
product of an irrational number and a nonzero rational number is irrational.  The
number $\frac{\sqrt{3}}{4}$ lies in $\left(0,\frac{1}{2}\right)$ since 
$$0<\sqrt{3}<\sqrt{4}\Rightarrow 0<\frac{\sqrt{3}}{4}\leq \frac{\sqrt{4}}{2}=\frac{1}{2}.$$
\ea
\item If possible, find a left inverse and a right inverse of the
  function $f:\N \to \N$ given by $f(n)=n+2$.  If either is not
  possible, be sure to say so.
\ba Since $f$ is injective, it has a left inverse.  Since $f$ is not
surjective (the number $1$ is not in the image of $f$) it does not
have a right inverse.

The function $g:\N \to \N$ given by $$g(n)=\begin{cases}n-2 &\text{ if
  }n\geq 3\\
  8 & \text{ if }n=1,2
\end{cases}$$
is a left inverse of $f$.
\ea
\een
\ep

\addtocounter{problemnum}{-1}
\bp \textbf{Continued}.
\ben
\addtocounter{enumi}{2}
\item Compute $\underline{I}(f)$ and $\overline{I}(f)$ for $f:[0,1]\to \R$ given by 
$f(x)=\begin{cases} 1+x &\text{ if }x\in \Q,\\
2-x & \text{ if }x\notin \Q.
\end{cases}$
\ba
$$\underline{I}(f)=\frac{5}{4}\text{ and }\overline{I}(f)=\frac{7}{4}.$$

To see this, consider the lines $\{(x,y):y=1+x\}$ and $\{(x,y):y=2-x\}$.

$$\includegraphics[scale=0.5]{answerpic4.pdf}$$

Any step function less than $f$ has an ordinate set
contained in the region pictured below, and whose area is less than,
but can be as close as desired, to the area of this region.  Therefore
$\underline{I}(f)$ is
the area of this region, which is $\frac{5}{4}$.


$$\includegraphics[scale=0.25]{answerpic5.pdf}$$

Any step function greater than $f$ has an ordinate set
containing the region pictured below and whose area is greater than,
but can be as close as desired, to the area of this region.  Therefore
$\overline{I}(f)$ is
the area of this region, which is $\frac{7}{4}$.



$$\includegraphics[scale=0.25]{answerpic6.pdf}$$



\ea
\een
\ep


\addtocounter{problemnum}{-1}

\bp \textbf{Continued}.
\ben
\addtocounter{enumi}{3}
\item
Pictured below is the graph of an increasing function $g$. 

\bigskip
\includegraphics{plot_of_g2.pdf}
\bigskip

Let
$\{x_0,x_1,\ldots, x_n\}$ be a partition of the interval $[0,8]$ into $n$
subintervals of equal length and let
$$A=\sum_{k=1}^n g(x_{k-1})(x_k-x_{k-1} )\text{ and }B=\sum_{k=1}^n
g(x_k)(x_k-x_{k-1}).$$
Note that $$A\leq \int_0^8 g \leq B.$$

How large must $n$ be in order for $B-A \leq \dfrac{1}{10}$.
\ba
The difference
$$B-A=(g(x_n)-g(x_0))\left(\frac{8}{n}\right)=(12-2)\left(\frac{8}{n}\right)
=\frac{80}{n}.$$  Setting $$\frac{80}{n}\leq \frac{1}{10}\Rightarrow n\geq800.$$
\ea

\een
\ep


















\end{exam}
\end{document}
















