\documentclass[12pt,pages]{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 
\addtolength{\itemsep}{5cm}
\item Let $s:[a,b] \to \R$ be a function.  What
  does it mean to say that $s$ is a \emph{step function}?
\item Let $s:[a,b] \to \R$ be a step function.  Define $\ds\int_a^b s$.
\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$.
\een
\ep


\bp \textbf{[2 points each]} Compute.  Do three out of four, or do all
four for a bonus.
\ben
\addtolength{\itemsep}{3.5in}
\item $\ds \int_1^5 \left [ \frac{1}{2}x+1 \right]dx$
\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}.$
\een
\ep

\addtocounter{problemnum}{-1}

\bp \textbf{Continued}.
\ben
\addtolength{\itemsep}{3.5in}
\addtocounter{enumi}{2}
\item $\ds \int_0^4 |2x-6|dx$
\item $\ds \int_1^3 (3x^2-5x) dx$
\een
\ep


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

\item For all functions $f,g,h:\R \to \R$, $f\circ (g+h)=f\circ
  g+f\circ h.$

\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$.

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

\item If $s:[a,b]\to \R$ is a step function, then $s([a,b])$ is a
  finite set.


\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.

\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$}.$$

% \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.$$

\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)$
\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]$?
\item \textbf{[2 points]} Is $f$ integrable on $[0,1]$?
\item \textbf{[2 bonus points]} Determine $\underline{I}(f)$ and $\overline{I}(f)$.
\een
\ep

\bp Short answer.  \textbf{[2 points each]}  Do three out of four.  Or
do all four for a bonus.
\ben
\addtolength{\itemsep}{4cm}


\item Find a rational number and an irrational number in the interval $\left(0,\frac{1}{2}\right)$.

\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.

\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}$
\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}$.
\een
\ep


















\end{exam}
\end{document}
















