\documentclass[12pt]{article}
\usepackage{amsmath,url}

% This set of parameters are used to distribute the assignment to the class (in paper form)
% and for posting on the class web site (for those who missed the class).
% With the pdf option the information contained in the keys below are placed
% in the document info of the PDF document. If you don't have the AcroTeX Bundle
% installed, remove the pdf option.
\usepackage[pdf,forpaper,myconfigi,nopoints,nosolutions]{eqexam}

% Note: When using a PDF option like pdf, you need to specify a driver
% that is passed to hyperref, web.sty etc. For example,
% \usepackage[pdf,pdftex,forpaper,myconfigi,nopoints,nosolutions]{eqexam}

% This set of parameters are used to publish the solutions on the class web site, if
% desired.
% \usepackage[pdf,forpaper,myconfigi,pointsonleft,answerkey]{eqExam}

% Note the use of the myconfigi parameter. This then inputs eqexami.cfg, there I
% have placed some definitions specific to a homework assignment.

\subject[AC2]{Advanced Calculus II}
\title[HW1]{HW \#1}
\author{Dr.\ D. P. Story}
\date{Spring 2005}
\duedate{01/28/05}
\keywords{Homework due \theduedate}
\begin{document}

\maketitle

\begin{exam}{HW}

\ifanswerkey
\begin{instructions}[Solutions]
Below, please find a set of solutions to this assignment.
\end{instructions}
\else
\begin{instructions}[]
Assignments should be neatly-written, well-organized and concise.
If you miss a class and need to get an assignment, see
$$
   \text{\url{http://www.math.uakron.edu/~dpstory/}}
$$
All class assignments and other announcements will be posted on
this web site.
\end{instructions}
\fi

\begin{eqComments}[]\S4.3, page 155\footnote{in the text}.\end{eqComments}

\begin{problem}[4]
Problem 15. Use the definition to prove $f(x) = x^2$ is convex on
$\mathbb{R}$.
\begin{solution}
Let $[c,d]$ be any interval and let $t\in[0,1]$, we need to prove
\begin{equation}
    f\bigl(  (1-t)c + td \bigr) \le (1-t) f(c) + tf(d)\label{eq0}
\end{equation}
or,
\begin{equation}
    \bigl( ( 1-t )c + td \bigr)^2 \le (1-t) c^2 + t d^2\label{eq2}
\end{equation}
We show that the right-side minus the left-side in \eqref{eq2} is  nonnegative. Indeed,
\begin{align*}
    (1-t) c^2 + &t d^2 - \left( ( 1-t )c + td \right)^2 \\&
        = (1-t) c^2 + t d^2 - \left( ( 1-t )^2 c^2 + 2t(1-t)cd + t^2d^2 \right)\\&
        = (1-t)[1-(1-t)]c^2 - 2t(1-t)cd + t(1-t)d^2\\&
        = t(1-t)c^2 - 2t(1-t)cd + t(1-t)d^2\\&
        = t(1-t)( c - d )^2 \ge 0
\end{align*}
From the first and last lines we have  $(1-t) c^2 + t d^2 - \left( ( 1-t )c + td \right)^2\ge0$. This is equivalent
to the desired inequality~\eqref{eq2}. \eqfititin{$\square$}

\medskip\noindent\textit{Alternate Solution}:
We apply the \textbf{Cauchy-Schwartz Inequality}, page.~16, to the expression on the left side of line~\eqref{eq2}.
For convenience, I paraphrase the \textbf{Cauchy-Schwartz Inequality}:
$$
    \left(\sum_{k=1}^n a_k b_k \right)^2 \le  \left(\sum_{k=1}^n a_k^2 \right) \left(\sum_{k=1}^n b_k^2 \right)
$$
Applying this inequality, with $a_1 = \sqrt{1-t}$, $b_1 =
\sqrt{1-t}\,c$,  $a_2 = \sqrt{t}$, $b_2 = \sqrt{t}\,d$  (here,
$n=2$, two terms),  we obtain,
\begin{align*}
(1-t)^2 c^2 + t^2 d^2 &
    \le \left( (\sqrt{1-t})^2 + (\sqrt{t})^2\right)\left((\sqrt{1-t}\,c)^2 + (\sqrt{t}\,d)^2\right)\\&
    = (1-t)c^2 + td^2
\end{align*}
Thus,
$$
    (1-t)^2 c^2 + t^2 d^2 \le (1-t)c^2 + td^2
$$
which is line~\eqref{eq2}, what we wanted to prove.
\end{solution}
\end{problem}

\begin{problem}[3]
Problem 18. Prove the sum of two convex functions is convex.
\begin{solution}
Seems simple enough. Suppose $f$ and $g$ be convex on $I$. Let $[\,c,d\,]\subseteq$ and let $t\in[\,0,1\,]$. Then
\begin{align*}
    (f+g)\bigl( (1-t) c + td \bigr) &
        = f\bigl( (1-t) c + td \bigr) + g\bigl( (1-t) c + td \bigr)\\&
        \le (1-t) f(c) + tf(d) + (1-t) g(c) + tg(d)\\&
        = (1-t) (f+g)(c) + t(f+g)(d)
\end{align*}
Thus, $(f+g)\bigl( (1-t) c + td \bigr) \le (1-t) (f+g)(c) + t(f+g)(d)$, which is what we wanted to prove.
\end{solution}
\end{problem}

\begin{problem}[2]
Problem 20. Give an example of a function that is convex and unbounded on $(0,1)$.
\begin{solution}
Let $ f(x) = 1/x $, $ x \in (0,1) $. This function is clearly unbounded and since $ f''(x) = 1/x^3\ge 0$ on $(0,1)$,
it is convex on $(0,1)$.
\end{solution}
\end{problem}

\begin{problem}[4]
Problem 21. Define
$$
    f(x) = \begin{cases}
                2, & x = -1;\\
                x^2, & -1 < x < 2;\\
                5,   & x = 2
           \end{cases}
$$
Show $f$ is convex on $[\,-1,2\,]$ but not continuous on  $[\,-1,2\,]$.
\begin{solution}
Define $g(x) = x^2$, $x\in[\,-1,2\,]$. Then $g$ is twice differentiable on $[\,-1,2\,]$ and $ g''(x) = 2\ge 0$, hence,
$g$ is convex on $[\,-1,2\,]$. Note that $ g(x) \le f(x) $ for all $x\in[\,-1,2\,]$.

Let $[\,c,d\,]\subseteq [\,-1,2\,]$, we need to show, $\forall t \in [\,0,1\,]$,
$$
    f\bigl(  (1-t)c + td \bigr) \le (1-t) f(c) + tf(d)
$$
This inequality is \emph{always true} for $t=0$ and $t=1$, so it suffices to assume
$t\in(0,1)$, this implies $(1-t)c \ne -1$ and $ td \ne 2$, hence, $(1-t)c + td\in(-1,2)$ . Thus,
$$
    f\bigl(  (1-t)c + td \bigr) = g\bigl(  (1-t)c + td \bigr)) \le (1-t) g(c) + tg(d) = (1-t) f(c) + tf(d)
$$
As the assertion about the discontinuity of $f$ (at its endpoints) is obvious, this completes the proof.
\end{solution}
\end{problem}

\begin{problem}[3]
Problem 23. Suppose $f$ is convex on $\mathbb R$, prove $f$ is continuous on $\mathbb R$.
\begin{solution}
This is an application of \textbf{Theorem~4.28}. Let $x\in\mathbb R$, enclose $x$ in a open
interval $(a,b)$, where $a$, $b\in\mathbb R$. Then $f$ is convex on $(a,b)$, since it is convex
on $\mathbb R$, so by  \textbf{Theorem~4.28}, $f$ is continuous on $(a,b)$. Since $f$ is continuous
on $(a,b)$, it is, in particular, continuous at $x\in(a,b)$.

We have shown that for any $x\in\mathbb R$, $f$ is continuous at
$x$, this means that $f$ is continuous on $\mathbb R$.
\end{solution}
\end{problem}
\end{exam}
\end{document}
