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

\newcommand{\x}{\boldsymbol{x}}
\renewcommand{\v}{\boldsymbol{v}}
\renewcommand{\u}{\boldsymbol{u}}
\newcommand{\w}{\boldsymbol{w}}
\renewcommand{\a}{\boldsymbol{a}}
\renewcommand{\b}{\boldsymbol{b}}
\renewcommand{\c}{\boldsymbol{c}}
\newcommand{\n}{\boldsymbol{n}}
\newcommand{\e}{\boldsymbol{e}}
\renewcommand{\Re}{\operatorname{Re}}
\renewcommand{\Im}{\operatorname{Im}}
\newcommand{\Range}{\operatorname{Range}}
\newcommand{\Ker}{\operatorname{Ker}}
\renewcommand{\dim}{\operatorname{dim}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\C}{\mathbb{C}}
\renewcommand{\d}{\mathrm{d}}

\begin{document}

\title{Engineering and Science Mathematics 2B}
\author{Solutions to Midterm II}
\date{S\"onke Mittwollen}
\maketitle



\begin{enumerate}
\item 
\begin{itemize}
\item[(E)] Define an inner product on $\R^2$ by
\[
  \langle \u, \v \rangle = \u^T A \v
  \qquad \text{with} \qquad
  A =
  \begin{pmatrix}
  2 & 1 \\ 1 & 1
  \end{pmatrix} \,.
\]
Are the vectors
\[
  \v =
  \begin{pmatrix}
  1 \\ 1
  \end{pmatrix}
  \qquad \text{and} \qquad
  \w =
  \begin{pmatrix}
  1 \\ -1
  \end{pmatrix}
\]
orthogonal with respect to this inner product?  Explain.  

\item[(A)] Show that $\langle \u, \v \rangle = \u^H A \v$ defines an
  inner product on $\C^n$ provided that $A$ is a Hermitian $n \times
  n$ matrix, and provided that all eigenvalues of $A$ are strictly
  positive.
\end{itemize}

\textbf{Answer:}
\begin{itemize}
\item[(E)]
  Two vectors are orthogonal with respect to an inner product iff
  the inner product of the two vectors is zero.
  \begin{align*}
    \langle \v, \w \rangle = \v^T A \w = (1,1) 
    \begin{pmatrix}
      2 & 1 \\
      1 & 1
    \end{pmatrix}
    \begin{pmatrix}
      1 \\
      -1
    \end{pmatrix}
    = (1,1) 
    \begin{pmatrix}
      1 \\
      0
    \end{pmatrix}
    = 1 \neq 0 \,,
  \end{align*}
  therefore the two vectors are not orthogonal.
\item[(A)]
  What has to be shown:
  \begin{enumerate}
  \item $\langle \u , \v \rangle = \langle \v, \u \rangle ^{*}$
  \item $\langle \u , \lambda \v + \mu \w \rangle = \lambda \langle \u,\v
    \rangle + \mu \langle \u,\w \rangle$
  \item $\langle \u , \u \rangle = 0 \text{ iff } \u=0,
    \mbox{ and } \langle \u , \u \rangle > 0  \mbox{ otherwise} $.
  \end{enumerate}
  Solution:
  \begin{enumerate}
  \item For complex scalars, the Hermitian conjugate equals the complex
  conjugate, so that 
    \begin{align*}
      \langle \v, \u \rangle ^{*} &=\langle \v, \u \rangle ^{H} \\
      &= (\v^H A \u)^H \\
      &= \u^H A^H (\v^H)^H \\
      &= \u^H A^H \v \\
      & = \u^H A \v , \mbox{ since $A$ is Hermitian }\\
      &= \langle \u,\v \rangle
    \end{align*}
  \item By direct computation, 
    \begin{align*}
      \langle \u , \lambda \v + \mu \w \rangle &= \u^H A (\lambda \v+ \mu \w)
      = \u^H(\lambda A \v+ \mu A \w) = \lambda \u^H A \v + \mu \u^H A \w \\
      &=\lambda \langle \u,\v
      \rangle + \mu \langle \u,\w \rangle
    \end{align*}
    \item Since $\{ \v_1, \dots, \v_n \}$ form a basis, an arbitrary
    vector $\w$ can be written
    \begin{equation*}
      \w = \sum_{k=1}^n \alpha_k \, \v_k \,,
    \end{equation*}
    and we see that
    \begin{equation*}
      \langle \w, \w \rangle
      = \sum_{k=1}^n \lambda_k \, |\alpha_k|^2 \,.
    \end{equation*}
    Since $\lambda_k >0$, this expression is always non-negative, and
    is zero only if all $\alpha_k$ are zero, i.e.\ if $\w=0$.
  \end{enumerate}
\end{itemize}

\item
\begin{itemize}
\item[(E)] Find an orthonormal basis for the subspace of $\R^3$
spanned by
\[
  \v_1 =
  \begin{pmatrix}
  1 \\ 1 \\ 1
  \end{pmatrix} \,, \qquad
  \v_2 =
  \begin{pmatrix}
  1 \\ -1 \\ 1
  \end{pmatrix} \,.
\]

\item[(A)] Find an orthonormal basis for the subspace of $C[0,\pi]$
spanned by
\[
  f_1(x) = \sin^2 x \,, \qquad
  f_2(x) = \cos^2 x \,,
\]
with respect to the inner product
\[
  \langle f, g \rangle
  = \int_0^{2\pi} f(x) \, g(x) \, \d x \,.
\]
\end{itemize}

\textbf{Answer:}
\begin{itemize}
\item[(E)]
  Using the Gram--Schmidt procedure, we get:
  \begin{align*}
    \n_1 &= \frac{\v_1}{\|\v_1\|} = \frac 1{\sqrt 3} 
    \begin{pmatrix}
      1 \\ 1 \\ 1
    \end{pmatrix} \\
    \b_2 &= \v_2 - \langle \b_1, \v_2 \rangle \b_1
    = 
    \begin{pmatrix}
      1 \\ -1 \\ 1 
    \end{pmatrix} - \frac 1 3
    \begin{pmatrix}
      1 \\ 1 \\ 1
    \end{pmatrix} = \frac 2 3 
    \begin{pmatrix}
      1 \\ -2 \\ 1
    \end{pmatrix} \\
    \n_2 &= \frac 1 {\sqrt{1+4+1}} 
    \begin{pmatrix}
      1 \\ -2 \\ 1
    \end{pmatrix} =\frac 1 {\sqrt 6} 
    \begin{pmatrix}
      1 \\ -2 \\ 1
    \end{pmatrix}
  \end{align*}
  Now $\{\n_1, \n_2\}$ is an orthonormal basis of the given subspace.
\item[(A)]
  \begin{align*}
    \|f_1(x)\| &= \int^{2\pi}_0 f^2(x) \, dx = \int^{2\pi}_0 \sin^4 x \, dx    
  \end{align*}
  With the given formulas we find
  \begin{align*}
    \sin^4 x &= \Big( \frac{1-\cos 2x} 2 \Big)^2 = \frac{1-2\cos 2x+
    \cos^2 2x}4 
    = \frac 1 4 - \frac 1 2 \cos 2x + \frac 1 8 (1+\cos 4x) \\
    &= \frac 3 8 - \frac 1 2 \cos 2x + \frac 1 8 \cos 4x \,,
  \end{align*}
  so we get
  \begin{align*}
    \|f_1(x)\| &= \int^{2\pi}_0 \frac 3 8 \, dx -
    \int^{2\pi}_0 \frac 1 2 \cos 2x \, dx +  \int^{2\pi}_0\frac 1 8
    \cos 4x \, dx 
    = 2\pi \frac 3 8 = \frac 3 4 \pi
  \end{align*}
  \begin{align*}
    n_1(x) = \frac{f_1(x)}{\|f_1(x)\|} = \frac 2{\sqrt{3\pi}} \sin^2 x
  \end{align*}
  \begin{align*}
    b_2(x) &= f_2(x) - \langle n_1(x), f_2(x) \rangle n_1(x) 
    =  f_2(x) - \frac 2 {3\pi} \langle f_1(x), f_2(x) \rangle f_1(x) 
  \end{align*}
  \begin{align*}
    \langle f_1(x), f_2(x) \rangle &= \int^{2\pi}_0 \sin^2 x \cos^2 x
    \, dx 
    = \int^{2\pi}_0 \frac{1-\cos 2x} 2 \frac{1-\cos 2x} 2 \, dx \\ 
    &= \int^{2\pi}_0 \bigg( \frac 1 4 -\frac 1 4 \cos^2 2x \bigg) \,
    dx 
    = \int^{2\pi}_0 \bigg( \frac 1 4 - \frac{1+\cos 4x} 8 \bigg) \, dx
    \\ 
    &= \frac \pi 4
  \end{align*}
  \begin{align*}
    b_2(x) &= \cos^2 x- \frac \pi 4 \, \frac 4 {3 \pi} \, \sin^2 x
    =  \cos^2 x- \frac 1 3 \, (1-\cos^2 x)
    = \frac 4 3 \cos^2 x- \frac 1 3
  \end{align*}
The following normalization was not needed
  \begin{align*}
    \|b_2(x)\| &= \int^{2\pi}_0 \bigg( \frac 4 3 \cos^2 x- \frac 1 3
    \bigg)^2 \, dx 
    =  \int^{2\pi}_0 \bigg( \frac {16} 9 \cos^4 x- \frac 8 9 \cos^2 x
    +\frac 1 9 \bigg) \, dx \\ 
    &=  \int^{2\pi}_0 \bigg( \frac {16} 9 \bigg( \frac{1+\cos 2x} 2
    \bigg)^2 - \frac 8 9 \frac{1+\cos 2 x} 2 +\frac 1 9 \bigg) \, dx \\
    & =  \int^{2\pi}_0 \bigg( \frac 4 9 (1+2 \, \cos 2 x + \cos^2 2x)
    + \frac 4 9 \, (1+\cos 2 x) +\frac 1 9 \bigg) \, dx \\
    &=  \int^{2\pi}_0 \bigg( \frac19 + \frac 4 9 \cos 2x + \frac 4 9
    \frac{1 + \cos 4x}2 \bigg) \, dx \\ 
    &= \frac{2\pi}3
  \end{align*}
  \begin{align*}
    n_2(x)= \frac 1 {\sqrt{6\pi}} \, (4 \, \cos^2 x - 1) 
  \end{align*}
\end{itemize}

\item
\begin{itemize}
\item[(E)] Show that the Fourier coefficient with wavenumber $k=1$ of
  the function
\[
  f(x) =
  \begin{cases}
    x & \text{for } 0 \leq x < \pi \\
    x - \pi & \text{for } \pi \leq x < 2\pi
  \end{cases}
\]
is zero.

\item[(A)] Let $f$ be a $\pi$-periodic function on the interval $[0,
  2\pi]$, i.e.\ $f(x) = f(x+\pi)$.  Show that the Fourier coefficient
  $f_k=0$ if $k$ is odd.
\end{itemize}

\textbf{Answer:}
\begin{itemize}
\item[(E)]
  \begin{align*}
    \sqrt{2\pi} \, f_k &= \int_0^{2\pi} e^{ikx \,} f(x) \, dx
    = \int_0^\pi e^{ikx} \, x \, dx + \int_\pi^{2\pi} e^{ikx} \,
    (x-\pi) \, dx 
    \intertext{\hspace*{4cm} Substitution $y=x-\pi$ and $dx=dy$ gives}
    &= \int_0^\pi e^{ikx} \, x \, dx + \int_0^\pi e^{ik(y+\pi)} \, y \, dy \\
    &= \int_0^\pi e^{ikx} \, x \, dx + e^{ik\pi} \int_0^\pi e^{iky} \,
    y \, dy \\ 
    &= 0 \mbox{ for $k=1$, because $e^{i\pi}=-1$ }
  \end{align*}
\item[(A)]
  \begin{align*}
    \sqrt{2\pi} \, f_k &= \int_0^{\pi} e^{ikx} \, f(x) \, dx +
    \int_\pi^{2\pi} e^{ikx} \, f(x) \, dx \\ 
    \intertext{\hspace*{4cm} Substitution $y=x-\pi$ and $dx=dy$ gives}
    &= \int_0^\pi e^{ikx} \, f(x) \, dx + \int_0^\pi e^{ik(y+\pi)} \,
    f(y+\pi) \, dy \\ 
    &= \int_0^\pi e^{ikx} \, f(x) \, dx +  e^{ik\pi} \int_0^\pi
    e^{iky} \, f(y) \, dy \\ 
    &= 0 \mbox{ for odd $k$, because $e^{i\pi (2m+1)}=-1$ }
  \end{align*}
\end{itemize}


\item
\begin{enumerate}
\item Derive the Parseval identity
\[
  \int_{-\infty}^{\infty} |f(x)|^2 \, \d x
  = \int_{-\infty}^{\infty} |\tilde f(\xi)|^2 \, \d\xi \,.
\]

\item Show that the Fourier transform of
\[
  f(x) =
  \begin{cases}
    1 & \text{for } -1 \leq x \leq 1 \\
    0 & \text{otherwise} \,.
  \end{cases}
\]
is given by
\[
  \tilde f (\xi)
  = \sqrt{\frac2\pi} \, \frac{\sin\xi}\xi \,.
\]

\item Use (a) and (b) to prove
\[
  \int_{-\infty}^{\infty} \frac{\sin^2 \xi}{\xi^2} \, \d\xi = \pi \,.
\]

\end{enumerate}

\begin{enumerate}
\item 
  \begin{align*}
    \int_{-\infty}^\infty |f(x)|^2 \, dx &= \int_{-\infty}^\infty
    f^*(x) f(x) \, dx \\ 
    &= \int_{-\infty}^\infty \frac 1 {2\pi}
    \int_{-\infty}^\infty e^{-i\eta x} \, \tilde f^*(\eta) \, d\eta
    \int_{-\infty}^\infty e^{i\xi x} \, \tilde f(\xi) \, d\xi \, dx \\
    &= \int_{-\infty}^\infty \int_{-\infty}^\infty
    \frac 1 {2\pi} \int_{-\infty}^\infty e^{i(\xi-\eta) x} \, dx 
    \; \tilde f^*(\eta) \tilde f(\xi) \, d\eta \, d\xi \\
    &= \int_{-\infty}^\infty \int_{-\infty}^\infty 
    \delta(\xi-\eta)
    \; \tilde f^*(\eta) \tilde f(\xi) \, d\eta \, d\xi
    = \int_{-\infty}^\infty
    \tilde f^*(\xi) \tilde f(\xi) \, d\xi \\
    &= \int_{-\infty}^\infty |\tilde f(\xi)|^2 \, d\xi
  \end{align*}
\item 
  \begin{align*}
    \tilde f(\xi) &= \frac 1 {\sqrt{2\pi}} \int_{-\infty}^\infty
    e^{-i\xi x} \, f(x) \, dx 
    = \frac 1 {\sqrt{2\pi}} \int_{-1}^1 e^{-i\xi x} \, dx
    = \frac 1 {\sqrt{2\pi}} \frac{-1}{i\xi} (e^{-i\xi}-e^{i\xi}) \\
    &= \frac 1 {\sqrt{2\pi}} \frac 2 \xi \frac{e^{i\xi}-e^{-i\xi}}{2 i}
    = \sqrt{\frac 2 \pi} \, \frac{\sin \xi} \xi
  \end{align*}
\item 
  \begin{align*}
    \int_{-\infty}^{\infty} \frac{\sin^2 \xi}{\xi^2} \, \d\xi
    = \frac \pi 2 \int_{-\infty}^{\infty} \Big(\sqrt{\frac2\pi} \,
    \frac{\sin\xi}\xi \Big)^2 \, \d\xi 
    \overset{(a),(b)}{=} \frac \pi 2 \int_{-1}^1 1^2 \, \d x = \pi
  \end{align*}
\end{enumerate}



\item Let $f$ be a real-valued odd function, i.e. $f(-x)=-f(x)$.
\begin{enumerate}
\item Show that the Fourier transform $\tilde f$ is also odd.
\item Show that the Fourier transform $\tilde f$ is purely imaginary.
\end{enumerate}

\textbf{Answer:}
\begin{enumerate}
\item 
  \begin{align}
    \tilde f(-\xi) &= \frac 1 {\sqrt{2\pi}} \int_{-\infty}^\infty
    e^{-i(-\xi)x} \, f(x) \, dx \label{first} \\
    & \quad \text{Substitution $y=-x$ and $\d x=-\d y$} \\
    &=  -\frac 1 {\sqrt{2\pi}} \int_{\infty}^{-\infty}
    e^{i\xi(-y)} \, f(-y) \, dy \notag \\
    & =  \frac 1 {\sqrt{2\pi}} \int_{-\infty}^{\infty}
    e^{-i\xi y} \, (-f(y)) \, dy \nonumber \\ \nonumber
    &= -\frac 1 {\sqrt{2\pi}} \int_{-\infty}^{\infty}
    e^{-i\xi y} \, f(y) \, dy = - \tilde f(\xi)
  \end{align}
\item We have to show tht $\tilde f^*(\xi) = -\tilde f(\xi) $.
  \begin{align*}
    \tilde f^*(\xi) &= \Big( \frac 1 {\sqrt{2\pi}} \int_{-\infty}^\infty
    e^{-i\xi x} f(x) \, dx \Big)^* \notag \\
    & =  \frac 1 {\sqrt{2\pi}} \int_{-\infty}^\infty
    e^{i\xi x} f^*(x) \, dx \\
    & = \frac 1 {\sqrt{2\pi}} \int_{-\infty}^\infty e^{i\xi x} \, f(x)
    \, dx  
    \quad \mbox{since $f$ is real; this is the RHS of (\ref{first})} \\
    &= -\tilde f(\xi)
  \end{align*}
\end{enumerate}


\end{enumerate}

\end{document}
