\section*{Exercises}

\begin{ex}
  Consider the set of symmetric $n\times n$-matrices%
  \index{matrix!symmetric}%
  \index{symmetric matrix}, i.e., matrices satisfying $A=A^T$. Show
  that this set of symmetric matrices is a subspace of $\Mat_{n,n}$,
  the vector space of $n\times n$-matrices.
  % \begin{sol}
  % \end{sol}
\end{ex}

\begin{ex}
  Consider the set of all vectors
  $\begin{mysmallmatrix}{c}x\\y\end{mysmallmatrix}\in\R^2$ such that
  $x+y\geq 0$. Is this a subspace of $\R^2$?
  \begin{sol}
    No. It is not closed under scalar multiplication.
  \end{sol}
\end{ex}

\begin{ex}
  Consider the set of all vectors
  $\begin{mysmallmatrix}{c}x\\y\end{mysmallmatrix}\in\R^2$ such that $xy=0$. Is
  this a subspace of $\R^2$?
  \begin{sol}
    No. It is not closed under addition.
  \end{sol}
\end{ex}

\begin{ex}
  Let $V$ be the set of those polynomials $ax^2+bx+c\in\Poly_2$ such
  that $a+b+c=0$. Is $V$ a subspace of $\Poly_2$? Explain.
  % \begin{sol}
  % \end{sol}
\end{ex}

\begin{ex}
  Let $U,W$ be subspaces of a vector space $V$ and consider $U+W$
  defined as the set of all vectors that can be written of the form
  $\vect{u}+\vect{w}$, where $\vect{u}\in U$ and $\vect{w}\in W$. Show
  that $U+W$ is a subspace of $V$.
  % \begin{sol}
  % \end{sol}
\end{ex}

\begin{ex}
  Let $U,W$ be subspaces of a vector space $V$. Then $U\cap W$ consists
  of all vectors which are in both $U$ and $W$. Show that $U\cap W$ is a
  subspace of $V$.
  % \begin{sol}
  % \end{sol}
\end{ex}

\begin{ex}
  Let $U,W$ be subspaces of a vector space $V$. Then $U\cup W$
  consists of all vectors which are in either $U$ or $W$. Show that
  $U\cup W$ is not necessarily a subspace of $V$ by giving an example
  where $U\cup W$ fails to be a subspace.
  % \begin{sol}
  % \end{sol}
\end{ex}

\begin{ex}
  Let $U=\set{\left.\mat{x,y,z}^T \in \R^3~\right\vert~\abs{x} \leq 4}$. Is $U$ a
  subspace of $\R^3$?
  \begin{sol}
    This is not a subspace.
    $\begin{mysmallmatrix}{r} 1 \\ 1 \\ 1 \end{mysmallmatrix}$ is in it, but
    $5\begin{mysmallmatrix}{r} 1 \\ 1 \\ 1 \end{mysmallmatrix}$ is not.
  \end{sol}
\end{ex}

\begin{ex}
  Let $W$ be the subset of\/ $\Mat_{2,2}$ given by
  \begin{equation*}
    W = \set{\left.\begin{mysmallmatrix}{rr}
        a  & b \\
        c & d
      \end{mysmallmatrix}~\right\vert~ a,b,c,d \in K,~ a + b = c + d}
  \end{equation*}
  Is $W$ a subspace of $\Mat_{2,2}$?
  % \begin{sol}
  % \end{sol}
\end{ex}

\begin{ex}
  Let $U=\set{
    A\in\Mat_{2,2}
    ~\left\vert~
      A\begin{mysmallmatrix}{rr} 1 & 0 \\ 1 & -1 \end{mysmallmatrix}
      = \begin{mysmallmatrix}{rr} 1 & 1 \\ 0 & -1 \end{mysmallmatrix} A
    \right.}$.
  Show that $U$ is a subspace of $\Mat_{2,2}$.
\end{ex}

\begin{ex}
  Let $W$ be the subset of\/ $\Poly_3$ given by
  \begin{equation*}
    W = \set{ax^3 + bx^2 + cx + d \mid a,b,c,d \in K, d = 0}
  \end{equation*}
  Is $W$ a subspace of $\Poly_3$?
  % \begin{sol}
  % \end{sol}
\end{ex}

\begin{ex}
  Let $W$ be the subset of\/ $\Poly_3$ given by
  \begin{equation*}
    W = \set{p(x) \mid p(2) = 1}
  \end{equation*}
  Is $W$ a subspace of $\Poly_3$?
  % \begin{sol}
  % \end{sol}
\end{ex}

\begin{ex}
  Let $W$ be the subset of $\Seq_{\R}$ consisting of all sequences
  that are alternating, i.e., where $a_i\geq 0$ for even $i$ and
  $a_i\leq 0$ for odd $i$, or vice versa. Is $W$ a subspace of
  $\Seq_{\R}$?
\end{ex}

\begin{ex}
  Let $W$ be the subset of $\Seq_K$ consisting of all sequences that
  satisfy the recurrence relation
  $a_{n+3} = a_{n+2} + 2a_{n+1} - a_n$. Is $W$ a subspace of
  $\Seq_K$?
\end{ex}

\begin{ex}\label{ex:periodic}
  A sequence $(a_i)_{i\in\N}$ is called \textbf{periodic}%
  \index{periodic sequence}%
  \index{sequence!periodic} if there exists some $k>0$ such that for
  all $i$, $a_{i+k}=a_i$. The number $k$ is called a \textbf{period}
  of the sequence. For example, the following is a periodic sequence
  with period $3$:
  \begin{equation*}
    (1,5,-7,1,5,-7,1,5,-7,1,5,-7,1,\ldots).
  \end{equation*}
  \begin{enumerate}
  \item Show that the set of all periodic sequences of a fixed period
    $k$ forms a subspace of $\Seq_K$.
  \item More difficult: show that the set of all periodic sequences of
    all periods forms a subspace of $\Seq_K$.
  \end{enumerate}
\end{ex}

\begin{ex}
  A function $f:\R\to\R$ is called \textbf{symmetric}%
  \index{function!symmetric}%
  \index{symmetric function} if $f(x)=f(-x)$ for all $x\in\R$.  Let
  $W$ be the subset of $\Func_{\R,\R}$ consisting of all symmetric
  functions. Is $W$ a subspace of $\Func_{\R,\R}$?
\end{ex}

\begin{ex}
  A function $f:\R\to\R$ is said to \textbf{vanish at infinity}%
  \index{function!vanishing at infinity}%
  \index{vanish at infinity} if $\lim_{x\to\infty}f(x)=0$ and
  $\lim_{x\to-\infty}f(x)=0$. Let $W$ be the subset of $\Func_{\R,\R}$
  consisting of all functions that vanish at infinity. Prove that $W$
  is a subspace of $\Func_{\R,\R}$.
\end{ex}

\begin{ex}
  Show that the sets $S=\set{x+2,(x+2)^2}$ and
  $T=\set{x^2-4, x^2+x-2}$ span the same subspace of $\Poly_2$.
\end{ex}

\begin{ex}
  Show that the sets $S=\set{
    \begin{mysmallmatrix}{rr} 1 & 0 \\ 0 & 1 \end{mysmallmatrix},~
    \begin{mysmallmatrix}{rr} 0 & 1 \\ 1 & 0 \end{mysmallmatrix}
  }$ and $T=\set{
    \begin{mysmallmatrix}{rr} 1 & 1 \\ 1 & -1 \end{mysmallmatrix},~
    \begin{mysmallmatrix}{rr} 1 & 1 \\ -1 & 1 \end{mysmallmatrix}
  }$
  span the same subspace of $\Mat_{2,2}$.
\end{ex}


\subsection{Dot product}

\begin{frame}[fragile]{Dot product}

$ c = x^T\cdot y; \quad x,y \in R^n\text{ (vectors)} $

\vspace{10px}
 \begin{lstlisting}[language=Matlab]

function: c = dot(x,y)

   c = 0
   n = length(x)
 	for i = 1 : n
 		c = c + x(i)%*$\cdot$*)y(i)
 	end

 end dot
 \end{lstlisting}

\end{frame}

\subsection{saxpy}

\begin{frame}[fragile]{saxpy}

$ z = \alpha \cdot x + y == $ (saxpy = \textbf{s}calar \textbf{a}lpha \textbf{x} \textbf{p}lus \textbf{y})  $\alpha$ -- scalar
\vspace{10px}
 \begin{lstlisting}[language=Matlab]

function: z = saxpy(%*$\alpha$*),x,y)

  n = length(x)
 	for i = 1 : n

 		z(i) = %*$\alpha \cdot \text{x(i)} + \text{y(i)} $*)

 	end

 end saxpy
 \end{lstlisting}

\end{frame}

\subsection{The colon notation}

\begin{frame}{The colon notation}

$ A\in R^{m\cdot n} $ \\
\vspace{10px}
$k$-th row of $A$:
$$A(k, :) = [a_{k1}, a_{k2}, \dots , a_{kn}]$$
$k$-th column of $A$:
\vspace{10px}

\begin{center}
$A(:, k) = \left [ \begin{array}{l}
   a_{1k} \\
   a_{2k}\\
   \vdots\\
   a_{nk}
\end{array}
\right ] $
\end{center}

\end{frame}


\chapter{Solving Recurrences}

\section{The Master Theorem}

If $T(n) = aT(\frac{n}{b}) + O(n^d)$, then

\begin{math}
T(n) = \left\{
\begin{array}{l l}
O(n^d)       & \quad \text{if} d > log_ba \\
O(n^d logn)  & \quad \text{if} d = log_ba \\
O(n^{log_ba}) & \quad \text{if} d < log_ba \\
\end{array} \right.
\end{math}

\section{Recursion Tree}

We can reason about a recurrence of the form: $ T(n) = aT(\frac{n}{b})
+ f(n) $ where $ a \geq 0, b > 0 $ with the following recursion tree:

{
  % Current graphic is hand-drawn by John Howat.
  % Should replace asap with a nicer diagram
  \includegraphics[scale=1.2]{recursion_tree}
  %\caption{A recursion tree representing a recursions on n/b elements}
  \label{fig:recursion_tree}
}

This tree has the following properties:

\begin{enumerate}
\item The number of nodes at level $i$: $a^i$
\item Work done at each node of level $i$: $f(\frac{n}{b^i})$
\item Number of levels: $log_bn$
\item Number of leaves: $n^{log_ba}$
\end{enumerate}

We can use this information to solve the recurrence:

\begin{align*}
T(n)
&= \summ{i=0}{log_bn}
(\text{\# nodes at level } i)
(\text{work done at level } i) \\
&= \summ{i=0}{log_bn} a^i f(\frac{n}{b^i})
\end{align*}


\subsection{Series}\label{subsec:series}

Here \( (X, \norm) \) will refer to a Banach space over \( \BbbK \).

\begin{definition}\label{def:convergent_series}
  When extending addition to a countable amount of terms, we need to impose some regularity conditions to avoid contradictions. The topologies of \( \BbbR \) and \( \BbbC \) are complete and allow us to define convergent and divergent series. We define series in great generality because the theory easily allows it.

  A \term{numeric series} or simply \term{series} is an infinite sequence \( x_0, x_1, \ldots \in X \), which we call \term{terms}, usually written as
  \begin{equation}\label{def:convergent_series/series}
    \sum_{k=0}^\infty x_k.
  \end{equation}

  To each series, there corresponds its sequence of \term{partial sums}
  \begin{equation*}
    S_n \coloneqq \sum_{k=0}^n x_k, n = 0, 1, 2, \ldots
  \end{equation*}

  We can equivalently define a series as a sequence of partial sums and then recover the terms as
  \begin{equation*}
    x_k \coloneqq \begin{cases}
      S_0,           & k = 0, \\
      S_k - S_{k-1}, & k > 0
    \end{cases}
  \end{equation*}

  We say that the series \eqref{def:convergent_series/series} \term{converges} to a value \( x \) if \( \lim_{n \to \infty} S_n = x \) in the sense of \fullref{def:net_convergence/limit}. The value \( x \) is called the \term{sum} of the series.

  If a series does not converge, we say that it is \term{divergent}.

  If the related series
  \begin{equation}\label{def:convergent_series/absolute_series}
    \sum_{k=0}^\infty \norm{x_k}
  \end{equation}
  converges, we say that \eqref{def:convergent_series/series} is \term{absolutely convergent}.
\end{definition}

\begin{example}\label{ex:series}
  Several examples of series are
  \begin{itemize}
    \item An absolutely convergent series is \eqref{thm:geometric_progression/series_sum}.
    \item A divergent series is the harmonic series \eqref{eq:ex:harmonic_series/harmonic}.
    \item A convergent, but not absolutely convergent series is the alternating harmonic series \eqref{eq:ex:harmonic_series/alternating}.
  \end{itemize}
\end{example}

\begin{proposition}\label{thm:absolutely_convergent_series_is_convergent}
  An absolutely convergent series is convergent.
\end{proposition}
\begin{proof}
  Suppose that \eqref{def:convergent_series/absolute_series} converges.

  By the triangle inequality, for each index \( n \) we have
  \begin{equation*}
    \norm{\sum_{k=0}^n x_k} \leq \sum_{k=0}^n \norm{x_k} \leq \sum_{k=0}^\infty \norm{x_k}.
  \end{equation*}

  Thus, the sequence \( \left\{ \norm{\sum_{k=0}^{n} x_k} \right\}_{n=0}^\infty \) is a bounded (by \( \sum_{k=0}^\infty \norm{x_k} \)) monotone sequence, which by \fullref{thm:real_monotone_sequence_converges_iff_bounded} is convergent.

  Therefore, the series \eqref{def:convergent_series/series} is convergent.
\end{proof}

\begin{remark}\label{rem:establish_series_convergence_by_absolute_series}
  Convergence of the series \eqref{def:convergent_series/series} can be established using the convergence of the nonnegative series \eqref{def:convergent_series/absolute_series}.

  The convergence of the latter can be established using techniques in \fullref{subsec:real_series} like \fullref{thm:cauchys_root_test} or \fullref{thm:dalamberts_ratio_test}.
\end{remark}

\begin{proposition}\label{thm:infinitary_triangle_inequality}
  For every series \eqref{def:convergent_series/series} we have
  \begin{equation}\label{thm:infinitary_triangle_inequality/inequality}
    \norm{\sum_{k=0}^\infty x_k} \leq \sum_{k=0}^\infty \norm{x_k},
  \end{equation}
  where both limits are allowed to be infinite.
\end{proposition}
\begin{proof}
  If the series on the right diverges, the inequality is obviously true.

  Suppose that it is convergent. By \fullref{thm:absolutely_convergent_series_is_convergent}, the limit
  \eqref{def:convergent_series/series} exists.

  By the triangle inequality, for each index \( n \) we have
  \begin{equation*}
    \norm{\sum_{k=0}^n x_k} \leq \sum_{k=0}^n \norm{x_k}.
  \end{equation*}

  By \fullref{thm:one_sided_squeeze_lemma}, since both sequences are convergent, we obtain \fullref{thm:infinitary_triangle_inequality/inequality}.
\end{proof}

\begin{proposition}\label{thm:convergent_series_terms_vanish}
  The terms of the convergent series \eqref{def:convergent_series/series} vanish as \( k \to \infty \), that is,
  \begin{equation*}
    \lim_{k \to \infty} x_k = 0.
  \end{equation*}
\end{proposition}
\begin{proof}
  Since the series is convergent, its sequence of partial sums converges, i.e. the partial sums get arbitrarily close to each other. Then
  \begin{equation*}
    \norm{x_n} = \norm{S_n - S_{n-1}} \to 0.
  \end{equation*}
\end{proof}

\begin{theorem}\label{thm:product_of_series_convergence}
  Consider two convergent series
  \begin{equation}\label{thm:product_of_series_convergence/a}
    A \coloneqq \sum_{k=0}^\infty x_k
  \end{equation}
  and
  \begin{equation}\label{thm:product_of_series_convergence/b}
    B \coloneqq \sum_{k=0}^\infty y_k.
  \end{equation}

  If either \fullref{thm:product_of_series_convergence/a} or \fullref{thm:product_of_series_convergence/b} converges absolutely, then
  \begin{equation}\label{thm:product_of_series_convergence/prod}
    \sum_{k=0}^\infty \sum_{m=0}^k x_m y_{k-m} = AB.
  \end{equation}
\end{theorem}

\begin{proposition}[Cauchy's series convergence criterion]\label{thm:cauchy_series_convergence_criterion}\mcite[3.22]{Rudin1976Principles}
  The series \eqref{def:convergent_series/series} converges if and only if for every \( \varepsilon > 0 \) there exists an index \( k_0 \) such that
  \begin{equation*}
    \norm{\sum_{k=m}^n x_k} < \varepsilon \quad\forall m, n \geq k_0.
  \end{equation*}
\end{proposition}
\begin{proof}
  This is simply a restatement of \fullref{thm:cauchys_net_convergence_criterion}.
\end{proof}

\begin{proposition}[Cauchy's series continuity criterion]\label{thm:cauchy_series_continuity_criterion}\mcite[\textnumero 265]{Фихтенгольц1968Том2}
  Fix a topological space \( A \) and a set \( S \subseteq A \). Let \( \{ f_k \}_{k=0}^\infty \) be a sequence of continuous functions from \( S \) to \( X \).

  Define the function \( f: S \to X \) as
  \begin{equation}\label{thm:cauchy_series_continuity_criterion/function}
    f(x) \coloneqq \sum_{k=0}^\infty f_k(x).
  \end{equation}

  A sufficient condition for \( f \) to be continuous in \( S \) is that for every \( \varepsilon > 0 \) there exists an index \( K \) such that
  \begin{equation*}
    \norm{\sum_{k=m}^n f(x)} < \varepsilon \quad\forall m, n \geq K
  \end{equation*}
  simultaneously for all \( x \in S \).
\end{proposition}
\begin{proof}
  This is simply a restatement of \fullref{thm:uniform_limit_of_continuous_functions} in the style of \fullref{thm:cauchy_series_convergence_criterion}.
\end{proof}

\begin{corollary}[Weierstrass' series criterion]\label{thm:weierstrass_series_criterion}\mcite[\textnumero 265]{Фихтенгольц1968Том2}
  Let \( S \) be any set and \( \{ f_k \}_{k=0}^\infty \) be a sequence of functions from \( S \) to \( X \). Consider the series \fullref{thm:cauchy_series_continuity_criterion/function}. If
  \begin{equation*}
    \forall k \in \BbbZ^{>0} \ \exists M_k \in \BbbR^{>0} \ \forall x \in S : \norm{f_k(x)} < M_k
  \end{equation*}
  and if the series
  \begin{equation}\label{thm:weierstrass_series_criterion/dominating}
    \sum_{k=0}^\infty M_k
  \end{equation}
  converges, then the limit \fullref{thm:cauchy_series_continuity_criterion/function} exists for every \( x \in S \) and, furthermore, the series converges absolutely and uniformly.

  In analogy to \fullref{thm:positive_series_comparison}, we say that the series \fullref{thm:weierstrass_series_criterion/dominating} \term{dominates} the series \fullref{thm:cauchy_series_continuity_criterion/function}.

  In particular, if \( S \) has a topology and the functions \( f_k(x), k = 0, 1, \ldots \) are continuous (resp. uniformly continuous), so is \( f(x) \).
\end{corollary}
\begin{proof}
  By \fullref{thm:positive_series_comparison}, the series
  \begin{equation*}
    \sum_{k=0}^\infty \norm{f_k(x)}
  \end{equation*}
  converges for any \( x \in S \), hence \fullref{thm:cauchy_series_continuity_criterion/function} converges absolutely for any \( x \in S \).

  Furthermore, each of the functions \( f_k(x) \) is bounded by \( B(0, M_k) \) and \( M_k \) does not depend on \( x \), hence the convergence is uniform.

  The rest of the theorem follows from \fullref{thm:uniform_limit_of_continuous_functions}.
\end{proof}

\begin{corollary}\label{thm:continuous_function_series_powers_of_two}
  Let \( X \subseteq \BbbR \) be a nonempty set. Consider the series of real-valued real functions
  \begin{equation}\label{thm:continuous_function_series_powers_of_two/series}
    f(x) \coloneqq \sum_{k=0}^\infty \frac {f_k(x)} {2^k},
  \end{equation}
  where \( \{ f_k \}_{k=0}^\infty \subseteq B_{C(X)} \) is a sequence of continuous functions bounded in \( [-1, 1] \).

  Then \( f(x) \) is defined and continuous for all \( x \in X \).
\end{corollary}
\begin{proof}
  For \( \abs{x} \leq 1 \), the series is dominated by the geometric series \fullref{eq:ex:n_ary_decomposition/binary}, which sums to \( 2 \), hence by \fullref{thm:weierstrass_series_criterion} \( f(x) \) is continuous in the interval \( [-1, 1] \).

  Note that
  \begin{equation*}
    f(2x) \coloneqq \sum_{k=0}^\infty \frac x {2^{k-1}} = 2 f(x),
  \end{equation*}
  hence the series \fullref{thm:continuous_function_series_powers_of_two/series} also converges for \( \abs{x} \leq 2 \).

  By induction on \( n \), we show that \( f(2^n x) = 2^n f(x) \) and thus \( f(x) \) is continuous in \( B(0, 2^n) \), therefore also on the entire real line \( \BbbR \).
\end{proof}

\begin{example}\label{thm:weierstrass_series_criterion/counterexample}\mcite[\textnumero 266]{Фихтенгольц1968Том2}
  Consider the real series
  \begin{equation*}
    f(x) \coloneqq \sum_{k=0}^\infty x^k (1 - x).
  \end{equation*}

  It converges for \( \abs{x} < 1 \) because it is dominated by a convergent geometric series.

  For \( x \in (0, 1) \),
  \begin{equation*}
    f(x)
    =
    \sum_{k=0}^\infty x^k (1 - x)
    =
    \sum_{k=0}^\infty x^k - \sum_{k=1}^\infty x^k
    =
    1.
  \end{equation*}

  But
  \begin{equation*}
    \lim_{t \uparrow 1} f(x) = 1 \neq 0 = f(1) = f(\lim_{t \uparrow 1} t).
  \end{equation*}

  This shows that \( f(x) \) is not continuous, despite every term being continuous.

  By contraposition to \fullref{thm:weierstrass_series_criterion}, it follows that no series that dominates \( f(x) \) converges.
\end{example}

\begin{theorem}\label{thm:uniform_limit_exchange}\mcite[\textnumero 268]{Фихтенгольц1968Том2}
  Fix a uniform space \( (A, \mscrU) \) and let \( S \subseteq A \). Let \( f_k: S \to X, k = 0, 1, \ldots \) be a sequence of functions and assume that \( x_0 \in M \) is a limit point of each of these functions.

  \begin{thmenum}
    \thmitem{thm:uniform_limit_exchange/sequence} If the sequence \( \{ f_k \}_{k=0}^\infty \) converges uniformly on \( S \), we can exchange the limits
    \begin{equation*}
      \lim_{x \to x_0} \lim_{k \to \infty} f_k(x)
      =
      \lim_{k \to \infty} \lim_{x \to x_0} f_k(x).
    \end{equation*}

    \thmitem{thm:uniform_limit_exchange/series} If the series \fullref{thm:cauchy_series_continuity_criterion/function} converges uniformly on \( S \), we can exchange the limits
    \begin{equation*}
      \lim_{x \to x_0} \sum_{k=0}^\infty f_k(x)
      =
      \sum_{k=0}^\infty \lim_{x \to x_0} f_k(x).
    \end{equation*}
  \end{thmenum}
\end{theorem}

\begin{remark}\label{rem:thm:uniform_limit_exchange_continuity}
  If the functions \( f_k \) in \fullref{thm:uniform_limit_exchange/series} are continuous at \( x_0 \), we have the additional equality
  \begin{equation}\label{thm:uniform_limit_exchange/continuous_equality}
    \lim_{x \to x_0} f(x)
    =
    \lim_{x \to x_0} \sum_{k=0}^\infty f_k(x)
    =
    \sum_{k=0}^\infty \lim_{x \to x_0} f_k(x)
    \reloset * =
    \sum_{k=0}^\infty f_k\left(\lim_{x \to x_0} x \right)
    =
    f\left(\lim_{x \to x_0} x \right),
  \end{equation}
  thus \( f \) is continuous at \( x_0 \). The continuity actually follows from \fullref{thm:cauchy_series_continuity_criterion} directly.
\end{remark}

\begin{corollary}\label{thm:riemann_intergral_limit_exchange}\mcite[\textnumero 269]{Фихтенгольц1968Том2}
  Let \( \{ f_k \}_{k=0}^\infty \subseteq C([a, b], \BbbR) \).

  \begin{thmenum}
    \thmitem{thm:riemann_intergral_limit_exchange/sequence} If the sequence \( \{ f_k \}_{k=0}^\infty \) converges uniformly, then
    \begin{equation*}
      \lim_{k \to \infty} \int_a^b f_k(x) dx = \int_a^b \lim_{k \to \infty} f_k(x) dx.
    \end{equation*}

    \thmitem{thm:riemann_intergral_limit_exchange/series} If the series \fullref{thm:cauchy_series_continuity_criterion/function} converges uniformly, then
    \begin{equation*}
      \int_a^b f(x) dx = \int_a^b \sum_{k=0}^\infty f_k(x) dx = \sum_{k=0}^\infty \int_a^b f_k(x) dx.
    \end{equation*}
  \end{thmenum}
\end{corollary}
\begin{proof}
  \SubProofOf{thm:riemann_intergral_limit_exchange/sequence} Assume that the sequence \( \{ f_k \}_{k=0}^\infty \) converges uniformly to \( f \). Then by \fullref{thm:uniform_limit_exchange}, we note that for any index \( k \), the difference \( r_k(x) \coloneqq f(x) - f_k(x) \) is continuous, hence integrable, and
  \begin{equation*}
    \int_a^b f(x) dx = \int_a^b f_k(x) dx + \int_a^b r_k(x) dx.
  \end{equation*}

  Because of the uniform convergence, for any \( \delta > 0 \) and there exist an index \( k_0 \) such that
  \begin{equation*}
    \abs{f(x) - f_k(x)} = \abs{r_k(x)} < \delta \quad\forall k \geq k_0, \forall x \in [a, b].
  \end{equation*}

  Then
  \begin{equation*}
    \abs{\int_a^b f(x) dx - \int_a^b f_k(x) dx} = \abs{\int_a^b r_k(x) dx} < (b - a) \delta.
  \end{equation*}

  Given \( \varepsilon > 0 \), we define \( \delta \coloneqq \frac \varepsilon {b - a} \) to obtain an index \( k_0 \) such that
  \begin{equation*}
    \abs{\int_a^b f(x) dx - \int_a^b f_k(x) dx} = \abs{\int_a^b r_k(x) dx} < \varepsilon \quad\forall k \geq k_0.
  \end{equation*}

  Thus, \fullref{def:net_convergence/limit} is satisfied and equality holds.

  \SubProofOf{thm:riemann_intergral_limit_exchange/series} This is a special case of \fullref{thm:riemann_intergral_limit_exchange/sequence}.
\end{proof}

\begin{corollary}\label{thm:derivative_limit_exchange}\mcite[thm. 7.17]{Rudin1976Principles}
  Let \( \{ f_k \}_{k=0}^\infty \subseteq C^1([a, b], \BbbR) \). Suppose that the series \fullref{thm:cauchy_series_continuity_criterion/function} converges for at least one point \( x_0 \in [a, b] \).

  \begin{thmenum}
    \thmitem{thm:derivative_limit_exchange/sequence} If the sequence \( \{ D f_k \}_{k=0}^\infty \) of derivatives converges uniformly, then \( \{ f_k \}_{k=0}^\infty \) also converges uniformly, its limit is differentiable in \( (a, b) \) and
    \begin{equation*}
      D\left(\lim_{k \to \infty} f_k(x) \right) = \lim_{k \to \infty} D f_k(x).
    \end{equation*}

    \thmitem{thm:derivative_limit_exchange/series} If the series of derivatives
    \begin{equation}\label{thm:derivative_limit_exchange/derivative_series}
      \sum_{k=0}^\infty D f_k(x)
    \end{equation}
    converges uniformly, then \fullref{thm:cauchy_series_continuity_criterion/function} converges uniformly, is differentiable in \( (a, b) \) and
    \begin{equation*}
      D\left(\sum_{k=0}^\infty f_k(x)\right) = \sum_{k=0}^\infty D f_k(x).
    \end{equation*}
  \end{thmenum}
\end{corollary}
\begin{proof}
  \SubProofOf{thm:derivative_limit_exchange/sequence} Fix \( \varepsilon > 0 \). Since the sequence \( \{ f_k \}_{k=0}^\infty \) converges for \( x_0 \), there exists an index \( k_0 \) such that
  \todo{Prove complex case}
  \begin{equation*}
    \abs{f_m(x_0) - f_n(x_0)} < \varepsilon \quad\forall m, n \geq k_0.
  \end{equation*}

  Furthermore, there exists an index \( k_1 \) such that
  \begin{equation*}
    \abs{D f_m(x) - D f_n(x)} < \varepsilon \quad\forall x \in [a, b] \ \forall m, n \geq k_0.
  \end{equation*}

  Fix \( m, n \geq k_0 \) and \( x \in [a, b] \). Note that the function \( f_m - f_n \) is differentiable and thus by the mean value theorem, there exists \( \xi \) between \( x_0 \) and \( x \) such that
  \begin{equation*}
    \frac {[f_m(x) - f_n(x)] - [f_m(x_0) - f_n(x_0)]} {x - x_0} = D f_m(\xi) - D f_n(\xi).
  \end{equation*}

  Thus,
  \begin{balign*}
    \abs{f_m(x) - f_n(x)}
     & \leq
    \abs{f_m(x_0) - f_n(x_0)} + (x - x_0)\abs{D f_m(\xi) - D f_n(\xi)}
    <       \\ &<
    2 (x - x_0) \varepsilon
    \leq    \\ &\leq
    2 (b - a) \varepsilon.
  \end{balign*}

  Therefore, the limit \( \lim_{k\to\infty} f_k(x) \) exists. Since \( x \) was arbitrary and \( 2 (b - a) \varepsilon \) does not depend on \( x \), we conclude that
  \begin{equation*}
    f(x) \coloneqq \lim_{k\to\infty} f_k(x)
  \end{equation*}
  is uniformly convergent on \( [a, b] \).

  By the Newton-Leibniz theorem, for the sequence \( \{ D f_k \}_{k=0}^\infty \) of derivatives we have
  \begin{equation*}
    \lim_{k \to \infty} \int_a^x D f_k(t) dt
    =
    \lim_{k \to \infty} [f_k(x) - f_k(a)]
    =
    \lim_{k \to \infty} f_k(x) - \lim_{k \to \infty} f_k(a)
    =
    f(x) - f(a).
  \end{equation*}

  Differentiating both sides, we obtain
  \begin{equation*}
    D\left(\lim_{k \to \infty} \int_a^x D f_k(t) dt \right)
    =
    D\left(\lim_{k \to \infty} f_k(x) dt \right)
    =
    D f(x).
  \end{equation*}

  \Fullref{thm:riemann_intergral_limit_exchange/sequence} allows us to conclude that
  \begin{equation*}
    D f(x)
    =
    D\left(\lim_{k \to \infty} \int_a^x D f_k(t) dt \right)
    =
    D \int_a^x \lim_{k \to \infty} D f_k(t) dt
    =
    \lim_{k \to \infty} D f_k(x).
  \end{equation*}

  \SubProofOf{thm:derivative_limit_exchange/series} This is a special case of \fullref{thm:riemann_intergral_limit_exchange/sequence}.
\end{proof}

\begin{example}\label{ex:harmonic_series}
  We list several important series related to \hyperref[def:harmonic_progression]{harmonic progressions}.

  \begin{thmenum}
    \thmitem{ex:harmonic_series/harmonic} The series
    \begin{equation}\label{eq:ex:harmonic_series/harmonic}
      \sum_{k=1}^\infty \frac 1 k = 1 + \frac 1 2 + \frac 1 3 + \frac 1 4 + \cdots
    \end{equation}
    is called \hi{the} \term{harmonic series}. It diverges as shown in \fullref{thm:harmonic_series_diverges}, which make it much less useful in practice, however it is an important enough example that it has a dedicated name.

    \thmitem{ex:harmonic_series/alternating} The series
    \begin{equation}\label{eq:ex:harmonic_series/alternating}
      \sum_{k=1}^\infty \frac {(-1)^k} k
      =
      \sum_{m=1}^\infty \parens*{ \frac 1 {2m - 1} - \frac 1 {2m} }
      =
      1 - \frac 1 2 + \frac 1 3 - \frac 1 4 + \cdots
    \end{equation}
    is called the \term{alternating harmonic series}. It converges, but not absolutely --- \fullref{thm:alternating_harmonic_series_convergence}.

    \thmitem{ex:harmonic_series/hyperharmonic} For any \( s \in \BbbC \), the series
    \begin{equation}\label{eq:ex:harmonic_series/hyperharmonic}
      \sum_{k=1}^\infty \frac 1 {k^s}.
    \end{equation}
    is called the \term{hyperharmonic series}.

    Unlike the harmonic series, the hyperharmonic series sometimes converges --- see \fullref{thm:hyperharmonic_series_convergence}.
  \end{thmenum}
\end{example}

\begin{proposition}\label{thm:harmonic_series_diverges}
  The harmonic series \eqref{eq:ex:harmonic_series/harmonic} diverges.
\end{proposition}
\begin{proof}
  Define the series
  \begin{equation*}
    1 + \frac 1 2 + \underbrace{\frac 1 4 + \frac 1 4}_{\sfrac 1 2} + \underbrace{\frac 1 8 + \frac 1 8 + \frac 1 8 + \frac 1 8}_{\sfrac 1 2} + \underbrace{\frac 1 {16} + \cdots + \frac 1 {16}}_{\sfrac 1 2} + \cdots
  \end{equation*}

  It is divergent as the sum of infinitely many \( \sfrac 1 2 \). Furthermore, it is dominated by the harmonic series:
  \begin{align*}
    &1 + \frac 1 2 + \frac 1 3 + \frac 1 4 + \frac 1 5 + \frac 1 6 + \frac 1 7 + \frac 1 8 + \frac 1 9 \thinspace + \cdots + \frac 1 {16} + \cdots
    \\
    &1 + \frac 1 2 + \overbrace{ \frac 1 4 + \frac 1 4 }^{\sfrac 1 2} + \overbrace{ \frac 1 8 + \frac 1 8 + \frac 1 8 + \frac 1 8 }^{\sfrac 1 2} + \overbrace{ \frac 1 {16} + \cdots + \frac 1 {16} }^{\sfrac 1 2} + \cdots
  \end{align*}

  Thus, by \fullref{thm:positive_series_comparison}, the harmonic series also diverges.
\end{proof}

\begin{proposition}\label{thm:alternating_harmonic_series_convergence}\cite[\textnumero 247]{Фихтенгольц1968Том2}
  Consider the alternating harmonic series \eqref{eq:ex:harmonic_series/alternating}.

  Compare the series with \eqref{eq:ex:harmonic_series/harmonic}. Note that, by \fullref{thm:leibniz_alternating_series_test}, the series is convergent. It is not absolutely convergent, because the harmonic series \eqref{eq:ex:harmonic_series/harmonic} is divergent.
\end{proposition}

\begin{proposition}\label{thm:hyperharmonic_series_convergence}
  The hyperharmonic series \eqref{ex:harmonic_series/hyperharmonic} converges all \( s \in \BbbC \) with \( \real(s) > 1 \).
\end{proposition}
\begin{proof}
  Let \( s = (1 + \varepsilon) + bi \). We use the integral test on the series \( \sum_{k=1}^\infty \abs{k}^{-s} \):
  \begin{equation*}
    \int_1^\infty \frac 1 {\abs{x^s}} \dl x
    =
    \int_1^\infty \frac 1 {x^{1 + \varepsilon} \underbrace{\abs{x^{bi}}}_{1}} \dl x
    =
    -\frac 1 {\varepsilon x^\varepsilon}\Big\restr_{x=1}^\infty
    =
    \frac 1 \varepsilon \lim_{x \to \infty} \parens*{ 1 - \frac 1 {x^\varepsilon} }
    =
    \frac 1 \varepsilon.
  \end{equation*}

  The integral is finite, hence the hyperharmonic series is absolutely convergent.
\end{proof}


%&LaTeX

\section{The Z-Transform and Convolution}

This lab covers the z-transform, used to convert arbitrary digital
signals to the frequency domain. It also exercises the relationship
between a filter's transfer function and impulse response and how the
operations of multiplication and convolution, respectively, can be
used to compute a filter's output.

\subsection{The z-transform, Transfer Function, \& Impulse Response}

A discrete signal $x[n]$ has a z-transform $X(z)$ defined by the
following equation:
\[
X(z)=\sum_{n=0}^{\infty}x[n]z^{-n}
\]
With this definition lets investigate a feed forward filter with ten
coefficients, $\{b_0, b_1,\cdots, b_9\}$.  Recall that the
\block{Filter} and \block{Coeff.} blocks of J-DSP allow us to specify
a filter in terms of its \emph{coefficients}, but we can also define
it in terms of its \emph{transfer function}. Considering the $b_k$
coefficients of the feed forward filter, the \block{Filter} block
implements the transfer function:
\begin{equation}
  H(z) = \sum_{k=0}^{9} b_k z^{-k}
\end{equation}
In previous labs we have computed the transfer function using the
delays of the \emph{defining function}.  Mathematically, we were
actually taking the z-transform of the \emph{impulse response}!  In
this example, the impulse response is:
\begin{equation}
  h[n] = \sum_{k=0}^{9} b_k \delta[k]
\end{equation}
where $\delta[k]$ is the unit impulse and only has value at
$k$. $H(z)$ and $h[n]$ form a z-transform pair,
$h[n]\xleftrightarrow{z} H(z)$. It should now be obvious why
feedforward filters are also known as finite impulse response filters
-- their impulse response only has a \emph{finite} number of
values. To compute the output, $y[n]$, using the impulse response we
use \emph{convolution}. Namely, we \emph{convolve} the input, $x[n]$,
by the impulse response, $h[n]$,
\begin{equation}
  y[n] = x[n] \ast h[n]  = \sum_{k=0}^{9}x[k]h[n-k]
\end{equation}
Alternatively, we can compute a filter's output by multiplying the
transfer function by the z-transform of the input to yield the
z-transform of the output:
\begin{equation}
  Y(z) = H(z) X(z)
\end{equation}
From a practical point of view, of course, it makes more sense to
implement a filter in terms of its impulse response. However, for
filters with long impulse responses, it is sometimes more convenient
to represent them mathematically using the transfer function (which we
now know is just the z-transform of the impulse response!).  So, in
effect, the J-DSP blocks allow us to invert the z-transform of various
signals.

\subsection{Z-Transforms}

\paragraph{Step 1.1} On paper, compute the z-transform, $X(z)$, of
	\begin{equation}
		x[n] = \left\{
		\begin{array}{ll}
			(-1)^n & n \ge 0 \\
			0 & n < 0
		\end{array}\right.
	\end{equation}
	Note that this is an infinite geometric series.
	% Hand in hard copy of your work.
	What are the locations of any pole(s) (roots of the denominator
	polynomial) or zero(s) (roots of the numerator polynomial)?

\paragraph{Step 1.2} Evaluate the frequency response of $X(z)$ from
	step~1.1, $X(z)\big{|}_{z=e^{j\hat{\omega}}}$.
	% Hand in hard copy of your work.
	What kind of filter is this?

\paragraph{Step 1.3} Consider the z-transform:
	\begin{equation}
	  X(z) = 1 - 2z^{-1} + 3z^{-3} - z^{-5}
	\end{equation}
	Write the inverse z-transform, $x[n]$, as a table of values for
	corresponding $n$ values.

\subsection{Impulse Response}

\paragraph{Step 2.1} Consider a filter with a transfer function
	\begin{equation}
	H(z) = 1 + 5z^{-1} - 3z^{-2} + 2.5z^{-3} + 4z^{-8}
	\end{equation}
	What is the defining equation for this filter, $y[n] = F(x[n])$?

\paragraph{Step 2.2} What is the output sequence of the filter of
	Step~2.1 when the input is $x[n] = \delta[n]$?

\paragraph{Step 2.3} The impulse response of a filter is $h[n] = x[n]
	+ 2x[n-1] + x[n-2] - x[n-3]$, or equivalently, $h[n]=\{1,2,1,-1\}$,
	$n=\{0, 1, 2, 3\}$. Determine the response of the system to the input
	signal $x[n]=\{1,2,3,1\}$, $n=\{0, 1,2,3\}$. Use J-DSP to check your
	results. Include an image of the J-DSP block diagram with plots of the
	\block{Sig Gen} signal and the filter output in your report.  Note
	that the \block{Sig Gen} block has a \emph{user-defined}
	\option{signal} option; use \button{reset} to reset all the signal
	values to zero before entering your own. Additionally, you can view
	the values in the \block{Plot} block.

\paragraph{Step 2.4} Change the input to the filter of Step~2.3 to be
	$\delta[n]$, using the \option{signal} set to ``Delta''. What are the
	output values? How do they compare to the impulse response? Include a
	plot of the filter output values in your report.

\begin{figure}[t]
   \centering
   	\includegraphics[width=4in]{lab6/threeinputproblem}
   \caption{An example diagram for use in problem 2.5}
   \label{fg:threeinput}
\end{figure}

\paragraph{Step 2.5} Use J-DSP to determine the output of the filter \{1/3,1/3,1/3\}, $n=\{0,1,2\}$ for the
	input:
	\begin{equation}
	  x[n] = 4 + \sin[0.25\pi(n-1)] - 3 \sin[(2\pi/3)n]
	\end{equation}
	An example diagram can be seen in Figure \ref{fg:threeinput}. Include an image
	of the J-DSP block diagram with plots of the filter
	input and output in your report. Is the result expected? Why or why
	not?

\paragraph{Step 2.6} Create your own \block{UserDefinedFun} block to implement convolution in J-DSP.
	To test your function, make sure it works exactly like the \block{Filter} block in J-DSP.
	Use the diagram in Figure \ref{fg:userdefined} to plot the difference between your function output and the \block{Filter} block output.
	Use the filter \{1/3,1/3,1/3\}, $n=\{0,1,2\}$ from step 2.5.
	Note: refer to section \ref{sec:example} for how to use the \block{UserDefinedFun} block in J-DSP.

	\begin{figure}[t]
	    \begin{center}
	        \includegraphics[width=4in]{lab6/userdefinedtest}
	        \caption{A diagram to plot the difference between \block{UserDefinedFun}
	         function output and the \block{Filter} block output for use in step 2.6.}
	         \label{fg:userdefined}
	    \end{center}
	  \end{figure}

\subsection{Canceling Sinusoidal Components}

Filters can be designed to cancel sinusoids.  Construct a filter in
J-DSP with the following impulse response:
\begin{equation}
h[n] = \delta[n] - 2\cos(\pi/4) \delta[n-1] + \delta[n-2]
\end{equation}

\paragraph{Step 3.1} Plot the frequency response for this filter. What
	are the zero locations?

\paragraph{Step 3.2} Use as an input to this filter the signal $x[n] =
	\sin\hat{\omega}n$, using the two frequencies $\hat{\omega} = \pi/2$
	and $\hat{\omega} = \pi/4$. Simulate the filter in J-DSP for each of
	these two inputs. Plot the filter output for each. When do we get
	cancellation?

\paragraph{Step 3.3} Can you modify the filter coefficients to cancel
	the other sinusoid? If so, show your work.

\subsection{Example User Defined J-DSP Function}\label{sec:example}
Open J-DSP and navigate to the \option{Advanced} function set. There
is one block called \block{UserDefinedFun}. Place it now and double
click to open the dialog.  You will see a dialog with example text for
a prototype java class.  In particular the class will look like:
\begin{lstlisting}
public void myCode(double[]x1,double[]x2, double[]y1, double[]y2,
		double[]b1,double[]a1, double[]b2, double[]a2,
		double para1, double para2, double para3)
{
  //                            /\(3)
  //                --------------------
  //           (0)<|                    |>(4)
  //               |      BLOCK         |
  //           (1)<|                    |>(5)
  //                --------------------
  //                            \/(2)

  // x1, x2 - input at pin 0 and pin1
  // y1, y2 - output at pin 4 and pin5
  // b1 - FIR Coefficients of the filter at input pin 2,
  // a1 - IIR Coefficients of the filter at input pin 2
  // b2 - FIR Coefficients of the filter at output pin 3,
  // a2 - IIR Coefficients of the filter at output pin 3

  // Para1, Para2 and Para3 are the variables that could be used
  // in the code and can be controlled from the block Dialog.

  // Paste your code here
  // compile the file
  // upload the .class file
}
\end{lstlisting}
You can copy this code as a prototype and create your own signal
processing algorithms!  For now, you will mainly deal with the $x$ and
$y$ arrays. Each of the arrays is of length 256.  You can access this
like a any regular array in java, {\it x1.length=256}. We also have
access to four variable length arrays, {\it a1 a2 b1 b2} which contain
any filter coefficients as inputs or outputs to the function.

Lets start by creating our own .java file. Copy the example code on
the next page and save it as a .java file using your favorite java
text editor or plain text editor. The example code creates a weighted
sum of the entries in each index of {\it x1}. Namely, it goes through
each value of {\it x1} and uses the {\it b1} filter coefficients to
weight and sum the value into {\it y1}. Save the file as
``MyFunction1.java'' and then compile the file using your favorite
compiler tool for java (javac from the command line works fine for
linux and mac or The Java SE Development Kit 6 (JDK 6) can be used in
windows). This creates ``MyFunction1.class.''

After compiling, remember where you saved the ``MyFunction1.class''
compiled file. You will need to tell J-DSP where the file is
located. Go back to the J-DSP block diagram and press
\button{open}. Navigate to the ``MyFunction1.class'' compiled file and
press \option{open}. That's it! J-DSP will automatically use the
function when you attach inputs and outputs. To test the function we
just made you can connect a \block{SigGen} block to the top left pin
and a \block{Coeff} pin to the bottom as shown on page
\pageref{fg:userdefexample}. You should see a weighted sum of the
input when you plot the output. You should be able to change the
output by changing the weighting coefficients from \block{Coeff}. In
the example on page \pageref{fg:userdefexample} we are taking a
weighted sum (using the weights in {\it b1}) of each coefficient in
{\it x1} three times.  You are now ready to start developing your own
functions in J-DSP!

\begin{lstlisting}
public class MyFunction1
{
  public void myCode(double[]x1,double[]x2, double[]y1, double[]y2,
      double[]b1,double[]a1, double[]b2, double[]a2,
      double para1, double para2, double para3)
  {
    //                            /\(3)
    //                --------------------
    //           (0)<|                    |>(4)
    //               |      BLOCK         |
    //           (1)<|                    |>(5)
    //                --------------------
    //                            \/(2)

    // x1, x2 - input at pin 0 and pin1
    // y1, y2 - output at pin 4 and pin5
    // b1 - FIR Coefficients of the filter at input pin 2,
    // a1 - IIR Coefficients of the filter at input pin 2
    // b2 - FIR Coefficients of the filter at output pin 3,
    // a2 - IIR Coefficients of the filter at output pin 3

    // Para1, Para2 and Para3 are the variables that could be used
    // in the code and can be controlled from the block Dialog.

    for( int i = 0 ; i < 256 ; i++)
    {
      y2[i] = 0;
      for(int j=0 ; j < b1.length ; j++)
      {
        y2[i] += x1[i]*b1[j];
      }

    }
    // Paste your code here
    // compile the file
    // upload the .class file
  }
}
\end{lstlisting}

 \begin{figure}[h]
    \begin{center}
        \includegraphics[width=6in]{lab6/function1examplewithplot}
        \caption{The result of using the weighted sum example code in J-DSP.}
    \end{center}
    \label{fg:userdefexample}
  \end{figure}

\subsection{Bonus: More $z$-Transforms and Convolutions}

The following properties of the $z$-transform may be useful here:

\begin{center}
\begin{tabular}{|l|c|c|} \hline
Property      & Time Domain, $Z^{-1}\{\cdot\}$ & z-Domain, $Z\{\cdot\}$ \\ \hline\hline
Linearity     & $a_1x[n]+a_2y[n]$ & $a_1X(z)+a_2Y(z)$\\
Time shift    & $x[n-k]$       & $z^{-k}X(z)$\\
Scaling in the z-domain
              & $a^nx[n]$        & $X(a^{-1}z)$ \\
Time reversal & $x[-n]$        & $X(z^{-1})$\\
Differentiation in the z-domain
              & $nx[n]$          & $-z \deriv{X(z)}{z}$ \\
Convolution   & $x[n] \ast y[n]$       & $X(z)Y(z)$ \\ \hline
\end{tabular}
\end{center}

\paragraph{$z$-Transform of arbitrary sequences}
Give the $z$-transform of the following sequences, $x[n]$ (assume
$x[n]=0$ for all $n$ not stated):
\begin{enumerate}
\item $x[n]=\{2, 4, 6, 4, 2\}$, $n = \{0, 1, 2, 3, 4\}$

\item $x[n] = \delta[n]$

\item $x[n] = \delta[n-1]$

\item $x[n] = 2\delta[n] - 3\delta[n-1] +4\delta[n-3]$

\item $x[n] = 2\delta[n] + 4\delta[n-1] + 6\delta[n-2] + 4\delta[n-3] + 2\delta[n-4]$
\end{enumerate}

\paragraph{Inverse $z$-transforms}
Give the inverse $z$-transform of $H(z) = 1 + 5z^{-1} - 3z^{-2} +
2.5z^{-3} +4z^{-8}$.

\paragraph{Transfer function \& impulse response}
Give the transfer function and impulse response for a filter with
zeros at $(r, \hat{\omega}) = \{(1, 0), (1, \pm \pi/2), (0.9, \pm
\pi/3)\}$.

% LocalWords:  WebQ MATLAB DSP


\subsection{Doubly Periodic Functions}
\begin{definition}
    A meromorphic function $f$ on $\mathbb C$ whose period contains $\langle\omega_1\rangle\oplus\langle\omega_2\rangle\cong\mathbb Z^2$ is said to be doubly periodic or elliptic.
\end{definition}
In this case, $\Omega$ is a lattice $\Lambda$, so $f$ depends on a meromorphic function on $\mathbb C/\Lambda$.
\begin{proposition}
    If $f$ is a meromorphic function on $\mathbb C$ and the periods of $f$ contain a lattice $\Lambda$, then there is a unique meromorphic function $\bar{f}$ on the complex torus $\mathbb C/\Lambda$ such that $f(z)=\bar{f}\circ\pi(z)$ where $\pi:\mathbb C\to\mathbb C/\Lambda$ is the quotient map.
\end{proposition}
\begin{proof}
    Same as Proposition \ref{simply_periodic} by observing that $\pi$, as a covering map, admits a local analytic inverse.
\end{proof}
So the elliptic functions on $\mathbb C$ with $\Lambda\subset\Omega$ corresponds to meromorphic functions on $\mathbb C/\Lambda$.
This means that we can apply our study in compact Riemann surfaces in doubly periodic functions.
\begin{corollary}
    There is no doubly periodic analytic functions on $\mathbb C$ other than constant maps.
\end{corollary}
\begin{proof}
    Immediate.
\end{proof}
Also, since we can view a doubly periodic function $f$ as an analytic maps $\bar{f}$ in the compact surface $\mathbb C/\Lambda$, we can make sense of its degree by writing $\deg f=\deg\bar{f}$.
\begin{corollary}\label{degree_doubly_periodic}
    If $f:\mathbb C\to\mathbb C_\infty$ is doubly periodic and non-constant, then $\deg f\ge 2$.
\end{corollary}
\begin{proof}
    If $\deg f=1$, then $f$ is unramified so Riemann-Hurwitz gives $0=1(-2)+0=-2$, contradiction.
\end{proof}
For a lattice $\Lambda=\langle\omega_1,\omega_2\rangle$, we construct the period parallelogram as the parallogram $P$ with vertices $z_0,z_0+\omega_1,z_0+\omega_2,z_0+\omega_1\omega_2$ for some fixed $z_0\in\mathbb C$ (usually $0$).
So $f$ is determined by its value on $P$.
\begin{proof}[Alternative proof of Corollary \ref{degree_doubly_periodic}]
    Choose $z_0$ so that no zeros nor poles of $f$ lie on $\partial P$, which is possible as $\mathbb C/\Lambda$ is compact.
    The residue theorem gives
    $$\sum_{z\text{ pole in }P}\operatorname{res}_z(f)=\frac{1}{2\pi i}\int_{\partial P}f(z)\,\mathrm dz=0$$
    by the periodicity of $f$.
    Hence either $f$ is no pole, which means $f$ is constant, or $f$ has at least two poles (counted with multiplicity), so $\deg f\ge 2$.
\end{proof}


\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath, amssymb}
\usepackage{cancel}
\usepackage[nodayofweek]{datetime}

% Set size of text area with total parameter
\usepackage[a4paper, total={155mm, 255mm}]{geometry}

\title{Proving The Power Rule}
\author{Dyson}
\date{\today}

\newcommand{\deriv}{\dfrac{\text{d}}{\text{d}x}}

\begin{document}

\maketitle

% Set paragraph spacing here to avoid messing with title
\setlength{\parindent}{0em}
\setlength{\parskip}{1em}

\section{The Conjecture}

The power rule states that for all $\displaystyle n \in \mathbb{Z}, \deriv x^n = nx^{n - 1}$. We want to prove this from first principles.

\section{The Proof}

\subsection{For The Naturals}

Proving the power rule for $n \in \mathbb{N}, 0 \notin \mathbb{N}$ is relatively easy and just involves some simple binomial expansion.\\

Let $f(x) = x^n$.

We know that the derivate $f'(x)$ of $f(x)$ is defined as $$f'(x) = \lim_{h \to 0} \left( \frac{f(x + h) - f(x)}{h} \right)$$

If we plug in our $f(x) = x^n$, then we get $$f'(x) = \lim_{h \to 0} \left( \frac{(x + h)^n - x^n}{h} \right)$$

We need to cancel the $h$ before we let it go to 0. We can do this by expanding the binomial $(x + h)^n$ in the numerator like so: $$(x + h)^n = x^n + nx^{n - 1}h + \binom{n}{2}x^{n - 2}h^2 + \cdots + nxh^{n - 1} + h^n$$

We now have an $x^n$ term and a $-x^n$ term in the numerator. These cancel to give us $$\lim_{h \to 0} \left( \frac{nx^{n - 1}h + \binom{n}{2}x^{n - 2}h^2 + \cdots + nxh^{n - 1} + h^n}{h} \right)$$

We can then factor out $h$ from the numerator and cancel like so: $$\lim_{h \to 0} \left( \frac{\cancel{h} \left( nx^{n - 1} + \binom{n}{2}x^{n - 2}h + \cdots + nxh^{n - 2} + h^{n - 1} \right)}{\cancel{h}} \right)$$
$$=\lim_{h \to 0} \left(nx^{n - 1} + \binom{n}{2}x^{n - 2}h + \cdots + nxh^{n - 2} + h^{n - 1} \right)$$

We can now let $h$ go to 0 and thereby show that $f'(x) = nx^{n - 1}$

\hspace*{\fill}$\square$

\subsection{For All Integers}

Proving the power rule for all $n \in \mathbb{Z}$ is a bit more complicated.

We know that the power rule would say $$\deriv x^0 = 0x^{-1} = 0$$ We also know that $x^0$ is always 1, and the derivative of a constant is always 0, so the power rule holds for $n = 0$.

To prove it for negative integers, I'm going to prove that $$\deriv x^{-n} = -nx^{-n-1}, n \in \mathbb{N}$$ because this is easier to prove and will expand the proof to all integers.\\

Let $f(x) = x^{-n}$.

We plug this $f(x)$ into the definition and get $$f'(x) = \lim_{h \to 0}\left( \frac{(x + h)^{-n} - x^{-n}}{h} \right)$$

If it's possible to expand binomials with negative powers, I don't know how to do it, but I do know that $a^{-b} = \dfrac{1}{a^b}$, so we'll use that and focus on the numerator for now.

\begin{gather*}
(x + h)^{-n} - x^{-n} = \frac{1}{(x + h)^n} - \frac{1}{x^n}\\[0.5em]
= \frac{x^n}{x^n(x + h)^n} - \frac{(x + h)^n}{x^n(x + h)^n}\\[0.5em]
= \frac{x^n - (x + h)^n}{x^n(x + h)^n}
\end{gather*}

We're going to expand and simplify the numerator, so for the sake of simplicity, I'm leaving the denominator unexpanded for now.

\begin{gather*}
\frac{x^n - (x^n + nx^{n - 1}h + \binom{n}{2}x^{n - 2}h^2 + \cdots + nxh^{n - 1} + h^n)}{x^n(x + h)^n}\\[0.5em]
= \frac{-nx^{n - 1}h - \binom{n}{2}x^{n - 2}h^2 - \cdots - nxh^{n - 1} - h^n}{x^n(x + h)^n}
\end{gather*}

Now, we're going to re-introduce $h$ before expanding the denominator.

Dividing a fraction by $h$ is the same as just multiplying the denominator by $h$.

\begin{gather*}
\frac{-nx^{n - 1}h - \binom{n}{2}x^{n - 2}h^2 - \cdots - nxh^{n - 1} - h^n}{x^n(x + h)^n} \div h\\[0.5em]
= \frac{-nx^{n - 1}h - \binom{n}{2}x^{n - 2}h^2 - \cdots - nxh^{n - 1} - h^n}{hx^n(x + h)^n}
\end{gather*}

We can factor a $h$ out from the numerator and get $$\frac{h(-nx^{n - 1} - \binom{n}{2}x^{n - 2}h - \cdots - nxh^{n - 2} - h^{n - 1})}{hx^n(x + h)^n}$$

We can now cancel the $h$ and expand the denominator.

\begin{gather*}
\frac{-nx^{n - 1} - \binom{n}{2}x^{n - 2}h - \cdots - nxh^{n - 2} - h^{n - 1}}{x^n(x^n + nx^{n - 1}h + \binom{n}{2}x^{n - 2}h^2 + \cdots + nxh^{n - 1} + h^n)}\\[0.5em]
= \frac{-nx^{n - 1} - \binom{n}{2}x^{n - 2}h - \cdots - nxh^{n - 2} - h^{n - 1}}{x^{2n} + nx^{2n - 1}h + \binom{n}{2}x^{2n - 2}h^2 + \cdots + nx^{n + 1}h^{n - 1} + x^nh^n}
\end{gather*}

Now, we let $h$ go to 0 to get rid of all the $h$ terms and get left with $$\dfrac{-nx^{n - 1}}{x^{2n}}$$

Because $\dfrac{1}{x^{2n}} = x^{-2n}$, we can rewrite this as $$-nx^{n - 1}x^{-2n} = -nx^{n - 1 - 2n} = -nx^{-n - 1}$$

\hspace*{\fill}$\square$

The proof for negative integers is a bit longer and more involved. There's probably a much more elegant proof, but I'm pretty sure this one works, and I'm happy with it.

Thus, I have proved that for all $n \in \mathbb{Z}$, $\deriv x^n = nx^{n - 1}$.

\end{document}


\chapter{Combination of Events}

\section{Important/Useful Theorems}

\subsection{}
If $A_1 \subset A_2$ then $\bar{A_1} \supset \bar{A_2}$

\subsection{}
If $A = A_1 \cup A_2$ then $\bar{A} = \bar{A_1} \cap \bar{A_2}$

\subsection{}
If $A = A_1 \cap A_2$ then $\bar{A} = \bar{A_1} \cup \bar{A_2}$

\subsection{}
$0\leq P(A) \leq 1$

\subsection{}
$P(A_1 \cup A_2) = P(A_1) + P(A_2) - P(A_1 \cap A_2 )$

\subsection{}

$P(A_1) \leq P(A_2)$ if $A_1 \subset A_2$

\subsection{}
Given any $n$ events $A_1, A_2, ... A_n$, let
\begin{equation}
	P_1 = \sum_{i=1}^{n} P(A_i)
\end{equation}
\begin{equation}
	P_2 = \sum_{1 \leq i < j \leq n} P(A_iA_j)
\end{equation}
\begin{equation}
	P_3 = \sum_{1 \leq i < j < k \leq n} P(A_i A_j A_k)
\end{equation}
etc. for integers up to $n$.  Then
\begin{equation}
	P\left(\bigcup_{k=1}^n A_k \right) = P_1 -P_2 + P_3 + ... \pm P_n
\end{equation}

\subsection{}
If $A_1, A_2, ...$ is an increasing sequence of events such that $A_1 \subset A_2 \subset ...$
\begin{equation}
	P\left(\bigcup_{k=1}^n A_k \right) = \lim_{n \rightarrow \infty} P(A_n)
\end{equation}

\subsection{}
If $A_1, A_2, ...$ is an decreasing sequence of events such that $A_1 \supset A_2 \supset ...$
\begin{equation}
	P\left(\bigcap_{k=1}^n A_k \right) = \lim_{n \rightarrow \infty} P(A_n)
\end{equation}

\subsection{}
For any collection of arbitrary events
\begin{equation}
	P\left(\bigcup_{k} A_k \right) \leq \sum_k P(A_k)
\end{equation}

\subsection{}
For any sequence of events $A_1, A_2, ...$ with porbabilities $P(A_k)=p_k$
\begin{equation}
	\sum_k p_k < \infty
\end{equation}

\section{Answers to Problems}

%%answer template
%\subsection{}
%%problem n.n
%
%
%\begin{equation}
%
%\label{answern.n}
%\end{equation}
%\textbf{Answer [not] verified}

\subsection{}
%problem 2.1
\subsubsection{a--$AB=A$}
$AB=A$ is shorthand for $A\cap B=A$ or, in English, that the intersection of the events $A$ and $B$ is equivalent to the event $A$.  Clearly, this means that $A$ is equivalent to $B$ such that their overlap is complete--wither because they are exactly the same or because all outcomes in B are contained in A
\subsubsection{b--$ABC=A$}

The intersection $A$, $B$ and $C$ is equivalent to A. This implies that both $B$ and $C$ are either the same as $A$ or contained within $A$

\subsubsection{c--$A\cup B\cup C=A$}

The intersection of $A$, $B$ and $C$ is equivalent to $A$.  This statement implies that the overlap of $B$ and $C$ is $A$.

\textbf{Answer not verified}

\subsection{}
%problem 2.2
\subsubsection{a--$A \cup B = \bar{A}$}

The union of $A$ and $B$ is the complement of $A$.  This statement seems to imply that the sum of the events in both $A$ and $B$ are the same as the events NOT in A.  This seeming contradiction can only be true if $A$ as a set contains no events and $B$ contains all events.

\subsubsection{b--$AB=\bar{A}$}

The intersection of $A$ and $B$ is equivalent to the complement of $A$.  This statement implies that the events contained in both $A$ and $B$ are the events NOT in $A$.  Again, this strange statement can be fulfilled if $A$ contains all events and $B$ contains no events

\subsubsection{c--$A \cup B = A \cap B$}

The union of $A$ and $B$ is equal to the intersection of $A$ and $B$.  This statement implies that the sum of all events in $A$ and $B$ is equivalent to the events in both $A$ and $B$.  This can be true, if $A=B$.

\textbf{Answer not verified}

\subsection{}
%problem 2.3
\subsubsection{a--$(A \cup B)(B \cup C)$}

In order to do this problem, we need to develop a distributive law for $\cap$ and $\cup$; we need to figure out what $A \cup (B \cap C)$ and $A \cap (B \cup C)$ is.

$A \cup (B \cap C)$ is the union of A and the intersection of $B$ and $C$ which one can easily imagine is the same as the union of the intersection of the union of $A$ and $B$, and $A$ and $C$.

\begin{equation}
	A \cup (B \cap C) = (A \cup B) \cap (A \cup C)
\end{equation}
similarly, for the second relation
\begin{equation}
	A \cap (B \cup C) = (A \cap B) \cup (A \cap C)
\end{equation}

ALRIGHT  Back to the problem at hand
\begin{equation}
	(A \cup B) \cap (B \cup C)=D
\end{equation}
For bookkeeping purposes, I have defined our expression to equal $D$.  Let's distribute...
\begin{equation}
	(A \cap B) \cup (A \cap C)\cup (B \cap B)\cup (B \cap C)
\end{equation}
clearly the intersection of $B$ and $B$ is just $B$
\begin{equation}
	(A \cap B) \cup (A \cap C)\cup B \cup (B \cap C)
\end{equation}
let's rearrange it to look like what we want to prove (cheap move, I know... but effective!).
\begin{equation}
	(AC\cup B) \cup \left[(A \cap B) \cup (B \cap C)\right]=D
\end{equation}
If we could prove that the term in brackets is equal to $D$ then we would prove that $AC\cup B=D$.  So let's work on that:
\begin{equation}
	(A \cap B) \cup (B \cap C) = E
\end{equation}
Now let's distribute
\begin{equation}
	(A \cup B) \cap (B \cup C) \cap (B \cup B)\cap (A \cup C) = E
\end{equation}
simplify and rearrange
\begin{equation}
	\left[(A \cup B) \cap (B \cup C)\right] \cap B\cap (A \cup C) = E
\end{equation}
we recognize that the term in brackets is equivalent to the original expression we're trying to work with and then distribute one last time
\begin{equation}
	D \cap \left[(B \cap A) (B \cap C)\right] = E
\end{equation}
Now the term in brackets is equal to event $E$ meaning that $D=E$!  So we go back to the first equation.
\begin{equation}
	(AC\cup B) \cup D = D
\end{equation}
\begin{equation}
	(AC\cup B) = D = (A \cup B) \cap (B \cup C)
\end{equation}
$\Box$

\textbf{Answer not verified}

\subsubsection{b--$(A \cup B)(A \cup \bar{B})$}
\begin{equation}
	(A \cup B)\cap (A \cup \bar{B})
\end{equation}
distribute out
\begin{equation}
	(A \cap A)\cup (A \cap \bar{B})\cup (B \cap A)\cup (B \cap \bar{B})
\end{equation}
$A$ will intersect with itself only at itself and $B$ will not intersect with its copmlement.
\begin{equation}
	A\cup (A \cap \bar{B})\cup (B \cap A)\cup 0
\end{equation}
Unionizing the null set with anything else will leave the other things untouched.
\begin{equation}
	A\cup (A \cap \bar{B})\cup (B \cap A)
\end{equation}
Now we rearrange and redistribute.
\begin{equation}
	A\cup \left[  (A \cup A) \cap (A \cup B) \cap (A \cup \bar{B}) \cap (B \cup \bar{B}) \right]
\end{equation}
Clearly the sum of things in $B$ and not in $B$ is everything.
\begin{equation}
	A\cup \left[  A \cap (A \cup B) \cap (A \cup \bar{B}) \cap \Omega \right]
\end{equation}
Clearly the intersection of anything with everything is the same anything
\begin{equation}
	A\cup \left[  A \cap (A \cup B) \cap (A \cup \bar{B}) \right]
\end{equation}
Distribute.
\begin{equation}
	(A\cup A) \cap \left[  A \cup (A \cup B) \right]\cap \left[  A \cup (A \cup \bar{B}) \right]
\end{equation}
\begin{equation}
	A \cap \left[  (A \cup A) \cup B \right]\cap \left[  (A \cup A) \cup \bar{B} \right]
\end{equation}
\begin{equation}
	A \cap \left[  A \cup B \right]\cap \left[ A \cup \bar{B} \right]
\end{equation}
Now we call the original statement of the problem event $C$
\begin{equation}
	A \cap C = C
\end{equation}
Which as we discussed in problem 2.1a, implies that $A=C$.  Therefore:
\begin{equation}
	(A \cup B)(A \cup \bar{B}) = A
\label{answer2.3b}
\end{equation}
$\Box$

\textbf{Answer not verified}

\subsubsection{c--$(A \cup B)(A \cup \bar{B})(\bar{A} \cup B)$}
Start from the identity we just proved
\begin{equation}
	(A \cup B)(A \cup \bar{B})(\bar{A} \cup B) = A \cap (\bar{A} \cup B)
\end{equation}
Distribute
\begin{equation}
	(A \cap \bar{A}) \cup (A \cap B)
\end{equation}
\begin{equation}
	0 \cup AB
\end{equation}
\begin{equation}
	AB
\end{equation}
$\Box$

\textbf{Answer not verified}

\subsection{}
%problem 2.4
Solve for $X$:
\begin{equation}
	\overline{(X \cup A)} \cup \overline{(X \cup \overline{A})} = B
\end{equation}
We negate both sides and use DeMorgan's theorem
\begin{equation}
	(X \cup A) \cap (X \cup \overline{A}) = \overline{B}
\end{equation}
Since we just fought so hard to prove that $(A \cup B)(B \cup C) = AC \cup B$, we want to use it!
\begin{equation}
	(A \cup X) \cap (X \cup \overline{A}) = \overline{B}
\end{equation}
\begin{equation}
	(A \overline{A}) \cup X = \overline{B}
\end{equation}
\begin{equation}
	0 \cup X = \overline{B}
\end{equation}
\begin{equation}
	X = \overline{B}
\end{equation}
$\Box$

\textbf{Answer not verified}

\subsection{}
%problem 2.5

$A$ is the event that at least one of three inspected items is defective and $B$ is the event that all three inspected items are defective.  In this circumstance, the overlap of $A$ and $B$ ($A \cap B$) is equal to $A$ since $A \subset B$.  For similar reasons, the union of those two ($A \cup B$) is simply equal to $B$.

\textbf{Answer not verified}

\subsection{}
%problem 2.6

Since $B$ is the event a number ends in a zero, $\overline{B}$ is the event a number does not end in a zero.  Thus, the overlap of that event and a number being divisible by 5 is the same as saying the event that a number is divisible by 5 and not divisible by 10.

\textbf{Answer not verified}

\subsection{}
%problem 2.7

It is easy to prove to oneself that these events $A_k$ are increasing such that $A_1 \subset A_2 \subset A_3 \subset A_4 \subset ... \subset A_10$ since the radii of the disks are getting bigger.  Therefore, according to theorem 2.3 from the text
\begin{equation}
	B = \bigcup_{k=1}^6 A_k = A_6
\end{equation}
Intuitively, this is clear because we're taking the $A_6$ contains all the lower events so if you take the union of all the lower events then you're just adding parts of $A_6$ to itself.  Now, for
\begin{equation}
	C = \bigcap_{k=5}^{10} A_k
\end{equation}
will clearly be $A_5$ because it's the smallest event and thus automatically sets the intersection to not be able to be any smaller.

\textbf{Answer verified}

\subsection{}
%problem 2.8
Luckily with just a bit of work, we can prove that the two statements are equivalent
\begin{equation}
	P(A) + P(\overline{A}) = 1
\end{equation}
To prove this, we'll use the probability addition theorem for two events which will be $A$ and $\overline{A}$ for us.
\begin{equation}
	P(A \cup B) = P(A) + P(B) - P(A \cap B)
\end{equation}
substitute:
\begin{equation}
	P(A \cup \overline{A}) = P(A) + P(\overline{A}) - P(A \cap \overline{A})
\end{equation}
using the fact that the union of anything with everything else is everything and that the intersection of anything with anything else is nothing...
\begin{equation}
	P(\Omega) = P(A) + P(\overline{A}) - P(0)
\end{equation}
Now we use the fact that the probability of ell events is unity and the probability of no events is nothing.
\begin{equation}
	1 = P(A) + P(\overline{A}) - 0
\end{equation}
$\Box$

\textbf{Answer not verified}

\subsection{}
%problem 2.9

I think this problem is as easy as it sounds since they're very clear to label the probabilities as belonging to the rings and the disk.  Thus, if you draw a picture of the bulls-eye it will become clear that the answer is just $1-.35-.30-.25=.10$ probability of missing.
\textbf{Answer not verified}

\subsection{}
%problem 2.10

Let $A_i$ be the event where $i$ or fewer defective items are found; we're looking, then for the event $B$ that we find at least one defective item:
\begin{equation}
	B = \bigcup_{i=1}^5 A_i
\end{equation}
\begin{equation}
	P(B) = P \left( \bigcup_{i=1}^5 A_i  \right)
\end{equation}
Consequently
\begin{equation}
	P(\overline{B}) = P \left( \bigcup_{i=1}^5 \overline{A_i}  \right)
\end{equation}
Clearly $A_i$ are an increasing series of events so consequently, $\overline{A_i}$ are a decreasing series of events and we can use theorem
\begin{equation}
	P(B) = 1- P(\overline{B}) = 1- P ( \overline{A_5} )
\end{equation}

This is saying the probability of rejecting the batch that has 5 bad items in it is 1 minus the probability of not finding 5 or fewer bad items: or of finding 5 good items.

There are $\binom{100}{5}$ ways to pick 5 items from 100.  With 95 good items, there are $\binom{95}{5}$ ways to pick up 5 good items.
\begin{equation}
	P = 1 - \frac{\binom{95}{5}}{\binom{100}{5}} = 1 - \frac{95!}{5! \cdot 90! } \frac{95! \cdot 5!}{100!} = 1 - \frac{95!}{90! } \frac{95!}{100!}
\end{equation}
\begin{equation}
	P = 1 - \frac{95\cdot 94\cdot 93\cdot 92\cdot 91}{100 \cdot 99\cdot 98\cdot 97\cdot 96} = \frac{2478143}{10755360} = 0.23041
\label{answer2.10}
\end{equation}
\textbf{Answer verified}

\subsection{}
%problem 2.11

This problem boils down to the game you may have played as a kid to decide who got to go first or ride in the front of the car: I'm thinking of a number between 1 and 10.  Granted here the secretary gets to guess until she gets it right.  Let $A_i$ be the event that the secretary guesses just $i$ times (gets it right on the $i$th try). Thus we want:
\begin{equation}
	P(B) = P\left(\bigcup_{i=1}^4 A_i \right) = \sum_{i=1}^4 P(A_i)
\end{equation}
This factorization brought to you by the letter 'I` and the fact that you can't simultaneously get it right on the first try and get it right on the second try, meaning these events are mutually exclusive.

For $i$ trials, there are $P^{10}_i$ possible ways to have tried.  Note that here order matters since we're talking about successive trials.  Consequently, there are $P^9_{i-1}$ ways to chose $i-1$ wrong numbers, giving
\begin{equation}
	P_i=\frac{P^9_{i-1}}{P^{10}_i}=\frac{1}{10}
\end{equation}
This answer, in itself, makes some sense although it does, at first glance, appear weird since you expect to gain an advantage as you learn about which numbers aren't correct.  In reality, there's 10 possible chances to get it right and you're no more likely to get it right on the first than on the second etc.; that's the best intuitive way to think about it.
\begin{equation}
	P(B) = \sum_{i=1}^4 \frac{1}{10} = .4
\end{equation}
Now, if the secretary knew that the last number had to be even, that reduces our total number of possible numbers to 5 so the probability becomes:
\begin{equation}
	P_i=\frac{P^4_{i-1}}{P^{5}_i}=\frac{1}{5}
\end{equation}
so instead we get
\begin{equation}
	P(B) = \sum_{i=1}^4 \frac{1}{5} = .8
\end{equation}

\textbf{Answer not verified}

\subsection{}
%problem 2.12
We proved earlier that $P(A) = 1 - P(\overline{A})$ so if we define

\begin{equation}
	B = \bigcup_{k=1}^n A_k
\end{equation}
then we know
\begin{equation}
	\overline{B} = \bigcap_{k=1}^n \overline{A_k}
\end{equation}
and thus
\begin{equation}
	1 - P\left(\bigcup_{k=1}^n A_k\right)  =P\left( \bigcap_{k=1}^n \overline{A_k} \right)
\end{equation}
$\Box$

\textbf{Answer not verified}

\subsection{}
%problem 2.13

Here we need to find the probability that you get 5 good ones and the probability you get one bad one; their sum will be the probability that the batch passes.

For both probabilities, the total number of outcomes is equal to the total number of groups of 50 objects out of the 100 or $\binom{100}{50} = 100891344545564193334812497256$.

For finding 5 good ones, there $\binom{95}{50}$ ways to pick 50 good ones.  Additionally, there's $\binom{95}{49}\binom{5}{1}$ to get 49 good ones and one bad one.

\begin{equation}
	P = \frac{\binom{95}{50}+\binom{95}{49}\binom{5}{1}}{\binom{100}{50}} = \frac{1739}{9603} = 0.181089
\label{answer2.13}
\end{equation}
\textbf{Answer verified}

\subsection{}
%problem 2.14

To solve this problem, you want to consider the people as buckets and the birthdays as things you put in the buckets.  As such, there are $365^r$ different possible ways for people to r people to have birthdays.

In order to get the probability that at least one person shares a birthday, like we proved for the earlier problem, we need to just find the probability that no one shares a birthday and subtract that from 1.

For the first person, there are 365 possibilities, 364 for the next, ad nauseum, giving $P^{365}_r$ ways of no one sharing a birthday.

\begin{equation}
	P(r) = 1 - \frac{P^{365}_r}{365^r} = 1 - \frac{365!}{365^r(365-r)!}
\label{answern2.14}
\end{equation}
\textbf{Answer verified by wikipedia}

\subsection{}
%problem 2.15

We are asked to check how good the truncation of
\begin{equation}
	1-e^x = -\sum_{n=1}^\infty \frac{x^n}{n!}
\end{equation}
is for $n=3, 4, 5, 6$ at $x=-1$.
\begin{equation}
	1-e^{-1} = 0.632121 \approx 1 - \frac{1}{2} + \frac{1}{6} - \frac{1}{24}  + \frac{1}{120} - \frac{1}{720}
\end{equation}
These truncations go as: $\{0.666667,0.625,0.633333,0.631944\}$ which relative to the exact answer are $\{1.05465,0.988735,1.00192,0.999721\}$

\textbf{Answer not verified}

\subsection{}
%problem 2.16

Here we have 4 events to look at: the probability that each player gets dealt a hand of one suit.
\begin{equation}
	P_1 = P(A_1) + P(A_2) + P(A_3) + P(A_4) = 4P(A_i)
\end{equation}
\begin{equation}
	P_2 = P(A_1 A_2) + P(A_1 A_3) + P(A_1 A_4) + P(A_2 A_3) + P(A_2 A_4) + P(A_3 A_4) = 6 P(A_i A_j)
\end{equation}
because each one of these is equivalent to the others (player 2 and 3 getting full hands is no more likely than player 4 and 1).
\begin{equation}
	P_3 = P(A_1 A_2 A_3) + P(A_1 A_2 A_4) + P(A_1 A_3 A_4) + P(A_2 A_3 A_4) = 4 P(A_i A_j A_k)
\end{equation}
\begin{equation}
	P_4 = P(A_1 A_2 A_3 A_4)
\end{equation}

For one player's hand, there are $\binom{52}{13}$ possibilities, only 4 of which are all the same suit.  For two players, the first player once again has $\binom{52}{13}$ possibilities but that leaves only $\binom{39}{13}$ for the second player (and $\binom{26}{13}$ for the third) giving a total number of hands for two players as $\binom{52}{13}\binom{39}{13}$ and $\binom{52}{13}\binom{39}{13}\binom{26}{13}$ for 3/4 players.

For 2 players, there are 4 possible hands for the first, leaving 3 for the second and giving 12 total desirable hands.  Consequently for three players, there are two more options giving 24 total desirable hands.

\begin{equation}
	P_1 =  4\left(\frac{4}{\binom{52}{13}}\right)
\end{equation}
\begin{equation}
	P_2 = 6\left( \frac{12}{\binom{52}{13}\binom{39}{13}} \right)
\end{equation}
\begin{equation}
	P_3 = 4\left( \frac{24}{\binom{52}{13}\binom{39}{13}\binom{26}{13}} \right)
\end{equation}
\begin{equation}
	P_4 = \frac{24}{\binom{52}{13}\binom{39}{13}\binom{26}{13}}
\end{equation}
\begin{equation}
	P\left(A_1 \cup A_2 \cup A_3 \cup A_4\right) = P_1 - P_2 +P_3 - P_4
\end{equation}
\begin{equation}
	P\left(A_1 \cup A_2 \cup A_3 \cup A_4\right) = \frac{16}{\binom{52}{13}} - \frac{72}{\binom{52}{13}\binom{39}{13}} + \frac{72}{\binom{52}{13}\binom{39}{13}\binom{26}{13}}
\label{answer2.16}
\end{equation}
because I have mathematica and I'm feeling lazy at the moment, I am just going to forgo the Stirling's Approximation part and tell you:
\begin{equation}
	P\left(A_1 \cup A_2 \cup A_3 \cup A_4\right) = \frac{18772910672458601}{745065802298455456100520000} \approx 2.5196312345 \cdot 10^{-11}
\end{equation}

\textbf{Answer verified}

\subsection{}
%problem 2.17

SKIPPED

\begin{equation}
	0=0
\label{answer2.17}
\end{equation}
\textbf{Answer [not] verified}

\subsection{}
%problem 2.18

SKIPPED

\begin{equation}
	0=0
\label{answer2.18}
\end{equation}
\textbf{Answer [not] verified}

\subsection{}
%problem 2.19

SKIPPED

\begin{equation}
	0=0
\label{answer2.19}
\end{equation}
\textbf{Answer [not] verified}

%%answer template
%\subsection{}
%%problem n.n
%
%
%\begin{equation}
%
%\label{answern.n}
%\end{equation}
%\textbf{Answer [not] verified}


\subsection{Laminas}
\noindent
Similar to plane laminas:
\begin{equation*}
	M = \iiint\limits_{\Omega}{\sigma(x,y,z)\mathrm{d}V}
\end{equation*}
\begin{equation*}
	\bar{x} = \frac{M_{yz}}{M} = \frac{\iiint\limits_{\Omega}{x\sigma(x,y,z)\mathrm{d}V}}{M} \text{, } \bar{y} = \frac{M_{xz}}{M} = \frac{\iiint\limits_{\Omega}{y\sigma(x,y,z)\mathrm{d}V}}{M} \text{, and } \bar{z} = \frac{M_{xy}}{M} = \frac{\iiint\limits_{\Omega}{z\sigma(x,y,z)\mathrm{d}V}}{M}
\end{equation*}


\subsection{Exponential}
\noindent
Let $a$ be a constant.\\
By definitions of a Laplace transform and an improper integral,
\begin{align*}
	\Laplace{e^{at}} &= \lim\limits_{n\to\infty}{\int_{0}^{n}{e^{at}e^{-st}\mathrm{d}t}} \\
	 &= \lim\limits_{n\to\infty}{\int_{0}^{\infty}{e^{(a-s)t} \mathrm{d}t}} \\
	 &= \frac{1}{a-s}\lim\limits_{n\to\infty}{\left[e^{(a-s)n}\right]}_{0}^{n} \text{, } s \neq a \\
	 &= \frac{1}{a-s}\lim\limits_{n\to\infty}{\left(e^{(a-s)n} - 1\right)} \text{, } s \neq a \\
	 &= \begin{cases}
	 	\frac{-1}{a-s} & s > a \\
	 	\text{DNE} & s \leq a
	 \end{cases}.
\end{align*}
So,
\begin{equation*}
	\Laplace{e^{at}} = \frac{-1}{a-s} \text{, } s > a.
\end{equation*}


%!TEX root =  ../main.tex

\objective{Understand and simplify the relationships between logs, powers, and roots.}

\subsection{The Three Components}
Our modern mathematical notation obfuscates one relationship with three, different notations.
The following equations all express the same things:
\begin{enumerate}
\item $\log_2{8}=3$
\item $2^3=8$
\item $\sqrt[3]{8}=2$
\end{enumerate}

All three embody the same relationship: 2 is the base, 3 is the exponent, and 8 is result.
Three elements suggest a three-sided shape, a \emph{triangle of power}.
$\tripow{2}{3}{8}$

Leaving off any side of the triangle of power suggests that the missing number is needed.
\begin{enumerate}
\item $\log_2{8}$ can be represented as $\tripow{2}{}{8}$
\item $2^3$ can be represented as $\tripow{2}{3}{}$
\item $\sqrt[3]{8}$ can be represented as $\tripow{}{3}{8}$
\end{enumerate}

Some people complain that this new notation ruins the line height, that is is too tall.
But these pedants rarely write\\
$(2\div(3+4))\div((5+6)\div(7+8))$.  Indeed, it is preferable to see:

$$\frac{\frac{2}{3+4}}{\frac{5+6}{7+8}}$$

In the same way, one might write $2\triangle^3$, $2\triangle_8$, and $\triangle^3_8$,
but expand in two-dimensions when the occasion permits.

\subsection{Inverses}
The true usefulness of the triangle of power is revealed when we try to present more
complicated relationships.  Some students immediately grasp what $e^{\ln{x}}$ is saying,
others struggle for years with the notation.  \emph{There is a power we can put on \emph{e}
to get \emph{x}.  Raise \emph{e} to that power.}  If you get it, the answer is obviously $x$.
But the symbols certainly don't help you see it.  Instead, triangles make the relationship
more obvious:

\begin{equation}
\tripow{e}{ \tripow{e}{}{x}}{}=x \quad \text{vs} \quad e^{\ln{x}}
\end{equation}

The top triangle is blank in the same place it occupies in the larger triangle.  Because the
$e$'s are in the same place, everything cancels, leaving only the $x$.
Other hard expressions which are simple inverses are equally obscure in traditional notation,
and quite clear in triangle form:
\begin{equation}
\tripow{}{e}{\scriptstyle \tripow{x}{e}{}} = x \quad \text{vs} \quad \sqrt[e]{x^e} = x
\end{equation}
\begin{equation}
\tripow{\tripow{}{e}{x}}{2}{} = x \quad \text{vs} \quad \sqrt[e]{x}^e = x
\end{equation}
\begin{equation}
\tripow{e}{}{\tripow{e}{x}{}} = x \quad \text{vs} \quad \ln{e^x} = x
\end{equation}
\begin{equation}
\tripow{}{\tripow{x}{}{e}}{e} = x \quad \text{vs} \quad \sqrt[\log_x{e}]{e} = x
\end{equation}
\begin{equation}\tripow{\tripow{}{x}{e}}{}{e} = x \quad \text{vs} \quad \log_{\sqrt[x]{e}}{e} = x
\end{equation}

\subsection{P-Plus}
The properties of logs, exponents, and roots become much more transparent in triangle notation.
For example, the sum of exponents look like this:
$$\tripow{b}{m}{}\cdot{}\tripow{b}{n}{}=\tripow{b}{m+n}{}$$

We shall see that this bears a strong resemblance to a similar property of logs:
$$\tripow{b}{}{m} + \tripow{b}{}{n} = \tripow{b}{}{m+n}$$

Graphically, keeping the base the same but switching from exponent to result changes where
the addition and multiplication happen.  You will make all the various versions of the rules in the
exercises and problems, but there is one relationship which might appear overly perplexing at first.
Consider the products of roots:

$$
\tripow{}{x}{z} \cdot{} \tripow{}{y}{z}
$$

We have not had occasion to contemplate this before.  What operation should govern this
relationship?  Given the thorough treatment of rational exponents in chapter 5, perhaps it would
be more clear for you to rewrite this problem as fractional powers:

{\Large
$$z^{\frac{1}{x}} \cdot z^{\frac{1}{y}}$$
}

The answer is a root which is the sum of the reciprocals of $x$ and $y$, or a power which is the
reciprocal of that!  This unusual operation is actually rather common in practical applications and
deserving of its own symbol in this book, $\pplus$.  This symbol was chosen because
the reciprocal of the sum of reciprocal is used in parallel resistance, whose symbol is $\parallel$.

\begin{derivation}{P-plus}
$$x\pplus y = \cfrac{1}{\frac{1}{x}+\frac{1}{y}} = \cfrac{1}{\frac{y}{xy}+\frac{x}{xy}} =
\cfrac{1}{\frac{x+y}{xy}} = \frac{xy}{x+y}$$
\end{derivation}

This strange operation is necessary in a world where power and roots are reciprocals of
each other:
$$
\tripow{a}{x}{} = \tripow{}{\frac{1}{x}}{a}
$$

There are many more intriguing relationship that can be written clearly and intuitively
on the Triangle of Power, e.g. $\tripow{m}{}{x}\pplus\tripow{n}{}{x} = \tripow{m\cdot{}n}{}{x}$
or $\tripow{x}{}{a}\cdot{}\tripow{a}{}{y} = \tripow{x}{}{y}$  You are encouraged to experiment
and tinker with this powerful tool.


\paragraph{Empirical distribution function} (shortly e.d.f.)
based on a sample $X = \sample$ is a function:
%Empirical distribution function:
%\[ \hat{F_n}(t; X_1, \ldots , X_n) = \frac{1}{n} \Sigma_{i=1}^n I_{(-\infty,t]} (X_i)
%\; , \; t \in R \]
\[ \hat{F}_n(x) = \frac{\#\{i: X_i \leq x\}}{n} \mbox{ or, defined in other way:} \]
\[ \hat{F}_n(x) = \frac{1}{n} \sum_{i=1}^{n} I_{(-\infty,x]} (X_i)
\mbox{ , where }
I_n(x) = \begin{cases} 1 \mbox{ if } x \in A \\ 0 \mbox{ otherwise} \end{cases} \]

The e.d.f. is a cumulative distribution function based not no the whole population, but only the sample.

\paragraph{Glivenko cantelli lemma}

Let $\sample$ i.i.d. $F$ and let $\hat{F}_n$ denote the empirical distribution
function based on this sample. Then:
\[  P ( \lim_{n \rightarrow \infty}  \sup_{x \in R} | \hat{F}_n(x) - F(x) | = 0 ) = 1 \]

This lemma tells us that when sample size is tending to infinity, then the maximum difference
between e.d.f. and cumulative d.f. of the whole population will tend to zero.

\paragraph{Statistical space}
\[  \statspace \]
\noindent where:
\begin{itemize}[noitemsep,nolistsep]
  \item $\mathcal{H}$ is sample space

  \item $\mathcal{A}$ is $\sigma$-algebra of $\mathcal{H}$

  \item $\mathcal{P}$ is a family of distributions

  \item $\theta$ is value of the parameter

  \item $\Theta$ is family of parameters
\end{itemize}

\paragraph{Sufficient statistic}
is a such statistic that is guaranteed to get us as much information as any statistic based on at
most the same sample size.

A statistic is said to be sufficient for the parameter $\param$ (for a family $\mathcal{P}$) iff the
conditional probability (given below) does not depend on $\param$ for any value $t$ on statistic
$T$.
\begin{gather*}
\Pr(X=x|T(X)=t,\theta) = \Pr(X=x|T(X)=t)\\
\Pr(x|t,\theta) = \Pr(x|t)
\end{gather*}

%\[ \]

\paragraph{Factorization criteria}
states that a statistic $T$ is sufficient iff $\exists$ the following factorization:
\[ p_\param(\sample) = g_\param(T(\sample)) h(\sample) \]
\noindent where:
\begin{itemize}[noitemsep,nolistsep]
  \item $p_\param$ is a distribution under study

  \item $g$ depends on $\param$ and a sample but only through $T$

  \item $h$ is independent of $\theta$
\end{itemize}

\paragraph{Family of k-parametric exponential distributions}
contains those distributions that satisfy the following:
\[ p_\theta(x) = h(x) \exp{ \left\{ \sum_{j=1}^k C_j(\theta)S_j(x) + B(\theta) \right\}  } \]

where $S_1, \ldots, S_k$ are linearly independent.


\subsubsection{Lucas\textquotesingle \ Theorem}
	For non-negative integer $n,m$ and prime $p$, $\binom{m}{n}\equiv\prod_{i=0}^k\binom{m_i}{n_i}\pmod p$\\
	where $m_i$ is the $i$-th digit of $m$ in base $p$.
\subsubsection{Sum of Two Squares Thm (Legendre)}
	For a given positive integer $n$, let\\
	$D_1 =$ (\# of positive integers $d$ dividing $N$ that $1\equiv d\pmod 4$)\\
	$D_3 =$ (\# of positive integers $d$ dividing $N$ that $3\equiv d\pmod 4$)\\
	then $n$ can be written as a sum of two squares in exactly\\
	$R(n) = 4(D_1-D_3)$ ways.
\subsubsection{Difference of D1-D3 Thm}
	let $n = 2^t \cdot (p_1^{e_1} \cdot ... \cdot p_r^{e_r}) \cdots (q_1^{f_1} \cdot ... \cdot q_s^{f_s})$\\
	where $p_i, q_i$ are primes and $1 \equiv p_i\pmod 4 , 3 \equiv q_i\pmod 4$\\
	then $D_1 - D_3$ = \begin{cases}
  $(e_1+1)(e_2+1)...(e_r+1)$, & \text{if (}$f_i$\text{)s all even}\\
	$0$,& \text{if any }$f_i$\text{ is odd}
  \end{cases}
\subsubsection{Krush–Kuhn–Tucker Conditions}
\begin{body}
  \textbf{Stationarity}\\
  For maximizing $f(x)$: $\nabla f(x^*) = \sum_{i=1}^m \mu_i \nabla g_i(x^*) + \sum_{j=1}^l \lambda_j \nabla h_j(x^*)$\\
  For minimizing $f(x)$: $-\nabla f(x^*) = \sum_{i=1}^m \mu_i \nabla g_i(x^*) + \sum_{j=1}^l \lambda_j \nabla h_j(x^*)$ \\
\\
  \textbf{Primal feasibility}\\
  $g_i(x^*) \le 0, \mbox{ for all } i = 1, \ldots, m$\\
  $h_j(x^*) = 0, \mbox{ for all } j = 1, \ldots, l \,\!$\\
\\
  \textbf{Dual feasibility}\\
  $\mu_i \ge 0, \mbox{ for all } i = 1, \ldots, m$\\
\\
  \textbf{Complementary slackness}\\
  $\mu_i g_i (x^*) = 0, \mbox{for all}\; i = 1,\ldots,m$
\end{body}
\subsubsection{Chinese remainder theorem}
\begin{body}
  $x \equiv r_i \mod p_i $\\
  $N = \prod p_i$\\
  $N_i = N / p_i$\\
  $x \equiv \sum r_i N_i (N_i)^{-1}_{p_i} \mod N$
\end{body}


\section{Two-point boundary problems and finite element discretization}
Denote the functional space
$$
V:=H^1_0(0,1)=\{v:\, [0,1]\rightarrow R,\,\,\mbox{$v$ is continuous and}\, v(0)=v(1)=0\}.
$$
Given any $f: [0,1]\rightarrow R$, consider
\begin{equation*}
J(v)=\frac12\int_{0}^1|v'|^2dx-\int_{0}^1 fvdx.
\end{equation*}
Find $u\in V$ such that
\begin{equation}\label{minvar}
\displaystyle u=\argmin_{v\in V} J(v)\quad
\end{equation}
\begin{theorem}
Problem \eqref{minvar} is equivalent to: Find $u\in V$ such that
\begin{equation}\label{1Dpossion}
\left\{
\begin{aligned}
-u''&= f, \,\, 0<x<1, \\
 u(0)&=u(1)=0.
\end{aligned}
\right.
\end{equation}
\end{theorem}
\begin{proof}
For any $v\in V, t\in R$, let $g(t)=J(u+t v)$.
Since $u=\argmin_{v\in V} J(v)$ means $g(t)\ge g(0)$. Hence, for any $v\in V$, $0$ is the global minimum of the function $g(t)$. Therefore
$g'(0)=0$ implies
$$
\int_{0}^1 u'v'dx=\int_0^1fvdx\quad \forall v\in V.
$$
By integration by parts, which is equivalent to
$$
\int_{0}^1 (-u''-f)vdx=0\quad \forall v\in V.
$$
It can be proved that the above identity holds if and only if
$-u''= f$ for all $x\in (0,1)$. Namely $u$ satisfies \eqref{1Dpossion}.
\end{proof}

Let $V_h$ be finite element space and $\{\varphi_1, \varphi_2, \cdots \varphi_{n}\}$ be a nodal basis of $V_h$.
%Let $\{\psi_1,\psi_2,\cdots, \psi_{n}\}$ be a dual basis of $\{\varphi_1, \varphi_2, \cdots \varphi_{n}\}$, namely $(\varphi_i,\psi_j )=\delta_{ij}$.
\begin{equation}
J(v_h)=\frac12\int_0^1|v_h'|^2dx-\int_0^1fv_hdx.
\end{equation}
Let
$$
\displaystyle v_h=\sum_{i=1}^{n}\nu_i\varphi_i,\quad \nu=(\nu_i)_{i=1}^{n}
$$
then using the convolution notation, we have
$$
J(v_h)=I(\nu)=\frac12\nu^TA\ast\nu-b^T\nu
$$
and
$$
\nabla I(\nu) =A\ast \nu -b,
$$
where $A=\frac{1}{h}[-1,2, -1]$.

At the same time, let $\displaystyle u_h=\sum_{i=1}^{n}\mu_i\varphi_i,$
\begin{equation}\label{min1d}
\displaystyle u_h=\argmin_{v_h\in V_h} J(v_h)\Leftrightarrow \mu=\argmin_{\nu \in R^n} I(\nu)
\end{equation}
And $u_h$ solves the problem: Find $u_h\in V_h$
\begin{equation}\label{1ddiscrevar}
\frac{d}{dt}J(u_h+t v_h)|_{t=0}=a(u_h,v_h)-\langle f, v_h\rangle=0 \quad \forall v_h\in V_h.
\end{equation}
where
$$
a(u_h,v_h)=\int_0^1 u_h'v_h'dx.
$$

\begin{theorem}\label{thm:best-approximation}
Let $V$ be a Hilbert space, $a(\cdot,\cdot)$ be a continuous,
symmetric, bilinear form defining an inner product on $V$. Let
$f(\cdot)$ be a continuous linear form. If $u$ is solution to the
problem~\eqref{minvar} and $u_h$ is a solution
to~\eqref{min1d}, then the following equality holds:
\begin{equation}\label{eq:best-approx}
\|u-u_h\|_a = \inf_{v\in V_h}\|u-v\|_a,
\end{equation}
where $\|u-u_h\|^2_a = a(u-u_h,u-u_h)$.
\end{theorem}

\begin{proof}
Frist, one sees that
$$
a(u-u_h, v)=0,~~~\forall v\in V_h.
$$
Thus, for any $v\in V_h$ we have
\begin{eqnarray*}
& &\|u-u_h\|_a^2=a(u-u_h, u-u_h)\\[0.2cm]
&=& a(u-u_h, u-v)\\[0.2cm]
&\le& \|u-u_h\|_a\|u-v\|_a.
\end{eqnarray*}
Taking the infimum on both sides of this equation then gives.
$$
\|u-u_h\|_a\le \inf_{v\in V_h}\|u-v\|_a.
$$
The proof is complete, since
\[
\|u-u_h\|_a\ge \inf_{v\in V_h}\|u-v\|_a,
\]
by the definition of infimum.
\end{proof}
Combining Theorem \ref{interp00} and Theorem \ref{thm:best-approximation}, we obtain the error estimate for the finite element method.
\begin{theorem}
If $u\in H^2(\Omega)$ is solution to the
problem~\eqref{1Dpossion} and $u_h$ is a solution to~\eqref{min1d}, then we have:
\begin{equation}
 \|u-u_h\|+h |u-u_h|_{1}\lc h^2 |u|_2.
   \end{equation}
 \end{theorem}

497-6DL/8 Convolutional Multigrid Method/8.1-1Dvariational.tex