\documentclass[11pt]{amsart}
\usepackage{amsmath,amsfonts,amsthm,amssymb, amsaddr}

\title{Fourier Series}

\author{Joe Bentley}

\date{\today}

\begin{document}

\maketitle

\newpage

\section{Periodicity}

A function $f(x)$ is said to be periodic with period $L$ if it has the same value at $x$ and $x + L$,

\begin{align*}
  f(x + L) = f(x)
\end{align*}

If a function has a period $L$ then it clearly also has period $nL$ for any positive integer $n$, as shown by,

\begin{align*}
  f(x + 2L) = f\left((x+L)+L\right) = f(x+L) = f(x)
\end{align*}

The minimum period of a periodic function, which cannot be divided into any more sections, is called the fundamental period of the function. For example the fundamental period of $f(x) = \sin{x}$ is $2\pi$.

If we know the value of a periodic function $f(x)$ over an interval of the length of its fundamental period $L$, we know the value of the function everywhere, as it is just that interval repeated.

\section{Fourier Series}

Sine and cosine are periodic functions with a fundamental period of $2\pi$. These functions are useful as we know much about them, for example we can integrate and differentiate them, and we can evaluate them for any value of $x$. Therefore it would be useful to be able to use them to represent a periodic function, much as we do with the maclaurin series except that instead of using a polynomial, we are using sines and cosines.

$\sin nx$ and $\cos nx$ are also periodic over $2\pi$, as we have shown earlier, as long as $n$ is a positive integer. It follows that $\sin{\frac{2\pi nx}{L}}$ and $\cos{\frac{2\pi nx}{L}}$ are periodic over length $L$. We can see this because if $x = L$, then it cancels to give $\sin{2\pi n}$, which we know represents a full cycle as the period of $\sin{nx}$ is $2\pi$. Think of this like the wavenumber, $k = \frac{2\pi}{\lambda}$.

As we have mentioned, the idea of the Fourier series is to be able to write function $f(x)$ of period $L$ in terms of sines and cosines of the same period $L$ but different amplitudes.

\begin{align*}
  f(x) = \frac{1}{2}a_0 + \sum\limits_{n=1}^{\infty}\left[a_n\cos{\frac{2\pi nx}{L}} + b_n\sin{\frac{2\pi nx}{L}}\right]
\end{align*}

We will show that we can find these coefficients for a function $f(x)$ by evaluating the overlap integral over a full period $L$,

\begin{align*}
  a_0 &= \frac{2}{L}\int_0^L f(x) dx \\
  a_n &= \frac{2}{L}\int_0^L f(x) \cos{\frac{2\pi nx}{L}} dx \\
  b_n &= \frac{2}{L}\int_0^L f(x) \sin{\frac{2\pi nx}{L}} dx \\
\end{align*}

Note that the limits do not have to be from $0$ to $L$, but just need to be over any length of the fundamental period, so for example can be from $-L/2$ to $L/2$.

\section{Orthogonality Relations}

In this section we will prove that the functions $\sin{\frac{2\pi nx}{L}}$ (where $n = 1, 2, 3\dots$) and $\cos{\frac{2\pi nx}{L}}$ (where $n = 0, 1, 2\dots$) can be considered mutually orthogonal, such that if $\phi(x)$ and $\psi(x)$ are two different functions from the set then,

\begin{align*}
  \int_0^L\phi(x)\psi(x) dx = 0
\end{align*}

To show this we will consider the three cases where, $\phi = \cos$ and $\psi = \cos$, $\phi = \sin$ and $\psi = \sin$, and $\phi = \sin$ and $\psi = \cos$.

First consider the integral,

\begin{align*}
  I_{mn} = \int_0^L \cos{\frac{2\pi mx}{L}} \cos{\frac{2\pi nx}{L}} dx
\end{align*}

For this we will use a trigonometric product identity (which can be obtained from the addition formula),

\begin{align*}
  \cos{A}\cos{B} = \frac{1}{2}\left[\cos(A+B)+\cos(A-B)\right]
\end{align*}

Plugging this into our integral,

\begin{align*}
  I_{mn} &= \frac{1}{2}\int_0^L\left[\cos{\frac{2\pi(m+n)x}{L}}+\cos{\frac{2\pi(m-n)x}{L}}\right] dx \\
         &= \frac{L}{4\pi}\left[\frac{1}{m+n}\sin{\frac{2\pi(m+n)x}{L}}+\frac{1}{m-n}\sin{\frac{2\pi(m-n)x}{L}}\right]_0^L
\end{align*}

This has different values for different $m$ and $n$. For $m \neq n$, $I_{mn} = 0$, since both of the sine functions are periodic over the limits of $L$. For $m = n \neq 0$, $I_{mn} = \frac{1}{2} L$, and finally for $m = n = 0$, $I_{mn} = L$.

Next we need to evaulate the integral,

\begin{align*}
  J_{mn} = \int_0^L \sin{\frac{2\pi mx}{L}} \sin{\frac{2\pi nx}{L}} dx
\end{align*}

This time we need the product identity for sine,

\begin{align*}
  \sin{A}\sin{B} = \frac{1}{2}\left[\cos(A-B)-\cos(A+B)\right]
\end{align*}

The result is simply the negative of what we had before,

\begin{align*}
  J_{mn} = \frac{1}{2}\int_0^L\left[\cos{\frac{2\pi(m-n)x}{L}}-\cos{\frac{2\pi(m+n)x}{L}}\right] dx
\end{align*}

This time the results are the same unless $m = n = 0$. We have for $m \neq n$, that $J_{mn} = 0$. For $m = n$ we have $J_{mn} = \frac{1}{2} L$ (even if $m = n = 0$).

Finally we need to consider the integral for sine and cosine. This time we need the product identity $\sin{A}\cos{B} = \frac{1}{2}\left[\sin(A+B)+\sin(A-B)\right]$,

\begin{align*}
  K_{mn} &= \int_0^L\sin{\frac{2\pi mx}{L}}\cos{\frac{2\pi nx}{L}} dx \\
         &= \frac{1}{2}\int_0^L\left[\sin{\frac{2\pi(m+n)x}{L}}+\sin{\frac{2\pi(m-n)x}{L}}\right] dx \\
         &= \frac{L}{4\pi}\left[-\frac{1}{m+n}\cos{\frac{2\pi(m+n)x}{L}}-\frac{1}{m-n}\cos{\frac{2\pi(m-n)x}{L}}\right]_0^L \\
         &= 0
\end{align*}

Again, by periodicity, $K_{mn} = 0$, for all $m$ and $n$.

We have shown therefore that the sine and cosine functions are orthogonal. This is similar to the scalar product, for example let's say we have a vector $\mathbf{A} = A_x\hat{\imath}+A_y\hat{\jmath}+A_z\hat{k}$, if we want the $x$ component of the vector we can use the scalar product $\hat{\imath}\cdot\mathbf{A} = A_x$. We can use this similarly to find the coefficients in the fourier series, but instead using an integral.

If we take the formula for the Fourier series and multiply both sides by $\cos{\frac{2\pi nx}{L}}$ and then integrate,

\begin{align*}
  \int_0^L f(x)\cos{\frac{2\pi nx}{L}} dx &= \frac{1}{2} a_0 \int_0^L\cos{\frac{2\pi nx}{L}} dx \\
                                          &+ \sum\limits_{m=1}^{\infty}\left[a_m\int_0^L\cos{\frac{2\pi mx}{L}}\cos{\frac{2\pi nx}{L}} dx + b_m\int_0^L\sin{\frac{2\pi mx}{L}}\cos{\frac{2\pi nx}{L}} dx\right]
\end{align*}

We know that the first term goes to zero due to periodicity. We also know that the last term inside the sum will be zero for all $m$ and $n$. Finally we know that the first term in the sum will be zero if $m \neq n$, but if $m = n \neq 0$ it will be $\frac{1}{2}L$, so we can represent this using the Kronecker delta $\delta_mn$. Now the integral goes to,

\begin{align*}
  \int_0^L f(x)\cos{\frac{2\pi nx}{L}} dx &= \sum_{m=1}^{\infty} a_m\frac{1}{2}\delta{mn} \\
                                          &= \frac{1}{2}L a_n
\end{align*}

Therefore we have shown that the coefficient $a_n$ can be written in the form,

\begin{align*}
  a_n = \frac{2}{L}\int_0^L f(x)\cos{\frac{2\pi nx}{L}} dx
\end{align*}

for $n = 1, 2, 3\dots$.

If we instead multiply by $\sin{\frac{2\pi nx}{L}}$ and integrate, we get the same result,

\begin{align*}
  b_n = \frac{2}{L}\int_0^L f(x)\sin{\frac{2\pi nx}{L}} dx
\end{align*}

for $n = 0, 1, 2\dots$.

To find the coefficient $a_0$, we take the formula for the Fourier series and integrate it alone,

\begin{align*}
  \int_0^L f(x)dx = \frac{1}{2} a_0 \int_0^L dx = \frac{1}{2} L a_0
\end{align*}

Therefore,

\begin{align*}
  a_0 = \frac{2}{L}\int_0^L f(x) dx
\end{align*}

\section{Finding the Fourier Series}

In the following sections we will apply what we know to a few functions and evaluate their Fourier series.

First let's consider what happens if our function $f(x)$, which we wish to evaluate the Fourier series for, is even such that $f(x) = f(-x)$. In this case,

\begin{align*}
  b_n = \frac{2}{L}\int_{-\frac{L}{2}}^{\frac{L}{2}}f(x)\sin{\frac{2\pi nx}{L}}dx = 0
\end{align*}

so only $a_n$ terms remain.

Similarly, if $f(x)$ is odd such that $f(x) = -f(-x)$,

\begin{align*}
  a_n = \frac{2}{L}\int_{-\frac{L}{2}}^{\frac{L}{2}}f(x)\cos{\frac{2\pi nx}{L}}dx = 0
\end{align*}

so only $b_n$ terms remain.

\section{Finding the Fourier Series: Example 1}

Consider the periodic function which is defined over the interval $x\in\left(-\frac{L}{2}, \frac{L}{2}\right)$ as $f(x) = |x|$. This can be written equivalently as,

\begin{align*}
  f(x)=
  \begin{cases}
    -x -\frac{L}{2} \leq & x \leq 0 \\
    x 0 \leq & x \leq \frac{L}{2} \\
  \end{cases}
\end{align*}

This function is clearly even, as $f(x) = f(-x)$, so we only get cosine ($a_n$) coefficients,

\begin{align*}
  a_n = \frac{2}{L}\int_{-\frac{L}{2}}^{\frac{L}{2}} |x| \cos{\frac{2\pi nx}{L}} dx
\end{align*}

Since the function is even, this means that it is symmetric over the limits, so we can just integrate over half the limits (for example from $0$ to $L/2$ instead of $-L/2$ to $L/2$) and then multiply by two,

\begin{align*}
  a_n = \frac{4}{L}\int_0^{\frac{L}{2}} x\cos{\frac{2\pi nx}{L}} dx
\end{align*}

To simplify solving this we make the solution $y = \frac{2\pi nx}{L}$ and thus $x = \frac{L}{2\pi n} y$ and $dx = \frac{L}{2\pi n}dy$. The integral therefore becomes,

\begin{align*}
  a_n &= \frac{4}{L}{\left(\frac{L}{2\pi n}\right)}^2\int_0^{\pi n} y\cos{y} dy \\
      &= \frac{L}{\pi^2n^2}{\left[y\sin{y}+\cos{y}\right]}_0^{\pi n} \\
      &= \frac{L}{\pi^2n^2}\left[\cos{\pi n} - 1\right] \\
      &= \frac{L}{\pi^2n^2}\left[{(-1)}^n - 1\right]
\end{align*}

In the third line we noted that $\cos{\pi n}$ will be negative for odd integers of $n$, and positive for even integers of $n$. If it is positive then it cancels out with the other $1$ to give zero in brackets. If it is negative it will add up to give two inside the brackets. This behaviour is summarized here,

\begin{align*}
  a_n=
  \begin{cases}
    -\frac{2L}{\pi^2n^2} & \text{n is odd} \\
    0 & \text{n is even}
  \end{cases}
\end{align*}

Finally we need to calculate our zeroth coefficient, $a_0$,

\begin{align*}
  a_0 = \frac{4}{L}\int_0^{\frac{L}{2}} x dx = \frac{4}{L}{\left[\frac{1}{2}x^2\right]}_0^{\frac{L}{2}} = \frac{L}{2}
\end{align*}

We now have all the information we need to subsitute into the Fourier series,

\begin{align*}
  f(x) &= \frac{L}{4}-\frac{2L}{\pi^2}\sum\limits_{\text{n odd}}\frac{1}{n^2}\cos{\frac{2\pi nx}{L}} \\
       &= \frac{L}{4}-\frac{2L}{\pi^2}\sum\limits_{k=0}^{\infty}\frac{1}{{(2k+1)}^2}\cos{\frac{2\pi(2k+1)x}{L}}
\end{align*}

By letting $x = 0$ we can find the value of the sum of $\frac{1}{{(2k+1)}^2}$,

\begin{align*}
  \sum\limits_{k=0}^{\infty} \frac{1}{{(2k+1)}^2} = \frac{\pi^2}{8}
\end{align*}

\section{The Riemann Zeta Function}

In this section we will explore the Riemann Zeta function, but this is not examinable material. The Riemann Zeta function is defined as,

\begin{align*}
  \zeta(z) = \sum\limits_{n=1}^{\infty} \frac{1}{n^z} \qquad \Re{z} > 1
\end{align*}

For other values of $z$ the value of $\zeta{z}$ can be found by using analytic continuoations. From the definition we see that,

\begin{alignat*}{8}
  \zeta(2) &= 1 + &&\frac{1}{2^2} &&+ \frac{1}{3^2} &&+ \frac{1}{4^2} &&+ \frac{1}{5^2} &&+ \frac{1}{6^2} &&+ \frac{1}{7^2} &&+ \dots \\
  \frac{1}{4}\zeta(2) &= &&\frac{1}{2^2} && &&+ \frac{1}{4^2} && &&+ \frac{1}{5^2} && &&+ \dots \\
  \zeta(2) - \frac{1}{4}\zeta(2) = \frac{3}{4}\zeta(2) &= 1 && &&+ \frac{1}{3^2} && &&+ \frac{1}{5^2} && &&+ \frac{1}{7^2} &&+ \dots \\
\end{alignat*}

We can see that the last sequence is just equal to the sum that we found at the end of the last section, as it is just hte sum of all odd $n$ squared. Therefore $\frac{3}{4}\zeta(2) = \frac{\pi^2}{8}$, and it follows that,

\begin{align*}
  \zeta(2) = 1 + \frac{1}{4} + \frac{1}{9} + \frac{1}{16} + \frac{1}{25} + \dots = \frac{\pi^2}{6}
\end{align*}

$\zeta(2n)$ where $n$ is a positive integer, is always a rational multiple of $\pi^{2n}$. The general formula is given by,

\begin{align*}
  \zeta(2n) = \frac{2^{2n-1} |B_{2n}|}{2n!} \pi^{2n}
\end{align*}

where $B_k$ are the Bernoulli numbers defined as,

\begin{align*}
  \frac{z}{e_z - 1} = \sum\limits_{k=0}^{\infty}\frac{B_k}{k!} z^k
\end{align*}

The only non-zero values of $B_k$ for odd $k$ is $B_1$, all others are odd. The first few Bernoulli numbers are,

\begin{align*}
  B_0 = 1 \qquad B_1 = -\frac{1}{2} \qquad B_2 = \frac{1}{6} \qquad B_4 = -\frac{1}{30} \qquad B_6 = \frac{1}{42}
\end{align*}

\section{Parseval's Theorem}

In this section we return to examinable stuff. Consider the Fourier series of a periodic function $f(x)$ given by,

\begin{align*}
  f(x) = \frac{1}{2}a_0 + \sum\limits_{n=1}^{\infty}\left[a_n\cos{\frac{2\pi nx}{L}} + b_n\sin{\frac{2\pi nx}{L}}\right]
\end{align*}

If we square $f(x)$ we get a complicated double series. It we then take the integral over a full period length $L$ then orthogonality means that we only get the diagonal (squared) terms, as we have shown that the integral over a full period of a product of two different cosines, two different sines, or a sine and a cosine is zero,

\begin{align*}
  \int_0^L f^2(x) dx = \frac{1}{4}a_0^2\int_0^Ldx + \sum\limits_{n=1}^{\infty}\left[\int_0^L a_n^2\cos^2{\frac{2\pi nx}{L}} dx + \int_0^L b_n^2 \sin^2{\frac{2\pi nx}{L}} dx\right]
\end{align*}

Or since $\sin^2{x} + \cos^2{x} = 1$ this can be written as,

\begin{align*}
  \int_0^L f^2(x) dx = \frac{1}{2}L\left[\frac{1}{2}a_0^2 + \sum\limits_{n=1}^{\infty}\left(a_n^2+b_n^2\right)\right]
\end{align*}

Note that the limits on the integral can be over any full period length, and don't have to be between $0$ and $L$.

\section{Finding the Fourier Series: Example 3}

The periodic function $h(x)$ is defined over the interval $x \in (-\frac{L}{2},\frac{L}{2})$ as,

\begin{align*}
  h(x) = \frac{1}{2}x^2 sgn{x} - \frac{1}{4}Lx
\end{align*}

The function is clearly odd, therefore we only need to calculate the $b_n$ coefficients, as the $a_n$ coefficients will all be zero. Using our formula from before to find $b_n$, as well as using the substitution $y = \frac{2\pi nx}{L}$ again from example one,

\begin{align*}
  b_n &= \frac{2}{L}\int_{-\frac{L}{2}}^{\frac{L}{2}}h(x)\sin{\frac{2\pi nx}{L}} dx \\
      &= \frac{4}{L}\int_0^{\frac{L}{2}}h(x)\sin{\frac{2\pi nx}{L}} dx \\
      &= \frac{4}{L}\int_0^{\frac{L}{2}}\left[\frac{1}{2}x^2-\frac{1}{4}Lx\right]\sin{\frac{2\pi nx}{L}} dx \\
      &= \frac{4}{L}\int_0^{\pi n}\left[\frac{1}{2}{\left(\frac{L}{2\pi n}\right)}^3y^2\sin{y}-\frac{1}{4}L{\left(\frac{L}{2\pi n}\right)}^2y\sin{y}\right] dy \\
      &= \frac{L^2}{4\pi^3n^3}\int_0^{\pi n}y^2\sin{y}dy-\frac{L^2}{4\pi^2n^2}\int_0^{\pi n}y\sin{y}dy \\
      &= \frac{L^2}{4\pi^3n^3}{\left[-y^2\cos{y}+2y\sin{y}+2\cos{y}\right]}_0^{\pi n} - \frac{L^2}{4\pi^2n^2}{\left[-y\cos{y}+\sin{y}\right]}_0^{\pi n} \\
      &= \frac{L^2}{4\pi^3n^3}\left[-{(\pi n)}^2\cos{\pi n}+2\cos{\pi n}-2\right]-\frac{L^2}{4\pi^2n^2}\left[-\pi n\cos{\pi n}\right] \\
      &= \frac{L^2}{2\pi^3n^3}\left[\cos{\pi n}-1\right] \\
      &= \frac{L^2}{2\pi^3n^3}\left[{(-1)}^2-1\right]
\end{align*}

We therefore have that the coefficients of the sine term are given by,

\begin{align*}
  a_n=
  \begin{cases}
    -\frac{L^2}{\pi^3n^3} & \text{n odd} \\
    0 & \text{n even}
  \end{cases}
\end{align*}

The Fourier series can then be written as,

\begin{align*}
  h(x) &= -\frac{L^2}{\pi^3} \sum\limits_{\text{n odd}}\frac{1}{n^3}\sin{\frac{2\pi nx}{L}} \\
       &= -\frac{L^2}{\pi^3} \sum\limits_{k=0}^{\infty}\frac{1}{{(2k+1)}^3}\sin{\frac{2\pi(2k+1)x}{L}}
\end{align*}

Parseval's theorem for this function is given by,

\begin{align*}
  \int_{-\frac{L}{2}}^{\frac{L}{2}}h^2(x)dx&=\frac{1}{2}L\sum\limits_{n=1}^{\infty}b_n^2 \\
                                           &=\frac{1}{2}L\left(\frac{L^4}{\pi^6}\right)\sum\limits_{\text{n odd}}\frac{1}{n^6} \\
                                           &=\frac{L^5}{2\pi^6}\sum\limits_{k=0}^{\infty}\frac{1}{{(2k+1)}^6}
\end{align*}

By evaluating the left side of the equation we get,

\begin{align*}
  \int_{-\frac{L}{2}}^{\frac{L}{2}}h^2(x)dx&=2\int_0^{\frac{L}{2}}{\left[\frac{1}{2}x^2-\frac{1}{4}Lx\right]}^2 dx \\
                                           &=2\int_0^{\frac{L}{2}}\left[\frac{1}{4}x^6-\frac{1}{4}Lx^3+\frac{1}{16}L^2x^2\right]dx \\
                                           &=2{\left[\frac{1}{20}x^5-\frac{1}{16}Lx^4+\frac{1}{48}L^2x^3\right]}_0^{\frac{L}{2}} \\
                                           &=2\left[\frac{1}{20}\frac{L^5}{32}-\frac{1}{16}\frac{L^3}{16}+\frac{1}{48}\frac{L^5}{8}\right] \\
                                           &=\frac{L^5}{1920}
\end{align*}

Therefore we have,

\begin{align*}
  \frac{L^5}{1920}=\frac{L^5}{2\pi^6}\sum\limits_{k=0}^{\infty}\frac{1}{{(2k+1)}^6}
\end{align*}

Which we can rearrange to find an expression for the sum alone,

\begin{align*}
  \sum\limits_{k=0}^{\infty}\frac{1}{{(2k+1)}^6}=\frac{\pi^6}{960}
\end{align*}

\section{Finding the Fourier series: Example 4}

Consider the periodic function defined on the interval $x\in(0, 2\pi)$ as $f(x) = e^{ax}$. This function is neither even nor odd so we have to calculate both $a_n$ and $b_n$ coefficients. Our $a_n$ (cosine) coefficients are given by,

\begin{align*}
  a_n &= \frac{2}{2\pi}\int_0^{2\pi}e^{ax}\cos{nx}dx \\
      &= \frac{1}{\pi} \Re \int_0^{2\pi}e^{ax}\cos{nx}dx \\
      &= \frac{1}{\pi} \Re \int_0^{2\pi}e^{(a+in)x} dx \\
      &= \frac{1}{\pi} \Re {\left[\frac{e^{(a+in)x}}{a+in}\right]}_0^{2\pi} \\
      &= \frac{1}{\pi} \Re \left[\frac{e^{2\pi(a+in)} - 1}{a+in}\right] \\
      &= \frac{1}{\pi} \Re \left[\frac{e^{2\pi a}e^{2\pi in} - 1}{a+in}\right] \\
      &= \frac{e^{2\pi a} - 1}{\pi} \Re \left[\frac{1}{a+in}\right] \\
      &= \frac{e^{2\pi a} - 1}{\pi} \Re \left[\frac{a-in}{a^2+n^2}\right]
\end{align*}

The cosine coefficients are therefore given by,

\begin{align*}
  a_n = \frac{1}{\pi}\left[e^{2\pi a} - 1\right]\frac{a}{n^2+a^2}
\end{align*}

To find the sine ($b_n$) coefficients we just need to take the imaginary part of the integral instead,

\begin{align*}
  b_n = \frac{1}{\pi}\int_0^{2\pi}e^{ax}\sin{nx}dx &= \frac{1}{\pi}\Im\int_0^{2\pi}e^{(a+in)x}dx \\
                                                   &= \frac{1}{\pi}\left[e^{2\pi a}-1\right] \Im\left[\frac{a-in}{a^2+n^2}\right] \\
                                                   &= -\frac{1}{\pi}\left[e^{2\pi a}-1\right]\frac{n}{n^2+a^2}
\end{align*}

Finally we need to find the coefficient when $n = 0$ which can be found simply by setting $n = 0$ in our expression for $a_n$,

\begin{align*}
  a_0 = \frac{1}{\pi a}\left[e^{2\pi a}-1\right]
\end{align*}

The Fourier series for this function is therefore,

\begin{align*}
  f(x)=\frac{1}{\pi}\left[e^{2\pi a}-1\right]\left\{\frac{1}{2a}+\sum\limits_{n=1}^{\infty}\frac{a\cos{nx}-n\sin{nx}}{n^2+a^2}\right\}
\end{align*}

The function is discontinuous at $x = 0$, as it has a sharp change. By setting $x = 0$ the Fourier series converges to the average value of the function,

\begin{align*}
  \frac{1}{2}\left[f(0+)+f(0-)\right] = \frac{1}{2}\left[1+e^{2\pi a}\right]
\end{align*}

Therefore by plugging $x = 0$ into our Fourier series we get,

\begin{align*}
  \frac{1}{2}\left[e^{2\pi a}+1\right]=\frac{1}{\pi}\left[e^{2\pi a}+1\right]\left\{\frac{1}{2a}+\sum\limits_{n=1}^{\infty}\frac{a}{n^2+a^2}\right\}
\end{align*}

By rearranging we can find that,

\begin{align*}
  \frac{\pi\left[e^{2\pi a}+1\right]}{\left[e^{2\pi a}-1\right]}=\frac{1}{a}+\sum\limits_{n=1}^{\infty}\frac{2a}{n^2+a^2}
\end{align*}

Multiplying the top and bottom of the left hand side by $e^{-\pi a}$,

\begin{align*}
  \frac{\pi\left[e^{\pi a}+e^{-\pi a}\right]}{\left[e^{\pi a}-e^{-\pi a}\right]} &= \frac{1}{a}+\sum\limits_{n=1}^{\infty}\frac{2a}{n^2+a^2} \\
  \pi\coth{\pi a} &= \frac{1}{a}+\sum\limits_{n=1}^{\infty}\frac{2a}{n^2+a^2} \\
  \pi a\coth{\pi a} &= 1 + \sum\limits_{n=1}^{\infty}\frac{2a^2}{n^2+a^2}
\end{align*}

Using this we can find an expression for the Riemann Zeta $\zeta(2k)$. First we let $a$ be small, so that we can expand using the Maclaurin series,

\begin{align*}
  \frac{a^2}{n^2+a^2}=\frac{a^2/n^2}{1 + a^2/n^2} = \frac{a^2}{n^2}\left[1 - \frac{a^2}{n^2} + \frac{a^4}{n^4} - \frac{a^6}{n^6} \dots\right]
\end{align*}

Our previous equation therefore becomes,

\begin{align*}
  \pi a\coth{\pi a} &= 1 + 2\sum\limits_{n=1}^{\infty}\left[\frac{a^2}{n^2}-\frac{a^4}{n^4}+\frac{a^6}{n^6} \dots\right] \\
                    &= 1 + 2\left[a^2\zeta(2)-a^4\zeta(4)+a^6\zeta(6)\dots \right] \\
                    &= 1 + 2\sum\limits_{n=1}^{\infty} {(-1)}^{k+1}a^{2k}\zeta(2k)
\end{align*}

Next look at the definition of the Bernoulli numbers, which gives us,

\begin{align*}
  \frac{x}{e^x - 1} &= \sum_{n=0}^{\infty} \frac{B_n}{n!}x^n \\
                    &= x \frac{e^{-\frac{x}{2}}}{e^{\frac{x}{2}}-e^{-\frac{x}{2}}} \\
                    &= \frac{1}{2}x\left[\frac{e^{\frac{x}{2}}+e^{-\frac{x}{2}}}{e^{\frac{x}{2}}-e^{-\frac{x}{2}}} - 1\right] \\
                    &= \frac{1}{2}x\left[\coth{\frac{x}{2}} - 1\right]
\end{align*}

Therefore we have,

\begin{align*}
  \frac{1}{2}x\left[\coth{\frac{x}{2}} - 1\right] = \sum\limits_{n=0}^{\infty}\frac{B_n}{n!}x^n
\end{align*}

Setting $x = 2\pi a$ gives us the left hand side the same as our equation earlier,

\begin{align*}
  \pi a\coth{\pi a} - \pi a = \sum\limits_{n=0}^{\infty}\frac{B_n}{n!}{(2\pi a)}^n
\end{align*}

By comparing the coefficients of this equation with the other equation equal to $\pi a\coth{\pi a} - \pi a$ we find that the only term of the Bernoulli number expression that survives is when $n = 2k$, such that,

\begin{align*}
  2{(-1)}^{k+1}\zeta(2k) = \frac{B_{2k}}{(2k)!}{(2\pi)}^{2k}
\end{align*}

Therefore we can now find an expression for the zeta,

\begin{align*}
  \zeta(2k) = \frac{|B_{2k}|2^{2k-1}\pi^{2k}}{(2k)!}
\end{align*}

\section{Complex Fourier Series}

So far we have written the Fourier series using sines and cosines to represent our function. Because of the deep relation between sines and cosines this means that we can write the Fourier series in terms of complex exponentials,

\begin{align*}
  f(x) = \sum\limits_{n=-\infty}^{\infty} C_n e^{\frac{2\pi inx}{L}}
\end{align*}

The complex exponential functions $\phi_n(x) = e^{2\pi inx}{L}$ are orthogonal such that,

\begin{align*}
  \int_{x_0}^{x_0+L} \phi_m^*(x)\phi_n(x) dx &= \int_{x_0}^{x_0+L}e^{-\frac{2\pi imx}{L}}e^{\frac{2\pi inx}{L}}dx \\
                                             &= \int_{x_0}^{x_0+L}e^{\frac{2\pi i(n - m)x}{L}} dx\\
                                             &=
  \begin{cases}
    0 & n \neq m \\
    L & n = m
  \end{cases}
\end{align*}

The integral is zero over the whole period because of the periodicity of the function $e^{\frac{2\pi ix}{L}}$. Therefore we have shown that the functions are orthogonal, which can be expressed by,

\begin{align*}
  \int_{x_0}^{x_0+L}\phi_m^*(x)\phi_n(x) dx = L\delta_{mn}
\end{align*}

The coefficients $C_n$ can be extracted using these relations by performing an overlap integral of the form,

\begin{align*}
  \int_{x_0}^{x_0+L}f(x)\phi^*(x)dx &= \sum\limits_{m=-\infty}^{\infty}C_m\int_{x_0}^{x_0+L}\phi_n^*(x)\phi_m(x) dx \\
                                    &= \sum\limits_{m=-\infty}^{\infty}C_m L \delta_{mn} = LC_n
\end{align*}

The coefficients are therefore given by,

\begin{align*}
  C_n = \frac{1}{L}\int_{x_0}^{x_0+L}f(x)e^{-\frac{2\pi inx}{L}} dx
\end{align*}

Parseval's theorem for this series can be found in the same way as usual, but we multiply the function by it's complex conjugate instead of just squaring it,

\begin{align*}
  f(x)f^*(x) = \sum\limits_{m=-\infty}^{\infty}\sum\limits_{n=-\infty}^{\infty}C_m^*C_n\phi_m^*(x)\phi_n(x)
\end{align*}

Parseval's theorem is found by integrating over this over a whole period,

\begin{align*}
  \int_{x_0}^{x_0+L}{|f(x)|}^2 dx &= \sum\limits_{m=-\infty}^{\infty}\sum\limits_{n=-\infty}^{\infty}C_m^* C_n \int_{x_0}^{x_0+L}\phi_m^*\phi_ndx \\
                                  &= \sum\limits_{m=-\infty}^{\infty}\sum\limits_{n=-\infty}^{\infty}C_m^* C_N L \delta_{mn} \\
                                  &= L\sum\limits_{n=-\infty}^{\infty}{|C_n|}^2
\end{align*}

We can manipulate the complex Taylor series to find the real Taylor series quite easily. First we note that the complex conjugate of the coefficients $C_n$ are given by,

\begin{align*}
  C_n^* = \frac{1}{L}\int_{x_0}^{\infty}f(x)e^{\frac{2\pi inx}{L}} dx
\end{align*}

Therefore, if $f(x)$ is real the coefficients are related by $C_n^* = C_{-n}$. It is possible to write the complex coefficients in terms of the real coefficients such that $C_n = \frac{1}{2}(a_n - ib_n)$ as shown by,

\begin{align*}
  C_n &= \frac{1}{L}\int_{x_0}^{x_0+L}f(x)e^{-\frac{2\pi inx}{L}} dx \\
      &= \frac{1}{L}\int_{x_0}^{x_0+L}f(x)\left[\cos{\frac{2\pi nx}{L}}-i\sin{\frac{2\pi nx}{L}}\right] dx \\
      &= \frac{1}{2}(a_n - ib_n)
\end{align*}

The complex conjugate of the coefficients is thus $C^* = C_{-n} = \frac{1}{2}(a_n + ib_n)$. Adding together the $C_n$ and $C_{-n}$ terms of the Taylor series gives us,

\begin{align*}
  C_n e^{\frac{2\pi inx}{L}} + C_{-n}e^{-\frac{2\pi inx}{L}} &= C_n e^{\frac{2\pi inx}{L}} + C^*_{-n}e^{-\frac{2\pi inx}{L}} \\
                                                             &= 2\Re{C_n e^{\frac{2\pi inx}{L}}} \\
                                                             &= \Re{(a_n - ib_n)\left(\cos{\frac{2\pi nx}{L}} + i\sin{\frac{2\pi nx}{L}}\right)} \\
                                                             &= a_n\cos{\frac{2\pi nx}{L}} + b_n\sin{\frac{2\pi nx}{L}}
\end{align*}

Which is just our real Taylor series.

\section{Fourier Transform}

In this section we will use the complex Fourier series to relate the time (or space) domain of a function to the frequency (or wavenumber) of the sine waves that make up the function in the Fourier series. First recall the form of the complex Fourier series,

\begin{align*}
  f(x) = \sum\limits_{n=-\infty}^{\infty} C_n e^{\frac{2\pi inx}{L}}
\end{align*}

The coefficients $C_n$ are given by,

\begin{align*}
  C_n = \frac{1}{L}\int_{-\frac{L}{2}}^{\frac{L}{2}} f(x) e^{-\frac{2\pi inx}{L}} dx
\end{align*}

By taking the factor of $L$ out of the expression for $C_n$ and instead writing it explicitly in $f(x)$ we can write these as,

\begin{align*}
  f(x) &= \sum\limits_{n=-\infty}^{\infty} \tilde{C_n}\frac{1}{L}e^{\frac{2\pi inx}{L}} \\
  \tilde{C_n} &= \int_{-\frac{L}{2}}^{\frac{L}{2}}f(x)e^{-\frac{2\pi inx}{L}} dx
\end{align*}

If we let the period $L$ go to infinity, then the wavenumber given by $k = \frac{2\pi n}{L}$ will become a real number, and the first sum will become an integral with $\frac{2\pi}{L}\to dk$. Also renaming $\tilde{C_n}$ as $\tilde{f}(k)$ gives us,

\begin{align*}
  f(x) = \frac{1}{2\pi}\int_{-\infty}^{\infty}\tilde{f}(k)e^{ikx} dk
\end{align*}

where $\tilde{f}(k)$ is the Fourier transform, given by,

\begin{align*}
  \tilde{f}(k) = \int_{-\infty}^{\infty}f(x) e^{-ikx} dx
\end{align*}

The first equation $f(x)$ is called the inverse Fourier transform, as it takes the Fourier transform and gives us back the original function, the second equation $\tilde{f}(k)$ is called the Fourier transform. Finding the function $\tilde{f}(k)$ is called \textit{taking the Fourier transform}. Finding $f(x)$ is called \textit{taking the inverse Fourier transform}. The Fourier transform takes a function in terms of a space $x$ and gives us the amount of each sine wave with wavenumber $k = \frac{2\pi n}{L}$. That is, it transforms the function from the spatial domain to the wavenumber domain. Commonly, for example in a signal, the signal will be a function of time $f(t)$, but we want to know the frequencies that make it up in the Fourier series, so we use the Fourier transform to transform from the time domain $f(t)$ to the frequency domain $f(\zeta)$.

The factor of $\frac{1}{2\pi}$ can be split up to make the definitions symmetrical,

\begin{align*}
  \tilde{f}(k) &= \frac{1}{\sqrt{2\pi}}\int_{-\infty}^{\infty}f(x)e^{-ikx} dx \\
  f(x) &= \frac{1}{\sqrt{2\pi}}\int_{-\infty}^{\infty}\tilde{f}(k)e^{ikx} dx
\end{align*}

Parseval's theorem for the Fourier transforms can be derived by starting at Parseval's theorem for the complex Fourier series,

\begin{align*}
  \int_{-\frac{L}{2}}^{\frac{L}{2}}{|f(x)|}^2 dx &= L\sum\limits_{n=-\infty}^{\infty}{|C_n|}^2 \\
                                                 &= L\sum\limits_{n=-\infty}^{\infty}\frac{1}{L^2}{|\tilde{C_n}|}^2 \\
                                                 &= \frac{1}{2\pi}\sum\limits_{n=-\infty}^{\infty}\frac{2\pi}{L}{|\tilde{C_n}|}^2
\end{align*}

By letting $L$ go to infinity, $\frac{2\pi n}{x}$ go to $k$, and $\tilde{c_n}$ go to $\tilde{f(k)}$ we get the equivalent for the Fourier transform,

\begin{align*}
  \int_{-\infty}^{\infty}{|f(x)|}^2dx = \frac{1}{2\pi}\int_{-\infty}^{\infty}{|\tilde{f}(k)|}^2 dk
\end{align*}

\section{Example 1: Top Hat Function}

Consider the top hat function of width $a$ defined as,

\begin{align*}
  f(x) = T\left(x; -\frac{a}{2}, \frac{a}{2}\right) =
  \begin{cases}
    1 & -\frac{a}{2} < x < \frac{a}{2} \\
    0 & \text{elsewhere}
  \end{cases}
\end{align*}

The Fourier transform is therefore just the integral over that region, as outside the region of width $a$ the value of the function is zero,

\begin{align*}
  \tilde{f}(k) &= \int_{-\infty}^{\infty}f(x)e^{-ikx} dx \\
               &= \int_{-\frac{a}{2}}^{\frac{a}{2}}e^{-ikx} dx \\
               &= {\left[\frac{e^{-ikx}}{-ik}\right]}_{-\frac{a}{2}}^{\frac{a}{2}} \\
               &= \left[\frac{e^{-ik\frac{a}{2}}-e^{ik\frac{a}{2}}}{-ik}\right] \\
               &= \frac{2i\sin{\frac{ka}{2}}}{ik}
\end{align*}

The Fourier transform for the top hat function is therefore given by,

\begin{align*}
  \tilde{f}(k) = \frac{2\sin{\frac{ka}{2}}}{k}
\end{align*}

This is our relationship that allows us to find the amplitude of the sine wave of a given wavenumber which makes up our function $f(x)$ in the Fourier series.

Another way to find the Fourier transform is to write the exponential in the form of sines and cosines, which is easier. First we note that $f(x)$ is even, so when multiplied by the sine term and integrated it goes to zero,

\begin{align*}
  \tilde{f}(k) &= \int_{-\infty}^{\infty} f(x) \left[\cos{kx}-i\sin{kx}\right] dx \\
               &= \int_{-\infty}^{\infty} f(x) \cos{kx} dx \\
               &= 2 \int_0^{\infty} f(x) \cos{kx} dx \\
               &= \frac{2\sin{k\frac{a}{2}}}{k}
\end{align*}

Note that we arrived at the same result, but didn't have to mess with any imaginary numbers. Finally, we will come up with some notion of an uncertainty relationship as in quantum mechanics for the Fourier transform. First we come up with a vague notion of width. Suppose that our width is given by $\Delta x = a$, that is, the width of one of the spatial function period. The corresponding width of the wavenumber is therefore given by $\Delta k = \frac{2\pi}{a}$. By multiplying these together we find an uncertainty relationship much like Heisenberg's uncertainty principle, $\Delta x \Delta k = 2\pi$.

We can also show how we can get back the original function $f(x)$ from the Fourier transform $\tilde{f}(k)$ using the inverse Fourier transform! We simply substitute into our formula and then evaluate the integral,

\begin{align*}
  f(x) &= \frac{1}{2\pi}\int_{-\infty}^{\infty} \tilde{f}(k) e^{ikx} dk \\
       &= \frac{1}{2\pi}\int_{-\infty}^{\infty} \frac{2\sin{k\frac{a}{2}}}{k} e^{ikx} dk \\
       &= \frac{1}{\pi}\int_{-\infty}^{\infty} \frac{\sin{k\frac{a}{2}}}{k} \cos{kx} dk \\
       &= \frac{2}{\pi}\int_{0}^{\infty} \frac{\sin{k\frac{a}{2}}}{k} \cos{kx} dk \\
\end{align*}

In the third line we expressed the complex exponential in trigonometric form. Since the integral is over even limits the sine from the Fourier transform (the big fraction) multiplied by the sine from the complex exponential will be zero when integrated over. Therefore we just have the cosine term of the complex exponential.

Now we need to approach evaluating this integral. First we use one of our product rule identities for trigonometric functions, $\sin{\theta}\cos{\phi} = \frac{1}{2}\left[\sin{(\theta+\phi)}+\sin{(\theta-\phi)}\right]$. The integral is therefore,

\begin{align*}
  f(x) = \frac{1}{\pi}\int_0^{\infty}\frac{1}{k}\left\{\sin{\left[k\left(x+\frac{a}{2}\right)\right]} - \sin{\left[k\left(x-\frac{a}{2}\right)\right]}\right\} dk
\end{align*}

To evaluate this, recall the result that,

\begin{align*}
  \int_0^{\infty} \frac{\sin{\alpha t}}{t} dt =
  \begin{cases}
    \frac{\pi}{2} & \alpha > 0 \\
    0 & \alpha = 0 \\
    -\frac{\pi}{2} & \alpha < 0
  \end{cases} = \frac{\pi}{2} sgn \alpha
\end{align*}

The integral therefore evaluates to,

\begin{align*}
  f(x) &= \frac{1}{\pi}\left\{\frac{\pi}{2} sgn\left(x+\frac{a}{2}\right) - \frac{\pi}{2} sgn\left(x-\frac{a}{2}\right)\right\} \\
       &= \frac{1}{2}\left\{sgn\left(x+\frac{a}{2}\right) - sgn\left(x-\frac{a}{2}\right)\right\} \\
       &=
  \begin{cases}
    0 & x > \frac{a}{2} \\
    1 & -\frac{a}{2} > x > \frac{a}{2} \\
    0 & -\frac{a}{2} > x \\
  \end{cases} \\
  &= T(x; -\frac{a}{2}, \frac{a}{2})
\end{align*}

Therefore as we see we have arrived back at our original function $f(x)$, the top hat function. You may be wondering what the point of this was, as we already knew that it was the inverse transform, but this was just done as some practise with applying the integral.

Finally in this example let us apply Parsevel's theorem which we already found for the Fourier transform.

\begin{align*}
  \int_{-\infty}^{\infty} {|f(x)|}^2 dx = \frac{1}{2\pi}\int_{-\infty}^{\infty}{\left[\frac{2\sin{\frac{ka}{2}}}{k}\right]}^2 dk
\end{align*}

In this case, $f(x) = {|f(x)|}^2$ because it is the top hat function so only has a value of $1$ or $0$. The integral therefore becomes,

\begin{align*}
  \int_{-\frac{a}{2}}^{\frac{a}{2}}dx &= \frac{1}{2\pi}\int_{-\infty}^{\infty}{\left[\frac{2\sin{\frac{ka}{2}}}{k}\right]}^2 dk \\
  a &= \frac{2}{\pi}\int_{-\infty}^{\infty}\frac{\sin^2{\frac{ka}{2}}}{k^2} dk
\end{align*}

We can therefore rearrange to show,

\begin{align*}
  \int_{-\infty}^{\infty}\frac{\sin^2{\frac{ka}{2}}}{k^2}dk = \frac{\pi}{2}a
\end{align*}

If we set $a = 2$ we find a general result,

\begin{align*}
  \int_{-\infty}^{\infty}\frac{\sin^2{k}}{k^2}dk = \pi
\end{align*}

\section{Example 2: Exponential}

We will now do another example, but instead of using a discrete top hat function, we will use a continuous exponential decay function of the form,

\begin{align*}
  f(x) = \exp{\left(-\lambda |x|\right)}
\end{align*}

The Fourier transform is evaluated trivially using our formula,

\begin{align*}
  \tilde{f}(k) &= \int_{0}^{\infty}e^{-\lambda x}e^{-ikx}dx + \int_{-\infty}^{0}e^{\lambda x}e^{-ikx} dx \\
               &= \int_0^{\infty}e^{-(\lambda + ik)x}dx + \int_{-\infty}^0 e^{(\lambda -ik)x}dx \\
               &= {\left[\frac{e^{-(\lambda + ik)x}}{-(\lambda + ik)}\right]}_0^{\infty} + \left[\frac{e^{(\lambda - ik) x}}{\lambda - ik}\right]_{-\infty}^0 \\
               &= \frac{1}{\lambda + ik} + \frac{1}{\lambda - ik} \\
               &= \frac{(\lambda - ik) + (\lambda + ik)}{(\lambda + ik)(\lambda - ik)} \\
               &= \frac{2\lambda}{k^2 + \lambda^2}
\end{align*}

Again we can take the inverse Fourier transform in the same way and find an interesting result,

\begin{align*}
  f(x) &= \frac{1}{2\pi}\int_{-\infty}^{\infty}\tilde{f}(k)e^{ikx}dk \\
       &= \frac{1}{2\pi}\int_{-\infty}^{\infty}\frac{2\lambda}{k^2+\lambda^2}e^{ikx}dk \\
       &= \frac{\lambda}{\pi}\int_{-\infty}^{\infty}\frac{1}{k^2+\lambda^2}\cos{kx}dk \\
\end{align*}

In the second line, we noticed that the first term in the integral is even in $k$, so we only get the cosine term of the complex exponential. We therefore find,

\begin{align*}
  \int_{-\infty}^{\infty} \frac{\cos{kx}}{k^2+\lambda^2} dk = \frac{\pi}{\lambda}e^{-\lambda |x|} \quad \text{for $\lambda > 0$}
\end{align*}

\section{Example 4: Gaussian}

Take a Gaussian function of the form $f(x) = e^{-\frac{x^2}{2\sigma^2}}$. To take the Fourier Transform we need to know the standard integral, $\int_{-\infty}^{\infty} e^{-\alpha x^2} dx = \sqrt{\frac{\pi}{\alpha}}$. Using our formula for the Fourier transform we have,

\begin{align*}
  \tilde{f}(k) &= \int_{-\infty}^{\infty} e^{-\frac{x^2}{2\sigma^2}} e^{-ikx} dx \\
               &= \int_{-\infty}^{\infty} e^{-\frac{1}{2\sigma^2}\left[x^2 + 2ik\sigma^2 x\right]} dx
\end{align*}

The reason we made this factorization is so that we have a quadratic the first term is $x^2$. Solving by completing the square,

\begin{align*}
  \tilde{f}(k) &= \int_{-\infty}^{\infty} \exp{\left[-\frac{1}{2\sigma^2} \left\{ {\left(x+ik\sigma^2\right)}^2 - {\left(ik\sigma^2\right)}^2\right\}\right]} dx \\
               &= \exp{\left[-\frac{1}{2}k^2\sigma^2\right]}\int_{-\infty}^{\infty}\exp{\left[-\frac{1}{2\sigma^2}{\left(x + ik\sigma^2\right)}^2\right]} dx \\
               &= e^{-\frac{1}{2}k^2\sigma^2}\int_{-\infty + ik\sigma^2}^{\infty + ik\sigma^2} \exp{\left[-\frac{1}{2\sigma^2}u^2\right]} du
\end{align*}

In the last line we let $u = x + ik\sigma^2$, and therefore $du = dx$, our Fourier transform is therefore,

\begin{align*}
  \tilde{f}(k) &= \sqrt{\frac{\pi}{1/2\sigma^2}} e^{-\frac{1}{2}k^2\sigma^2} \\
               &= \sqrt{2\pi\sigma^2} e^{-\frac{1}{2}k^2\sigma^2}
\end{align*}

There we have the Fourier transform of the Gaussian function, not too shabby!

\section{Example 5: Delta Function}

In this example we will take the Fourier transform of the delta function,

\begin{align*}
  f(x) = \delta(x)
\end{align*}

The Fourier transform is simply,

\begin{align*}
  \tilde{f}(k) &= \int_{-\infty}^{\infty} \delta(x) e^{-ikx} dx \\
               &= 1
\end{align*}

This is because the delta function is zero everywhere except at $x = 0$, at which point the exponential is equal to $1$.

\section{Example 6: Constant}

In this section we will find the Fourier transform of a constant $f(x) = 1$. The Fourier transform is therefore $\tilde{f}(k) = \int_{-\infty}^{\infty} e^{-ikx} dx$. We know from our continuous representation of the Heaviside function (look this up) that this is,

\begin{align*}
  \tilde{f}(k) = 2\pi\delta(k)
\end{align*}

Therefore we see that the Fourier transform of a constant function is a delta function.

\section{Example 7: Cosine}

In this section we will find the Fourier transform of $f(x) = \cos{k_0 x}$. The Fourier transform is,

\begin{align*}
  \tilde{f}(k) &= \int_{-\infty}^{\infty} \cos{k_0 x} e^{-ikx} dx \\
               &= \int_{-\infty}^{\infty} \frac{1}{2}\left(e^{ik_0 x} - e^{-ik_0 x}\right) e^{-ikx} dx \\
               &= \frac{1}{2} \int_{-\infty}^{\infty} e^{-i(k-k_0)x} + e^{-i(k+k_0)x} dx \\
               &= \frac{1}{2} \left[2\pi\delta(k-k_0) + 2\pi \delta(k+k_0)\right] \\
               &= \pi \left[\delta(k-k_0) + \delta(k+k_0)\right]
\end{align*}

\section{Fourier Transform as an Operator}

In this section, we will define the Fourier Transform operator $\mathcal{F}\left[f(x)\right] = \tilde{f}(k)$ so that $\mathcal{F}$ is the operation of taking the Fourier transform. We will define and prove some rules about how this operator works.

First we have a rule of linearity,

\begin{align*}
  \mathcal{F}\left[\alpha f(x) + \beta g(x)\right] = \alpha\tilde{f}(k)+\beta\tilde{f}(k)
\end{align*}

This follows from the linearity of integration,

\begin{align*}
  \mathcal{F}\left[\alpha f(x) + \beta g(x)\right] &= \int_{-\infty}^{\infty} \left[\alpha f(x) + \beta g(x)\right] e^{-ikx} dx \\
                                                   &= \alpha\int_{-\infty}^{\infty}f(x)e^{-ikx}dx + \beta\int_{-\infty}^{\infty}g(x)e^{-ikx}dx \\
                                                   &= \alpha\tilde{f}(k) + \beta\tilde{g}(k)
\end{align*}

Next, we have the shift rule,

\begin{align*}
  \mathcal{F}\left[f(x-a)\right] = e^{-ika} \tilde{f}(k)
\end{align*}

This follows by making the substitution $x = y + a$,

\begin{align*}
  \mathcal{F}\left[f(x-a)\right] &= \int_{-\infty}^{\infty} f(x-a) e^{-ikx} dx \\
                                 &= \int_{-\infty}^{\infty} f(y) e^{-ik(y+a)} dy \\
                                 &= e^{-ika}\int_{-\infty}^{\infty} f(y) e^{-iky}dy \\
                                 &= e^{-ika}\tilde{f}(k)
\end{align*}

Next, we have a rule for transforms of the $n$-th derivative of a function,

\begin{align*}
  \mathcal{F}\left[f^n(x)\right] = {(ik)}^n \tilde{f}(k)
\end{align*}

This follows by differentiating the inverse Fourier transform $n$ times,

\begin{align*}
  f(x) &= \frac{1}{2\pi} \int_{-\infty}^{\infty} \tilde{f}(k) e^{ikx} dk \\
  f^n(x) &= \frac{1}{2\pi} \int_{-\infty}^{\infty} {(ik)}^n \tilde{f}(k) e^{ikx} dk \\
  \mathcal{F}\left[f^n(x)\right] &= {(ik)}^n \tilde{f}(k)
\end{align*}

Next we have the inverse of that rule,

\begin{align*}
  \mathcal{F}\left[{(-ix)}^n f(x)\right] = \tilde{f}^n(k)
\end{align*}

This follows by differentiating the Fourier transform $n$ times,

\begin{align*}
  \tilde{f}(k) &= \int_{-\infty}^{\infty}f(x)e^{-ikx}dx\\
  \tilde{f}^n(k) &= \int_{-\infty}^{\infty}{(-ik)}^nf(x)e^{-ikx} dx \\
  \tilde{f}^n(k) &= \mathcal{F}\left[{(-ik)}^n f(x)\right]
\end{align*}

Next we have the transform of a product,

\begin{align*}
  \mathcal{F}\left[f(x)g(x)\right] = \frac{1}{2\pi} \tilde{f}*\tilde{g}(k)
\end{align*}

This is proven as follows,

\begin{align*}
  \mathcal{F}\left[f(x)g(x)\right] &= \int_{-\infty}^{\infty}f(x)g(x)e^{-ikx}dx \\
                                   &= \int_{-\infty}^{\infty}f(x) \left[\frac{1}{2\pi} \int_{-\infty}^{\infty} \tilde{g}(q) e^{iqx} dq\right] e^{-ikx} dx \\
                                   &= \frac{1}{2\pi} \int_{-\infty}^{\infty} \tilde{g}(q) dq \left[\int_{-\infty}^{\infty}f(x) e^{iqx}e^{-ikx} dx\right] \\
                                   &= \frac{1}{2\pi} \int_{-\infty}^{\infty} \tilde{g}(q) dq \left[\int_{-\infty}^{\infty}f(x) e^{-i(k - q)x} dx\right] \\
                                   &= \frac{1}{2\pi} \int_{-\infty}^{\infty} \tilde{f}(k-q) \tilde{g}(q) dq \\
                                   &= \frac{1}{2\pi} \tilde{f}*\tilde{g}(k)
\end{align*}

Finally we have the inverse of this,

\begin{align*}
  \mathcal{F}\left[f*g(x)\right] = \tilde{f}(k) \tilde{g}(k)
\end{align*}

This is proven as follows,

\begin{align*}
  \mathcal{F}\left[f*g(x)\right] &= \int_{-\infty}^{\infty} f*g(x) e^{-ikx} dx \\
                                 &= \int_{-\infty}^{\infty} \left[\int_{-\infty}^{\infty}f(x-y)g(y)dy\right] e^{-ikx} dx \\
                                 &= \int_{-\infty}^{\infty} g(y) dy \left[\int_{-\infty}^{\infty} f(x-y) e^{-ikx} dx\right] \\
                                 &= \tilde{f}(k) \int_{-\infty}^{\infty} g(y) e^{-iky} dy \\
                                 &= \tilde{f}(k) \tilde{g}(k)
\end{align*}

\section{Convolutions}

Convolutions commonly occur when an instrument has an intrinsic distortion or blurring. The image produced is the convolution of the true image and the instrument's profile.

To obtain the true image one needs to deconvolve,

\begin{align*}
  f*I \to \tilde{f}(k) \tilde{I}(k) \to \tilde{f}(k) \to f
\end{align*}

Geometrically $f*g(x)$ is the area under the product $f(x-y) g(y)$. $f(x-y)$ is obtained from $f(y)$ by reflecting about the line $y = x$ and translating by $x$.

Now we will do a couple of examples of convolutions. First, we will take two delta functions and convolute them with a top hat function.

\begin{align*}
  f(y) &= \delta{(y + \frac{\pi}{2})} + \delta{(y + \frac{\pi}{2})} \\
  g(y) &= \Theta{(\frac{d}{2} - |y|)} = T(y; -\frac{d}{2}, \frac{d}{2}) \\
\end{align*}

In this case the function is even so,

\begin{align*}
  f(x - y) = f(y - x) = \delta\left(y - x + \frac{a}{2}\right) + \delta\left(y - x - \frac{a}{2}\right)
\end{align*}

The convolution can then be evaluated,

\begin{align*}
  \int_{-\infty}^{\infty} f(x-y)g(y)dy &= \int_{-\infty}^{\infty} \left[\delta\left(y - x + \frac{a}{2}\right) + \delta\left(y - x - \frac{a}{2}\right)\right] \Theta\left(\frac{d}{2} - |y|\right) dy \\
                                       &= \Theta\left(\frac{d}{2} - \left|x - \frac{a}{2}\right|\right) + \Theta\left(\frac{d}{2} - \left|x + \frac{a}{2}\right|\right) \\
                                       &= T\left(x; \frac{(a-d)}{2}, \frac{(a+d)}{2}\right) + T\left(x; -\frac{(a+d)}{2}, \frac{(d-a)}{2}\right)
\end{align*}

The Fourier transform is given by,

\begin{align*}
  \mathcal{F}\left[f*g(x)\right] = \tilde{f}(k)\tilde{g}(k) = \left[2\cos{\frac{ka}{2}}\right]\left[2\frac{\sin{\frac{kd}{2}}}{k}\right]
\end{align*}

Next we will do an example with two equal top hat functions,

\begin{align*}
  f(y) = g(y) = \Theta{(a - |y|)} = T(y; -a, a)
\end{align*}

If $x = 0$ in the convolution then the top hat functions are just on top of each other,

\begin{align*}
  f*g(x=0) = \int {[f(y)]}^2 dy = \int_{-a}^{a} dy = 2a
\end{align*}

As the value $|x|$ increases, $f * g$ decreases linearly until it vanishes at $|x| = 2a$.

In this example the Fourier transform of the convolution is,

\begin{align*}
  \tilde{f}(k) \tilde{g}(k) = {\left[\frac{2\sin{ka}}{k}\right]}^2
\end{align*}

See the notes on Canvas for an example with two Gaussians.

\section{Fourier Cosine Transform}

If $f(x)$ is a real, even function, then we may observe that the integral over the $i\sin$ term in the Fourier transform goes to zero, so we are just left with the $\cos$ term,

\begin{align*}
  \tilde{f}(k) &= \int_{-\infty}^{\infty} f(x)\left[\cos{kx}-i\sin{kx}\right]dx \\
               &= \int_{-\infty}^{\infty} f(x)\cos{kx} dx \\
               &= 2 \int_{0}^{\infty} f(x)\cos{kx} dx \\
               &= 2 \tilde{f_c}(k)
\end{align*}

where $\tilde{f_c}(k) = \int_0^{\infty}f(x)\cos{kx}dx$ is called the Fourier cosine transform.

It follows that $\tilde{f}(k)$ is a real and even function of $k$. To find the inverse transform we see that since $\tilde{f}(k)$ is even, only the cosine term remains, as the integral over the sine term will be zero,

\begin{align*}
  f(x) &= \frac{1}{2\pi}\int_{-\infty}^{\infty} \tilde{f}(k) e^{ikx} dk \\
       &= \frac{1}{2\pi}\int_{-\infty}^{\infty} \tilde{f}(k) \left[\cos{kx}+i\sin{kx}\right] dk \\
       &= \frac{1}{2\pi}\int_{-\infty}^{\infty} \tilde{f}(k) \cos{kx} dk \\
       &= \frac{1}{\pi}\int_0^{\infty} \left[2\tilde{f_c}(k)\right] \cos{kx} dk \\
  f(x) &= \frac{2}{\pi}\int_0^{\infty} \tilde{f_c}(k) \cos{kx} dk
\end{align*}

In the symmetric form of the transform the $2/\pi$ can be split equally as $\sqrt{2/\pi}$.

\section{Fourier Sine Transform}

If $f(x)$ is a real, odd function, then the cosine term will integrate to zero as it will be zero over symmetric limits,

\begin{align*}
  \tilde{f}(k) &= \int_{-\infty}^{\infty} f(x) \left[\cos{kx} - i\sin{kx}\right] dx \\
               &= -i\int_{-\infty}^{\infty} f(x) \sin{kx} dx \\
               &= -2i\int_0^{\infty} f(x) \sin{kx} dx \\
               &= -2i \tilde{f_s}(k)
\end{align*}

where $\tilde{f_s}(k) = \int_0^{\infty}f(x)\sin{kx}dx$ is called the Fourier sine transform.

It follows that $\tilde{f}(k)$ is an imaginary, odd function of $k$. To find the inverse note that the cosine term will disappear again over the symmetric limits as $\tilde{f}(k)$ is odd,

\begin{align*}
  f(x) &= \frac{1}{2\pi}\int_{-\infty}^{\infty} \tilde{f}(k) e^{ikx} dk \\
       &= \frac{1}{2\pi}\int_{-\infty}^{\infty} \tilde{f}(k) \left[\cos{kx} + i\sin{kx}\right] dk \\
       &= \frac{1}{2\pi} i \int_{-\infty}^{\infty} \tilde{f}(k) \sin{kx} dk \\
       &= \frac{1}{2\pi} i 2 \int_0^{\infty}\left[-2i\tilde{f_s}(k)\right] \sin{kx} dk \\
  f(x) &= \frac{2}{\pi} \int_0^{\infty}\tilde{f_s}(k)\sin{kx} dx
\end{align*}

\section{Higher-dimensional Fourier Transforms}

For a function $f(x, y)$ of two vriables we can define a Fourier transform,

\begin{align*}
  \tilde{f}(k_x, k_y) = \int_{-\infty}^{\infty}dx\int_{-\infty}^{\infty}dy f(x, y) e^{-i(k_x+k_y+k_z)}
\end{align*}

and the inverse transform,

\begin{align*}
  f(x, y) = \frac{1}{{(2\pi)}^2} \int_{-\infty}^{\infty}dk_x\int_{-\infty}^{\infty} \tilde{f}(k_x, k_y) e^{i(k_x, k_y)}
\end{align*}

We can add to this for higher dimensions but it quickly gets messy, so for $d$ dimensions we define $\mathbf{r} = (x_1, x_2, \dots x_d)$, and $\mathbf{k} = (k_1, k_2, \dots k_d)$. The Fourier transform and its inverse can then be defined as,

\begin{align*}
  \tilde{f}(\mathbf{k}) &= \int_V f(\mathbf{r}) e^{-i\mathbf{k}\cdot\mathbf{r}} d^d r \\
  f(\mathbf{r}) &= \frac{1}{{(2\pi)}^d} \int_{\tilde{V}} \tilde{f}(\mathbf{k}) e^{i\mathbf{k}\cdot\mathbf{r}} d^d k
\end{align*}

For example, for plane waves defined as $f(\mathbf{r}, t) = e^{i(\mathbf{k}\cdot\mathbf{r} - \omega t)}$ the fourier transform is,

\begin{align*}
  \tilde{f}(\mathbf{k}, \omega) &= \int d^3r dt f(\mathbf{r}, t) e^{i(\omega t - \mathbf{k}\cdot\mathbf{r})} \\
  f(\mathbf{r}, t) &= \frac{1}{{(2\pi)}^4} \int d^3r dt \tilde{f}(\mathbf{k}, \omega) e^{i(\mathbf{k}\cdot\mathbf{r} - \omega t)}
\end{align*}

\section{Radial Fourier Transform}

Consider the Fourier transform of a 3D function $V(r)$ which depends only on $r = |\mathbf{r}|$. The Fourier transform is defined as,

\begin{align*}
  \tilde{V}(k) = \int d^3r V(r) e^{-\mathbf{k}\cdot\mathbf{r}}
\end{align*}

We will use spherical polar coordinates, so that,

\begin{align*}
  d^3r &= r^2\sin{\theta}dr d\theta d\phi \\
  \mathbf{k}\cdot\mathbf{r} &= kr \cos{\theta}
\end{align*}

We set the $z$-axis of our polars along the $\mathbf{k}$ direction.

\begin{align*}
  \tilde{V}(k) &= \int_0^{\infty} r^2 V(r) dr \int_0^{\pi} e^{-ikr\cos{\theta}} \sin{\theta} d\theta \int_0^{2\pi} d\phi \\
               &= \int_0^{\infty} 2\pi r^2 V(r) dr \int_0^{\pi} e^{-ikr\cos{\theta}} \sin{\theta} d\theta \\
               &= \int_0^{\infty} 2\pi r^2 V(r) dr {\left[\frac{e^{-ikr\cos{\theta}}}{ikr}\right]}^{\theta = \pi}_{\theta = 0} \\
               &= \int_0^{\infty} 2\pi r^2 V(r) dr \left[\frac{e^{ikr} - e^{-ikr}}{ikr}\right] \\
               &= \int_0^{\infty} 2\pi r^2 v(r) dr \left[\frac{2i\sin{kr}}{ikr}\right] \\
               &= \frac{4\pi}{k}\int_0^{\infty} r\sin{kr} V(r) dr
\end{align*}

$\tilde{V}(k)$ is the radial Fourier transform of $V(r)$. For example, consider the Yukawa potential $V(r) = \frac{1}{r} e^{-\frac{r}{a}}$,

\begin{align*}
  \tilde{V}(k) &= \frac{4\pi}{k}\int_0^{\infty}r\sin{kr} V(r) dr \\
               &= \frac{4\pi}{k}\int_0^{\infty}\sin{kr} e^{-\frac{r}{a}} dr \\
               &= \frac{4\pi}{k} \Im \int_0^{\infty} e^{-r\left(\frac{1}{a}-ik\right)} dr \\
               &= \frac{4\pi}{k}\Im {\left[-\frac{1}{\frac{1}{a} - ik} e^{-r\left(\frac{1}{a} - ik\right)}\right]}_{r=0}^{r=\infty} \\
               &= \frac{4\pi}{k}\Im\left[\frac{1}{\frac{1}{a} - ik}\right] \\
               &= \frac{4\pi}{k}\Im\left[\frac{\frac{1}{a} + ik}{\frac{1}{a^2} + k^2}\right] \\
               &= \frac{4\pi}{k}\frac{k}{k^2 + \frac{1}{a^2}}
  \tilde{V}(k) &= \frac{4\pi}{k^2 + \frac{1}{a^2}}
\end{align*}

To get the Coulomb potential, let $a \to \infty$. For $V(r) = \frac{1}{r}$,

\begin{align*}
  \tilde{V}(k) = \frac{4\pi}{k^2}
\end{align*}

With the constants $V(r) = \frac{e^2}{4\pi\epsilon_0 r}$,

\begin{align*}
  \tilde{V}(k) = \frac{e^2}{\epsilon_0 k^2}
\end{align*}

\section{Solution of Poisson's Equation}

Suppose we start from Maxwell's equations of electromagnetism, how do we derive Coulomb's law? In the static case, where there is no time dependence, M1 and M3 become,

\begin{align*}
  \nabla\cdot\mathbf{E} &= \frac{\rho}{\epsilon_0} \\
  \nabla\times\mathbf{E} &= 0
\end{align*}

From Helmholtz's theorem, since in the second equation the curl is equal to zero $\nabla\times\mathbf{E} = 0$ this implies there is some scalar field $V(\mathbf{r})$ such that $\mathbf{E} = -\nabla V$. Substituting $\mathbf{E} = -\nabla V$ into the first Maxwell equation gives,

\begin{align*}
  \nabla^2 V(\mathbf{r}) = -\frac{\rho(\mathbf{r})}{\epsilon_0}
\end{align*}

This is called Poisson's equatoin. To solve Poisson's equation, write $V(\mathbf{r})$ as a Fourier expansion,

\begin{align*}
  V(\mathbf{r}) = \frac{1}{{(2\pi)}^2}\int d^3\mathbf{k} \tilde{V}(k) e^{i\mathbf{k}\cdot\mathbf{r}}
\end{align*}

Operating $\nabla^2$ on $e^{i\mathbf{k}\cdot\mathbf{r}}$ gives,

\begin{align*}
  \nabla^2 e^{i\mathbf{k}\cdot\mathbf{r}} = \left[\frac{\partial^2}{\partial x^2} + \frac{\partial^2}{\partial y^2} + \frac{\partial^2}{\partial z^2}\right] e^{i(k_x x + k_y y + k_z z)}
\end{align*}

\begin{align*}
  \nabla^2 e^{i\mathbf{k}\cdot\mathbf{r}} &= \left[-{k_x}^2 -{k_y}^2 -{k_z}^2\right] e^{i\mathbf{k}\cdot\mathbf{r}} \\
                                           &= -k^2 e^{i\mathbf{k}\cdot\mathbf{r}}
\end{align*}

It follows that,

\begin{align*}
  \nabla^2 V(\mathbf{r}) = \frac{1}{{(2\pi)}^3}\int d^3\mathbf{k}(-k^2 \tilde{V}(\mathbf{k})) e^{i\mathbf{k}\cdot\mathbf{r}}
\end{align*}

We can write the right hand side of Poisson's equation as a Fourier expansion,

\begin{align*}
  -\frac{\rho(\mathbf{r})}{\epsilon_0} = \frac{1}{{(2\pi)}^3}\int d^3\mathbf{k} \left(-\frac{\tilde{\rho}(\mathbf{k})}{\epsilon_0}\right) e^{i\mathbf{k}\cdot\mathbf{r}}
\end{align*}

Since $\nabla^2 V(\mathbf{r}) = -\frac{\rho(\mathbf{r})}{\epsilon_0}$, the bracketed terms in the Fourier transforms must be equal,

\begin{align*}
  -k^2 \tilde{V}(\mathbf{k}) = -\frac{\tilde{\rho}(\mathbf{k})}{\epsilon_0}
\end{align*}

It follows that,

\begin{align*}
  \tilde{V}(\mathbf{k}) = \frac{\tilde{\rho}(\mathbf{k})}{\epsilon_0 k^2} = \tilde{\rho}(\mathbf{k}) \tilde{G}(\mathbf{k})
\end{align*}

where $\tilde{G}(\mathbf{k}) = \frac{1}{\epsilon_0 k^2}$.

From before with the Coulomb potential this Fourier transform $\tilde{G}(\mathbf{k})$ corresponds to

\begin{align*}
  G(\mathbf{r}) = \frac{1}{4\pi\epsilon_0 r}
\end{align*}

From the convolution theorem,

\begin{align*}
  \tilde{V}(\mathbf{k}) &= \tilde{\rho}(\mathbf{k})\tilde{G}(\mathbf{k})
\end{align*}

\begin{align*}
  \to V(\mathbf{r}) &= \rho * G(\mathbf{r}) = \int d^3 \mathbf{r'} G(\mathbf{r} - \mathbf{r'}) \rho(\mathbf{r'})
\end{align*}

Hence we get the final result,

\begin{align*}
  V(\mathbf{r}) = \int \frac{\rho(\mathbf{r'})}{4\pi\epsilon_0 |\mathbf{r} - \mathbf{r'}|} d^3 \mathbf{r'}
\end{align*}

And therefore the eletric field is,

\begin{align*}
  \mathbf{E}(\mathbf{r}) = -\nabla V(\mathbf{r}) = \int \frac{\rho(\mathbf{r'}) (\mathbf{r} - \mathbf{r'})}{4\pi\epsilon_0 {|\mathbf{r} - \mathbf{r'}|}^3} d^3 \mathbf{r'}
\end{align*}

\end{document}


%!TEX root=ClassNotes.tex
\section{Trig, Exp, and Log functions}
We'll use the Fundamental Theorem of Calculus to compute the derivatives of trigonometric functions, exponentials, and logarithms.
\subsection{Trigonometric Functions}
In this section, we'll prove that
\begin{align*}
	(\cos x)' &= -\sin x\\
	(\sin x)' &= \cos x
	\end{align*}
We'll only show this for $0 < x < \pi/2$, however,  the statements are true for all real numbers $x$.
We'll do this by first computing $\left(\cos^{-1}x \right)'$ using basic geometry and the Fundamental Theorem and then using the formula for the derivative of inverse functions.

\begin{exercise}
	Consider the unit circle $x^2 + y^2 = 1$. In the following figure, the shaded region is a sector of angle $\theta$ (in radians), for $0 < \theta < \pi/2$, so that the corresponding point on the circle is $(\cos \theta, \sin \theta)$.
	\begin{align*}
		\adjincludegraphics[width=0.3\textwidth, valign=c]{pie1.png}
		=
		\adjincludegraphics[width=0.3\textwidth, valign=c]{pie2.png}
		+
		\adjincludegraphics[width=0.3\textwidth, valign=c]{pie3.png}
	\end{align*}
	\begin{enumerate}
		\item Argue that the above decomposition of areas can be expressed algebraically as
		      \begin{align*}
			      \dfrac{\theta}{2}
			       & =
			      \dfrac{x \sqrt{1 - x^2}}{2}
			      +
			      \int \limits_x^1 \sqrt{1 - t^2} \: dt
		      \end{align*}
		      which can further be simplified to
		      \begin{align*}
			      \dfrac{\cos^{-1}x}{2}
			       & =
			      \dfrac{x \sqrt{1 - x^2}}{2}
			      +
			      \int \limits_x^1 \sqrt{1 - t^2} \: dt
		      \end{align*}

		\item Differentiate both sides to show that
		      \begin{align*}
			      \left(\cos^{-1}x \right)'
			       & =
			      -\dfrac{1}{\sqrt{1-x^2}}
		      \end{align*}

		\item Use the formula for the derivative of inverse function\footnote{$\left(f^{-1}(a)\right)'= \dfrac{1}{f'(f^{-1}(a))}$} to show that
		      \begin{align*}
			      (\cos \theta)' = -\sin \theta
		      \end{align*}
	\end{enumerate}
\end{exercise}

\begin{exercise}
	Differentiate both sides of the trig identity
	\begin{align*}
		\sin^2 x  + \cos^2 x = 1
	\end{align*}
	and use your computation of $(\cos x)'$ to show that
	\begin{align*}
		(\sin x)' = \cos x
	\end{align*}
\end{exercise}

\begin{exercise}
	\begin{enumerate}
		\item Use the formula for the derivative of inverse function to compute the derivative of $\sin ^{-1}x$.
		\item What is the relationship between the derivatives of $\sin ^{-1}x$ and $\cos ^{-1}x$? Why do you think this is the case?
	\end{enumerate}
\end{exercise}

\begin{exercise}
	Compute the derivatives of $\tan x$ and $\tan^{-1} x$.
\end{exercise}

\subsection{Exponential Functions and Logarithms}
Exponential functions are a bit tricky to define from first principles as every natural definition of $e^x$ uses either limits of sequences or differential equations.
We'll instead give a more {\it ad hoc} definition of logarithms as in the book and {\it verify} that it satisfies the properties that logarithms are supposed to satisfy.

\begin{definition}
	Define the {\bf natural logarithm} to be the integral
		\begin{align*}
			\ln x = \int_1^x \dfrac{1}{t} \: dt
		\end{align*}
		for $x > 0$.
\end{definition}
\begin{remark}
	As $\ln x$ is {\it defined} to be the antiderivative of $ 1 / x$,
	\begin{align*}
		\left(\ln x\right)'= \dfrac{1}{x}
	\end{align*}
\end{remark}
\begin{exercise}
	\begin{enumerate}
		\item Draw the graph of $\dfrac{1}{x}$ for $x > 0$.
		\item {\it Geometrically} argue that
			\begin{align*}
				\ln x \mbox{ is }
				\begin{cases}
					\mbox{positive } & \mbox{ if } x > 1\\
					0 & \mbox{ if } x = 1\\
						\mbox{negative } & \mbox{ if } x < 1
				\end{cases}
			\end{align*}
		\item Using u-substitution\hint{In the u-substitution formula $
		\int_a^z f(g(t)) g'(t)\: dt = \int_{g(a)}^{g(z)} f(u) \: du$ use $g(t) = x \cdot t$.} show that
		\begin{align*}
			\int_1^y \dfrac{1}{t} \: dt
			&=
			\int_x^{xy} \dfrac{1}{t} \: dt
		\end{align*}
		for real numbers $x , y > 0$. (You should think about what this means geometrically.)
		\item Show that this implies that
		\begin{align}
			\label{eq:log_identity}
			\ln x + \ln y = \ln xy
		\end{align}
	\end{enumerate}
\end{exercise}
This last identity \eqref{eq:log_identity} is the fundamental identity of logarithms.

\begin{definition}
	Define $\exp(x)$ to be the inverse function of $\ln x$ i.e.
	\begin{align*}
		\exp(\ln x) &= x \\
		\ln(\exp x) &= x.
	\end{align*}
\end{definition}
\begin{definition}
	Define $e$ to be the value of $\exp(x)$ at $x = 1$.
\end{definition}

\begin{exercise}
	\begin{enumerate}
		\item Show that $\exp(0) = 1$.
		\item Show that Equation \eqref{eq:log_identity} implies that
		\begin{align*}
			\exp(a + b) = \exp(a) \cdot \exp(b)
		\end{align*}
		\item Use this to argue that
		\begin{align*}
			\exp(n) = e^n
		\end{align*}
		where $n$ is a positive integer.
		\item {\bf (Optional)} Extend the above statement first to negative integers and then to rational numbers.
	\end{enumerate}
	It follows then from continuity arguments that
	\begin{align*}
		\exp(x) = e^x
	\end{align*}
	for all real numbers $x$.
\end{exercise}

\begin{exercise}
	Use the formula for the derivative of inverse function to show that
	\begin{align*}
		\left(e^x\right)'=e^x\\
	\end{align*}
\end{exercise}

This completes the computation of derivatives of all the standard functions.

\begin{exercise}
	The Fundamental Theorem of Calculus says that if $f'(x)=g(x)$ then $f(x) = \int g(x)\: dx + c $, where $\int g(x)\: dx$ stands for the indefinite integral.
	Go back to your derivative computations in this section and rewrite them as indefinite integrals.
\end{exercise}

We'll next use the u-substitution, and Integration by Parts to compute integrals of functions which can be written in terms of these standard functions.

\newpage
\subsection{Trigonometric Identities}
We'll need several trigonometric identities for computing integrals.
While it is possible to derive these identities using Euclidean geometry, there is a much faster trick to derive these using {\it Euler's identity}.

\subsubsection{Complex Numbers}
First we need some basic algebraic facts about complex numbers. {\bf Complex numbers} are numbers of the form
\begin{align*}
	z = a + b i
\end{align*}
where $a$ and $b$ are real numbers and $i$ is a {\it formal} variable that satisfies
\begin{align*}
	i^2 = -1.
\end{align*} The number $a$ is called the {\bf real part} of $z$, denoted $\mathrm{Re}(z)$, and the number $b$ is called it's {\bf imaginary part}, denoted $\mathrm{Im}(z)$.

A real number $r$ can be thought of the complex number $ r + 0 i$. Thus the set of complex numbers contains the set of real numbers.

As with real numbers, we can add, subtract, multiply, and
divide complex numbers.
\begin{example} Multiplying complex numbers:
	\begin{align*}
			(a + bi)(c - di)
			&= a(c - di) + bi(c - di) \\
			&= ac - adi + bci + bd  & \mbox{ as } i^2 = -1\\
			&= (ac + bd) + i(-ad + bc)
	\end{align*}
\end{example}

\begin{exercise}
	\label{q:complex_conjugate}
	Show that
	\begin{align*}
		(a + bi) (a - bi) = a^2 + b^2.
	\end{align*}
\end{exercise}

The complex number $\overline{z} = a - bi$ is called the {\bf complex conjugate} of $z=a + bi$.
By the above exercise, we get a real number after multiplying a complex number by it's conjugate which is an extremely useful fact.

\begin{example}
		Complex conjugates are useful when dividing complex numbers. To simplify a fraction, we multiply and divide by the complex conjugate of the denominator.
		\begin{align*}
			\dfrac{a+bi}{c+di}
			&=
			\dfrac{a+bi}{c+di} \cdot	\dfrac{c - di}{c-di}\\
			&=
			\dfrac{(a+bi)(c - di)}{c^2+d^2} & \mbox{ by Exercise \eqref{q:complex_conjugate}}\\\
			&=
			\dfrac{(ac + bd) + i(-ad + bc)}{c^2+d^2} \\
			&=
			\dfrac{ac + bd}{c^2+d^2}
			+
			i\cdot \dfrac{-ad + bc}{c^2+d^2}
		\end{align*}
\end{example}

\begin{exercise}
	Find the real and imaginary parts of the following complex numbers:
	\begin{multicols}{2}
		\begin{enumerate}
			\item $(2-3i)(i)$
				\item $(2-3i)(1+i)$
					\item $\dfrac{1}{i}$
						\item $\dfrac{1}{1+i}$
							\item $\dfrac{2-3i}{i}$
								\item $\dfrac{2-3i}{1+i}$
		\end{enumerate}
	\end{multicols}
\end{exercise}

\subsubsection{Euler's Identity}
It is possible to extend trigonometric and exponential functions (but not logarithms) to complex numbers.
These functions have the same derivatives and integrals as in the real case.
The following {\bf Euler's Identity} establishes a deep connection between trigonometric and exponential functions.
\begin{theorem}[Euler's identity]
\begin{align*}
		e^{i \theta} = \cos \theta + i \sin \theta
\end{align*}
for all real numbers $\theta$.
\end{theorem}
The proof of this theorem requires us to extend the entire theory of calculus to complex numbers (called complex analysis) and is beyond the scope of this class.
We'll simply use it as a fast method of (re)deriving several trig identities, and later on for doing integrals computations.

\begin{example}
	We know that
	\begin{align*}
		&& e^{i \theta} \cdot e^{-i \theta} &= e^0
	\end{align*}
	Simplifying the left hand side we get,
	\begin{align*}
		\Rightarrow
		&&
		(\cos \theta + i \sin \theta) \cdot (\cos (-\theta) + i \sin (-\theta)) &= e^0  \\
		\Rightarrow
		&&
		(\cos \theta + i \sin \theta) \cdot (\cos \theta - i \sin \theta) &= 1  \\
		\Rightarrow &&
		\cos^2 \theta + \sin^2 \theta
		&= 1 & \mbox{ by \eqref{q:complex_conjugate}}
	\end{align*}
	which is the fundamental identity of trigonometric functions.
	(In the above derivation we used the fact that $\cos(-\theta) = \cos \theta$ and $\sin (-\theta) = - \sin \theta$.)
\end{example}

\begin{exercise}
	Using Euler's identity and
	\begin{align*}
		\left(e^{i \theta}\right)^2 = e^{2i \theta}
	\end{align*}
	find the formulae for $\cos 2 \theta$ and $\sin 2 \theta$. (These are called the {\bf double angle formulae}.)
\end{exercise}

\begin{exercise}
	\begin{enumerate}
		\item
		Using Euler's identity and
		\begin{align*}
			e^{i x} \cdot e^{i y}  = e^{i (x + y)}
		\end{align*}
		find the formulae for $\cos (x + y)$ and $\sin (x + y)$.
		\item
		Using Euler's identity and
		\begin{align*}
			e^{i x} \cdot e^{-i y}  = e^{i (x - y)}
		\end{align*}
		find the formulae for $\cos (x - y)$ and $\sin (x - y)$.
	\end{enumerate}
\end{exercise}

\begin{exercise}
	Using the previous exercise, show that
 \begin{align*}
		 2 \cos x \cos y &= \cos (x-y) + \cos(x+y) \\
	 2 \sin x \sin y &= \cos (x-y) - \cos(x+y)\\
		2 \sin x \cos y &= \sin (x-y) + \sin(x+y)
 \end{align*}
\end{exercise}

We'll now apply these identities to compute some definite integrals.
In later sections, we'll use these to compute indefinite integrals  such as $\int e^{ax} \sin {bx} \: dx$.

\begin{exercise}
	Let $n$ be an integer.
	\begin{enumerate}
		\item Draw graphs of
		\begin{align*}
			\sin x, \sin (-x), \sin 2x, \sin (-2x), \\
			\cos x, \cos (-x), \cos 2x, \cos (-2x),
		\end{align*} for $ -\pi \le x \le \pi$.
		\item Geometrically argue that
		\begin{align*}
			\int_{-\pi}^{\pi} \cos (nt) \: dt &=
			\begin{cases}
				0 & \mbox{ if } n \neq 0 \\
				2 \pi & \mbox{ if } n = 0
			\end{cases}
		\end{align*}
		\item Geometrically argue that
		\begin{align*}
			\int_{-\pi}^{\pi} \sin (nt) \: dt &= 0
		\end{align*}
		\item Why do we need to make two cases for $\cos x$ but not for $\sin x$?
	\end{enumerate}
\end{exercise}

\begin{exercise}
	Let $m$ and $n$ be positive integers. Using the previous two exercises, show that
		\begin{align*}
			 \int_{-\pi}^{\pi} \cos (nt) \cos (mt) \: dt
			 &=
			 \begin{cases}
			 	0 & \mbox{ if } m \neq n \\
 			 	\pi & \mbox{ if } m = n
			 \end{cases} \\
			 \int_{-\pi}^{\pi} \sin (nt) \sin (mt) \: dt
			 &=
			 \begin{cases}
				0 & \mbox{ if } m \neq n \\
				\pi & \mbox{ if } m = n
			 \end{cases} \\
			 \int_{-\pi}^{\pi} \cos (nt) \sin (mt) \: dt
			 &=
			 0
		\end{align*}
\end{exercise}
These integrals are the foundational identities for Fourier analysis, which is one of the most powerful mathematical theories emerging out of elementary calculus.

% \begin{exercise} Verify that
% 	\begin{align*}
% 			\cos \theta &= \dfrac{e^{i \theta} + e^{-i \theta}}{2} \\
% 					\sin \theta &= \dfrac{e^{i \theta} - e^{-i \theta}}{2i}
% 	\end{align*}
% \end{exercise}
%
% \begin{exercise}
% 	Compute the indefinite integrals
% 	\begin{align*}
% 		\int
% 	\end{align*}
% \end{exercise}


\documentclass[12pt, letterpaper, onside]{article}
\usepackage[affil-it]{authblk} % author institution
\usepackage{amsmath} % math
\usepackage{amssymb} % math symbol
\usepackage[backend=biber]{biblatex}
\usepackage{graphicx}

\addbibresource{reference.bib}

\newtheorem{definition}{Definition}[section]
\newtheorem{theorem}{Theorem}[section]

\newcommand
{\point}
[1]
{\left(#1\right)}

\newcommand
{\twoFunc}
[1]
{#1\point{x, y}}

\newcommand
{\derv}
{\mathrm{d}}

\newcommand
{\fd} % [f]irst [d]erivative
[3]
{\frac{\derv#1}{\derv#2}\point{#3}}

\newcommand
{\sd} % [s]econd [d]erivative
[3]
{\frac{\derv^{2}#1}{\derv#2^{2}}\point{#3}}

\newcommand
{\fpd} % [f]irst [p]artial [d]erivative
[3]
{\frac{\partial{#1}}{\partial{#2}}\point{#3}}

\newcommand
{\spd} % [s]econd [p]artial [d]erivative
[4]
{\frac{\partial}{\partial{#3}} \left(\frac{\partial{#1}}{\partial{#2}}\right) \point{#4}}

\newcommand
{\appCon} % h and k approach condition
[2]
{\text{if } h \to 0^{#1} \text{ and } k \to 0^{#2}}

\newcommand
{\counterFunc}
{
\begin{equation*}
    \twoFunc{f} =
    \begin{cases}
        \twoFunc{\phi} & \text{if }x = 2y\text{,}\\
        \twoFunc{\psi} & \text{otherwise}\text{;}
    \end{cases}
\end{equation*}
where
\begin{align*}
    \twoFunc{\phi} &= x^{2} + y^{2} - 8x - 4y + 10\text{,}\\
    \twoFunc{\psi} &= x^{2} + y^{2} - 4x - 2y
\end{align*}
}

\newcommand
{\mat}
[1]
{\mathrm{#1}}

\newcommand
{\df} % [d]irectional [f]unction
[1]
{\xi_\vec{#1}}

\newcommand
{\R}
{\mathbb{R}}

\newcommand
{\itvec} % [i]nline 2d [vec]tor *inkscape*
[2]
{\left[\begin{array}{c}#1\\#2\end{array}\right]}

\newcommand
{\dirgraph} % [d]irection annotation for [graph] at (x, y) = (2, 1) *inkscape*
[2]
{\itvec{x}{y} = \itvec{2}{1} + k\itvec{#1}{#2}}

\newcommand
{\hess}
{\mathrm{Hess} \ f_{\point{2, 1}}}

\newcommand
{\hessDet}
{\lvert\hess\rvert}

\renewcommand{\vec}{\mathbf}
\renewcommand{\Rn}{\mathbb{R}^n}

\title{\textbf{Ridge Problem in Stochastic Gradient Descent: An Analytical Solution}}
\author{Tran Phong Binh\thanks{Email: \texttt{phongbinh2511@gmail.com}}}
\affil{Department of Computer Science, National Tsing Hua University}
\date{\today}

\begin{document}

\maketitle

\begin{abstract}
% TODO
\end{abstract}

\section{Introduction}
The second partial derivative test is a renowed technique for determining local extremum points. This mathematical method had been well studied since the beginning era of calculus, and has been used extensively both in the academia and in real-world applications. Yet, upon studying the ridge problem of hill climbing\cite{ridge}, we stumbled on a thought that the same issue could present in the forementioned test under a stochastic space setup.

In this work, we prove that such problem exists, proposing an analytical solution, and check our approach on two multivariable functions. We hope our finding further pushes knowledge boundaries of stochastic gradient descent in specific, and optimization in general. With this, researchers and practitioners can now surpass false local extremum points to navigate down true local optimization objectives, consolidating the robustness of their theories and systems.

\section{Proof}
We prove that ridge problem presents in the second partial derivative test by analyzing the multivariable function
\counterFunc
at point $\point{2, 1}$.

\subsection{First Partial Derivatives}
We begin by examining the first derivatives of $f$ at point $\point{2, 1}$. Firstly, it is given that
\begin{equation*}
    \fpd{f}{x}{2, 1} = \lim_{h \to 0}{\frac{f\point{2 + h, 1} - f\point{2, 1}}{h}}\text{.}
\end{equation*}
Because the components on the numerator are
\begin{align*}
    f\point{2 + h, 1} & = \psi\point{2 + h, 1}\text{,}\\
        f\point{2, 1} & = \phi\point{2, 1}\\
                      & = -5\\
                      & = \psi\point{2, 1}\text{,}
\end{align*}
it holds that
\begin{align}
    \label{eq:proveSpd} % [prove] [s]econd [p]artial [d]erivatives
    \fpd{f}{x}{2, 1} & = \fpd{\psi}{x}{2, 1}\\
                     & = 2x - 4\nonumber\\
                     & = 0\text{.}\nonumber
\end{align}
Similarly,
\begin{align*}
    \fpd{f}{y}{2, 1} & = \fpd{\psi}{y}{2, 1}\\
                     & = 2y - 2\\
                     & = 0\text{.}
\end{align*}
Hence
\begin{equation}
    \label{zeroGradient}
    \nabla_{f}\point{2, 1} =
    \begin{bmatrix}
        0\\
        0
    \end{bmatrix}\text{.}
\end{equation}

\subsection{Second Partial Derivatives}
We then consider the second partial derivatives of our function at the same point.

\subsubsection{Second Partial Derivative With Respect To $x$}
We start with $f_{xx}\point{2, 1}$:
\begin{equation}
    \label{eq:fxxDef}
    \spd{f}{x}{x}{2, 1} = \lim_{h \to 0}{\frac{\fpd{f}{x}{2 + h, 1} - \fpd{f}{x}{2, 1}}{h}}\text{.}
\end{equation}
Assessing the first component of the numerator
\begin{equation*}
    \fpd{f}{x}{2 + h, 1} = \lim_{k \to 0}{\frac{f\point{2 + h + k, 1} - f\point{2 + h, 1}}{k}}\text{,}
\end{equation*}
we observe that
\begin{align*}
    f\point{2 + h + k, 1} & =
    \begin{cases}
        \psi\point{2 + h + k, 1} & \appCon{-}{-}\text{,}\\
        \phi\point{2, 1} = -5 = \psi\point{2, 1} & \appCon{-}{+}\text{,}\\
        \phi\point{2, 1} = -5 = \psi\point{2, 1} & \appCon{+}{-}\text{,}\\
        \psi\point{2 + h + k, 1} & \appCon{+}{+}
    \end{cases}\\
    & = \psi\point{2 + h + k, 1}\text{,}
\end{align*}
and
\begin{equation*}
    f\point{2 + h, 1} = \psi\point{2 + h, 1}\text{.}
\end{equation*}
Therefore, our first entry of the forementioned numerator
\begin{equation}
    \label{eq:proveFxx}
    \fpd{f}{x}{2 + h, 1} = \fpd{\psi}{x}{2 + h, 1}\text{.}
\end{equation}
By equations \ref{eq:proveSpd} and \ref{eq:proveFxx}, our equation \ref{eq:fxxDef} becomes
\begin{align*}
    \spd{f}{x}{x}{2, 1} & = \spd{\psi}{x}{x}{2, 1}\\
                        & = 2\text{.}
\end{align*}

\subsubsection{Second Partial Derivative With Respect To $x$ Then $y$}
We continue by examining $f_{yx}\point{2, 1}$:
\begin{equation}
    \label{eq:fyxDef}
    \spd{f}{x}{y}{2, 1} = \lim_{h \to 0}{\frac{\fpd{f}{x}{2, 1 + h} - \fpd{f}{x}{2, 1}}{h}}\text{.}
\end{equation}
Again, we assess the first component of the numerator
\begin{equation*}
    \fpd{f}{x}{2, 1 + h} = \lim_{k \to 0}{\frac{f\point{2 + k, 1 + h} - f\point{2, 1 + h}}{k}}\text{.}
\end{equation*}
Analogous to $f_{xx}\point{2, 1}$, we learn that
\begin{align*}
    f\point{2 + k, 1 + h} & =
    \begin{cases}
        \psi\point{2 + k, 1 + h} & \appCon{-}{-}\text{,}\\
        \psi\point{2 + k, 1 + h} & \appCon{-}{+}\text{,}\\
        \psi\point{2 + k, 1 + h} & \appCon{+}{-}\text{,}\\
        \psi\point{2 + k, 1 + h} & \appCon{+}{+}
    \end{cases}\\
    & = \psi\point{2 + k, 1 + h}\text{,}
\end{align*}
and
\begin{equation*}
    f\point{2, 1 + h} = \psi\point{2, 1 + h}\text{.}
\end{equation*}
Thus
\begin{equation}
    \label{eq:proveFyx}
    \fpd{f}{x}{2, 1 + h} = \fpd{\psi}{x}{2, 1 + h}\text{.}
\end{equation}
By equations \ref{eq:proveSpd} and \ref{eq:proveFyx}, our equation \ref{eq:fyxDef} becomes
\begin{align*}
    \spd{f}{x}{y}{2, 1} & = \spd{\psi}{x}{y}{2, 1}\\
                        & = 0\text{.}
\end{align*}

\subsubsection{Hessian Matrix}
Performing similar deductions for $f_{xy}\point{2, 1}$ and $f_{yy}\point{2, 1}$, we get
\begin{align*}
    f_{xx}\point{2, 1} & = 2\text{,}\\
    f_{yx}\point{2, 1} & = 0\text{,}\\
    f_{xy}\point{2, 1} & = 0\text{,}\\
    f_{yy}\point{2, 1} & = 2\text{.}
\end{align*}
As a result, the Hessian determinant at point $\point{2, 1}$
\begin{align*}
    \hessDet & = f_{xx}\point{2, 1}f_{yy}\point{2, 1} - f_{yx}\point{2, 1}f_{xy}\point{2, 1}\\
      & = 4\text{.}
\end{align*}
Since $f_{xx}\point{2, 1} > 0$ and $\hessDet > 0$,
\begin{equation}
    \label{positiveDetH}
    \hess \succ 0\text{.}
\end{equation}

\subsection{Second Partial Derivative Test Contradiction}
According to \cite{secondDerivativeTest}, by equations \ref{zeroGradient} and \ref{positiveDetH}, we shall conclude $(2, 1)$ is a local minimum point. However, this is incorrect, as for $h \in \R$, $h \to 0^{+}$:
\begin{align}
    f\point{2 + 2h, 1 + h} & = \phi\point{2 + 2h, 1 + h}\\
                           & < \phi\point{2, 1} = f\point{2, 1}
\end{align}
That is, $\point{2, 1}$ is not a local minimum point (proof in appendix). % TODO appendix

\section{Intuition}
\begin{figure}[h]
    \centering
    \def\svgwidth{0.6\textwidth}
    \input{f_graph.pdf_tex}
    \caption{Partial graph of the function $\twoFunc{f}$}
    \label{fig:f}
\end{figure}

Considering our function's graph depicted in Figure \ref{fig:f} at point $\point{2, 1}$, we observe that the first derivatives in the $x$ and $y$ directions are zeroes, making the zero gradient. Furthermore, the curvature of the function is up in all directions at the point of interest, indicating the positive definite Hessian. With this premise, the second partial derivative test concludes that $\point{2, 1}$ is a local minimum point.

However, this is analytically and visually false. Even though the curvature along the $\vec{v} = \point{4, 2}$ direction is up, the corresponding first derivative differs from zero, invalidating the second partial derivative test.

\section{Solution}
For the tangent hyperplane of a multivariable function at a point to be flat, it is not enough for the gradient of the function at that point to be the zero vector, but the first derivatives of the function at the point of interest must equal to zero in all directions.

In this work, we provide an analytical solution to this issue by redefining what it takes for the tangent hyperplane of a function at a point to be flat. Firstly, we define the concept of directional function:
\begin{definition}
    Given a multivariable function
    \begin{align*}
        f \colon \Rn & \longrightarrow \R\\
                        \vec{x} & \longmapsto f\point{\vec{x}}
    \end{align*}
    where $\vec{x} = \point{x_{1}, x_{2}, \dots, x_{n}}$. For a direction\footnote{We exclude the vector $\vec{0}$ from all of our discussions on directional function.} $\vec{v} \in \Rn$, the directional function of $f$ at point $\vec{x_{0}}$ is the single variable function
    \begin{align*}
        \df{v} \colon \R & \longrightarrow \R\\
                                    k & \longmapsto f\point{\vec{x_{0}} + k\vec{v}}
    \end{align*}
\end{definition}
We are now ready to redefine flat tangent hyperplane:
\begin{definition}
    Given a multivariable function $f$, its tangent hyperplane is flat at point $\vec{x_{0}}$ iff for all directions $\vec{v} \in \Rn$, the directional function $\df{v}$ at that point has zero first derivative at $k = 0$ i.e.\ iff $\forall \vec{v} \in \Rn \colon \fd{\df{v}}{k}{0} = 0$.
\end{definition}
From this definition, we can derive our new local mininimum test:
\begin{theorem}
    \label{th:localMin}
    Given a multivariable function $f$, if its tangent hyperplane is flat at point $\vec{x_{0}}$, and for all directions $\vec{v} \in \Rn$, the directional function $\df{v}$ at that point has positive second derivative at $k = 0$ i.e.\ if $\forall \vec{v} \in \Rn \colon \fd{\df{v}}{k}{0} = 0 \land \sd{\df{v}}{k}{0} > 0$, then $\vec{x_{0}}$ is a local minimum point.
\end{theorem}

\subsection{False Local Minimum}
We revisit our first example to see if the test works:
\counterFunc
For the direction $\vec{v} = \point{4, 2}$, our directional function at $\vec{x_{0}} = \point{2, 1}$ is
\begin{align}
    \df{v}\point{k} & = f\point{\vec{x_{0}} + k\vec{v}}\\
    & = f\point{
    \begin{bmatrix}
        2\\
        1
    \end{bmatrix}
    + k
    \begin{bmatrix}
        4\\
        2
    \end{bmatrix}
    }\\
    & = f\point{
    \begin{bmatrix}
        2 + 4k\\
        1 + 2k
    \end{bmatrix}
    } \text{ or } f\point{2 + 4k, 1 + 2k}
\end{align}
Since $x = 2y$,
\begin{align}
    \df{v}\point{k} & = \phi\point{2 + 4k, 1 + 2k}\\
    & = \left(2 + 4k\right)^{2} + \left(1 + 2k\right)^{2} - 8\left(2 + 4k\right) - 4\left(1 + 2k\right) + 10\\
    & = 4 + 16k + 16k^{2} + 1 + 4k + 4k^{2} - 16 - 32k - 4 - 8k + 10\\
    & = 20k^{2} - 20k - 5
\end{align}
We examine the directional function's first derivative at $k = 0$:
\begin{align}
    \fd{\df{v}}{k}{0} & = 40k - 20\\
    & = -20 \neq 0
\end{align}
Hence $\vec{x_{0}} = (2, 1)$ is not a local minimum point!

\subsection{True Local Minimum}
We consolidate our test with the well-known function
\begin{equation}
    f\point{\vec{x}} = \vec{x}^{\intercal}\mat{A}\vec{x}
\end{equation}
where $\underset{n \times n}{\mat{A}} \succ 0$. For any directions $\vec{v} \in \Rn$, our directional function at $\vec{x_{0}} = \vec{0}$ is
\begin{align}
    \df{v}\point{k} & = f\point{\vec{x_{0}} + k\vec{v}}\\
    & = \left(k\vec{v}\right)^{\intercal}\mat{A}\left(k\vec{v}\right)\\
    & = k^{2}\vec{v}^{\intercal}\mat{A}\vec{v}
\end{align}
We examine the directional function's first derivative at $k = 0$:
\begin{align}
    \fd{\df{v}}{k}{0} & = 2k\vec{v}^{\intercal}\mat{A}\vec{v}\\
    & = 0
\end{align}
Furthermore,
\begin{equation}
    \sd{\df{v}}{k}{0} = 2\vec{v}^{\intercal}\mat{A}\vec{v}
\end{equation}
Since $\mat{A} \succ 0$, $\forall \vec{v} \neq \vec{0} \colon \vec{v}^{\intercal}\mat{A}\vec{v} > 0$. Thus, our directional function's second derivative is positive. According to Theorem \ref{th:localMin}, $\vec{x_{0}} = \vec{0}$ is a local minimum point!

\section{Conclusion}

\section{Future Work}

\printbibliography

\end{document}


\section{Homomorphisms}
\begin{definition}
    For groups $G,H$, a map $\phi:H\to G$ is called a homomorphism $H\to G$ if
    $$\phi(h_1h_2)=\phi(h_1)\phi(h_2)$$
    for any $h_1,h_2\in H$.\\
    If $\phi$ is a bijection as well, then it is called an isomorphism.
    In this case, we say $G,H$ are isomorphic.
\end{definition}
\begin{example}
    1. For any $H,G$, the function $f$ defined by $f(h)=e$ for any $h\in H$ is a homomorphism.\\
    2. If $H\le G$, the inclusion map is a homomorphism.\\
    3. Let $n|m$, the map $z\mapsto z^{m/n}$ is a homomorphism between $C_n\to C_m$.\\
    4. The exponential function $\exp:\mathbb R\to\mathbb R_{>0}$ is a homomorphism $(\mathbb R,+,0)\to(\mathbb R_{>0},\times,1)$.\\
    5. The determinant function $\det:\operatorname{Gl}_n(\mathbb R)\to\mathbb R\setminus\{0\}$ under multiplication.
\end{example}
\begin{lemma}
    If $\phi:H\to G$ is a homomorphism, then\\
    1. $\phi(e_H)=e_G$ where $e_H$ is the identity of $H$ and $e_G$ the identity of $G$.\\
    2. $\forall a\in G,\phi(a^{-1})=\phi(a)^{-1}$
\end{lemma}
\begin{proof}
    1. Consider $e^2=e$ where $e$ is the identity of any group, so
    $$\phi(e_H)^2=\phi(e_H^2)=\phi(e_H)\implies \phi(e_H)=e_G$$
    2. we have
    $$e_G=\phi(aa^{-1})=\phi(a)\phi(a^{-1})\implies \phi(a^{-1})=\phi(a)^{-1}$$
    as desired.
\end{proof}
It also follows easily from definitions that compositions of homomorphisms is a homomorphism.
\begin{definition}
    Let $\phi:H\to G$ be a homomorphism, then the image of $\phi$ is defined as
    $$\operatorname{Im}\phi=\{g\in G:\exists h\in H, \phi(h)=g\}$$
    The kernel of $\phi$ is defined as
    $$\ker\phi=\{h\in H:\phi(h)=e_G\}$$
    where $e_G$ is the identity of $G$.
\end{definition}
\begin{proposition}
    $\operatorname{Im}\phi\le G,\ker\phi\le H$.
\end{proposition}
\begin{proof}
    For the first part, suppose that $a,b\in\operatorname{Im}\phi$, then suppose that $\phi(h_1)=a,\phi(h_2)=b$, we have $ab^{-1}=\phi(h_1h_2^{-1})\in\operatorname{Im}\phi$.\\
    For the second part, suppose $a,b\in\ker\phi$, then $\phi(ab^{-1})=e_Ge_G^{-1}=e_G$ where $e_G$ is the identity of $G$.
    So $ab^{-1}\in\ker\phi$.\\
    It is also immediate that both of them are nonempty, as $e_H\in\ker\phi,e_G\in\operatorname{Im}\phi$.
\end{proof}
\begin{proposition}
    A homomorphism is an isomorphism if and only if its kernel is the subgroup consisting of only the idenity of the domain and that its image is the entire codomain.
\end{proposition}
\begin{proof}
    Take a homomorphism $\phi: H\to G$.
    If it is an isomorphism then the condition is immediate.\\
    Conversely, since $\operatorname{Im}\phi=G$, $\phi$ is surjective.
    At the same time, if $\phi(h_1)=\phi(h_2)$ for some $h_1,h_2\in H$, then
    $$\phi(h_1h_2^{-1})\in\ker\phi\implies h_1h_2^{-1}=e_H\implies h_1=h_2$$
    where $e_H$ is the identity of $H$.
    So it is also injective, it follows that it is a bijection, therefore it is an isomorphism.
    \footnote{Alternatively, like the lecturer did, we can construct an explicit inverse, which is not as clean as this approach in the author's opinion.}
\end{proof}
Note as well that an inverse of an isomorphism is again an isomorphism.
The proof to this is trivial.


\section{Order of Magnitude and Taylor's Theorem}
\subsection{Asymptopic Behaviour}
When we want to analyze the difference between functions, apart from their analytical properties, we would also be interested in the difference between their magnitudes.
The following notion arrives to serve this purpose
\begin{definition}[Little-$o$ notation]
    Let $f, g$ be real functions and $x_0\in\bar{\mathbb R}=\mathbb R\cup\{\pm\infty\}$, we say that $f(x)=o(g(x))$ as $x\to x_0$ if
    $$\lim_{x\to x_0}\frac{f(x)}{g(x)}=0$$
\end{definition}
\begin{definition}[Big-$O$ notation]
    Let $f, g$ be real functions and $x_0\in\mathbb R$, we say that $f(x)=O(g(x))$ as $x\to x_0$ if $\exists\delta,M>0$ such that
    $$|x-x_0|<\delta\implies |f(x)|\le M|g(x)|$$
    We say $f(x)=O(g(x))$ as $x\to\infty$ if $\exists x_1,M>0$ such that
    $$x>x_1\implies |f(x)|\le M|g(x)|$$
    We say $f(x)=O(g(x))$ as $x\to-\infty$ if $\exists x_1<0,M>0$ such that
    $$x<x_1\implies |f(x)|\le M|g(x)|$$
\end{definition}
\begin{remark}
    Remember that the equality sign of $f(x)=o(g(x))$ or $f(x)=O(g(x))$ is not really the usual equality sign we use.
    It is more like $f(x)\in o(g(x))$ or $f(x)\in O(g(x))$, meaning that $f$ is one of those functions having this property on its magnitude.
    The reason why we use the equality sign here is that we sometimes use the notations to denote \textit{some} functions having this property, which we do not (need to) know any detail except its magnitude.
\end{remark}
\begin{example}
    We have $x^2=o(x)$ as $x\to0$ and $x^2=O(x)$ as $x\to0$. In fact, whenever $f(x)=o(g(x))$ as $x\to x_0$ we have $f(x)=O(g(x))$ as $x\to x_0$ as well. The proof again is just checking definitions.
\end{example}
Now, one of the most significant usage of the measurement of magnitude is that we can use it to approximate the rest of the terms in a series.
For example, if we take the series $1+x+x^2+x^3+\ldots$, we can replace it by $1+x+x^2+x^3+o(x^3)$, in which way one can include information about the magnitude of the error term of the series.
\subsection{Taylor Series}
The idea of the Taylor series is to locally approximate a smooth enough function by polynomials.
Surely, most functions have much worse analytical properties then polynomials, making it slightly problematic to analyze some of their properties.
Taylor series provides a solution.
Basically, we start by assuming a local approximation of the function by a polynomial.
Say $f(x)\approx a_0+a_1x+a_2x^2+\cdots+a_nx^n$, then, by differentiating both sides recursively, we immediately have $a_n=f^{(n)}(0)/n!$.
The polynomial, which we will call $P_{n,0}(x)$, is called the Taylor polynomial.
In general, if we shift the polynomial by $x_0$, we have the general form:
\begin{definition}
    The Taylor polynomial $P_{n,x_0}(x)$ of a function $f$ around a point $x_0$ is the polynomial
    $$\sum_{k=0}^{n}\frac{f^{(k)}(x_0)(x-x_0)^k}{k!}$$
\end{definition}
Now the big question is, we have (quite vaguely) obtained the form of the sequence of polynomials that looks as if it can approximate $f$ as $n$ is big enough.
But does it?
Obviously unless $f$ is a polynomial as well it has no chance that the polynomial will be equal to $f$, but what can we say about the magnitude of the error term?
Taylor's theorem saves the day.
\begin{theorem}[Taylor's theorem]
    Write $h=x-x_0$.
	Provided that $f^{(n+1)}$ exists, then
    $$E_{n,x_0}(x)=f(x)-P_{n,x_0}(x)=O(h^{n+1})$$
    as $h\to 0$.
\end{theorem}
Actually $E_{n,x_0}=o(h^n)$ as $h\to 0$ as well but the big-$O$ here is stronger.
\subsection{L'Hopital's Rule}
\begin{theorem}
    If $f(x)$ and $g(x)$ are both differentiable at $x=x_0\in\bar{\mathbb R}$, and that $f,g$ are both continuous at $x_0$ and $f(x_0)=g(x_0)=0$, then
    $$\lim_{x\to x_0}\frac{f(x)}{g(x)}=\lim_{x\to x_0}\frac{f^\prime(x)}{g^\prime(x)}$$
\end{theorem}
\begin{proof}
    The little-$o$ notations below are taken as $x\to x_0$.
    $$f(x)=f(x_0)+(x-x_0)f^\prime(x_0)+o(x-x_0), g(x)=g(x_0)+(x-x_0)g^\prime(x_0)+o(x-x_0)$$
    by Taylor's theorem.
    $$\frac{f(x)}{g(x)}=\frac{f^\prime(x_0)+o(x-x_0)/(x-x_0)}{g^\prime(x_0)+o(x-x_0)/(x-x_0)}\to \frac{f^\prime(x_0)}{g^\prime(x_0)}$$
    as $x\to x_0$.
\end{proof}
Note that we can use L'Hopital's rule recursively given that the conditions still hold.


\section{Additional Exercises}\label{sec:MoreReviewExercises}

\Opensolutionfile{solutions}[ex]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{enumialphparenastyle}

These problems require a comprehensive knowledge of the skills reviewed in
this chapter. They are not in any particular order. A proficiency in these
skills will help you a long way as your learn the calculus material in the
following chapters.

\begin{multicols}{2}
%%%%%%%%%%
\begin{ex}
Rationalize the denominator for each of the
following expressions. That is, re-write the expression in such a way that
no square roots appear in the denominator. Also, simplify your answers if
possible.
\begin{enumerate}
		\item	$\dfrac{1}{\sqrt{2}}$
	\item	$\dfrac{3h}{\sqrt{x+h+1}-\sqrt{x+1}}$
\end{enumerate}
\begin{sol}
\begin{enumerate}
	\item	$\dfrac{\sqrt{2}}{2}$
	\item	$3(\sqrt{x+h+1}+\sqrt{x+1})$
\end{enumerate}
\end{sol}
\end{ex}

%%%%%%%%%%
\begin{ex}
Solve the following equations.
\begin{enumerate}
		\item	$2-5(x-3)=4-10x$
	\item	$2x^2-5x=3$
	\item	$x^2-x-3=0$
	\item	$x^2+x+3=0$
	\item	$\sqrt{x^2+9}=2x$
\end{enumerate}
\begin{sol}
\begin{enumerate}
	\item	$-13/5$
	\item	$-1/2,3$
	\item	$(1\pm\sqrt{13})/2$
	\item	No real solutions
	\item	$\sqrt{3}$
\end{enumerate}
\end{sol}
\end{ex}

%%%%%%%%%%
\begin{ex}
By means of counter-examples, show why it is wrong
to say that the following equations hold for all real numbers for which the
expressions are defined.
\begin{enumerate}
		\item	$(x-2)^2=x^2-2^2$
	\item	$\dfrac{1}{x+h}=\dfrac{1}{x}+\dfrac{1}{h}$
	\item	$\sqrt{x^2+y^2}=x+y$
\end{enumerate}
\begin{sol}
Counter-examples may vary.
\begin{enumerate}
	\item	$x=3$
	\item	$x=h=1$
	\item	$x=y=1$
\end{enumerate}
\end{sol}
\end{ex}

%%%%%%%%%%
\begin{ex}
Find an equation of the line passing through the
point $(-2,5)$ and parallel to the line $x+3y-2=0$.
\begin{sol}
	$x+3y-13=0$, or equivalents such as $y=-\frac{1}{3}x+\frac{13}{3}$
\end{sol}
\end{ex}

%%%%%%%%%%
\begin{ex}
Solve $\dfrac{x^2-1}{3x-1}\leq 1$.
\begin{sol}
	$(-\infty,0]\cup(\frac{1}{3},3]$
\end{sol}
\end{ex}

%%%%%%%%%%
\begin{ex}
Explain why the following expression never
represents a real number (for any real \\
number $x$). \\
$$\sqrt{x-2}+\sqrt{1-x}$$
\begin{sol}
	It is impossible for both $x-2$ and $1-x$ to be non-negative
	for the same real number $x$.
\end{sol}
\end{ex}

%%%%%%%%%%
\begin{ex}
Simplify the expression \\
$$\dfrac{\left( \, 3(x+h)^2+4 \, \right)-\left( \, 3x^2+4 \, \right) }{h}$$
 as much as possible.
\begin{sol}
	$6x+3h$
\end{sol}
\end{ex}

%%%%%%%%%%
\begin{ex}
Simplify the expression \\
$$\ds{\frac{\frac{x+h}{2(x+h)-1}-\frac{x}{2x-1}}{h}}$$
 as much as possible.
\begin{sol}
	$-1/\left[(2x+2h-1)(2x-1)\right]$
\end{sol}
\end{ex}

%%%%%%%%%%
\begin{ex}
Simplify the expression \\
$$\ds{-\sin x(\cos x+3\sin x)-\cos x(-\sin x+3\cos x)}$$
\begin{sol}
	$-3$
\end{sol}
\end{ex}

%%%%%%%%%%
\begin{ex}
Solve the equation $\,\, \cos x=\frac{\sqrt{3}}{2}$ on
the interval $0\leq x\leq 2\pi$.
\begin{sol}
	$\pi /6,$ $5\pi /6$
\end{sol}
\end{ex}

%%%%%%%%%%
\begin{ex}
Find an angle $\theta$ such that $0\leq\theta\leq\pi$ and $\cos\theta=\cos\frac{38\pi}{5}$.
\begin{sol}
	$2\pi/5$
\end{sol}
\end{ex}

%%%%%%%%%%
\begin{ex}
What can you say about \\
$$\ds{\dfrac{\left\vert x\right\vert+\left\vert 4-x\right\vert}{x-2}} $$
 when $x$ is a large
(positive) number?
\begin{sol}
	It is equal to 2 for all $x$ larger than 4.
\end{sol}
\end{ex}

%%%%%%%%%%
\begin{ex}
Find an equation of the circle with centre at $(-2,3)$ and passing through the point $(1,-1)$.
\begin{sol}
	$(x+2)^2+(y-3)^2=25$.
\end{sol}
\end{ex}

%%%%%%%%%%
\begin{ex}
Find the centre and radius of the circle described
by $\,\,x^2+y^2+6x-4y+12=3$.
\begin{sol}
	Centre is $(-3,2)$ and radius is 2.
\end{sol}
\end{ex}

%%%%%%%%%%
\begin{ex}
If $y=9x^2+6x+7$, find all possible values of $y$.
\begin{sol}
	$y$ could be any real number greater than or equal to 6.
\end{sol}
\end{ex}

%%%%%%%%%%
\begin{ex}
Simplify $\left(\dfrac{3x^2 y^3 z^{-1}}{18x^{-1}yz^3}\right)^2$.
\begin{sol}
	$x^6 y^4/(36z^8)$
\end{sol}
\end{ex}

%%%%%%%%%%
\begin{ex}
If $y=\dfrac{3x+2}{1-4x}$, then what is $x$ in
terms of $y$?
\begin{sol}
	$x=(y-2)/(3+4y)$
\end{sol}
\end{ex}

\vfill \null
\columnbreak
%%%%%%%%%%
\begin{ex}
Divide $x^2+3x-5$ by $x+2$ to obtain the
quotient and the remainder. Equivalently, find polynomial $Q(x)$
and constant $R$ such that
\[\frac{x^2+3x-5}{x+2}=Q(x)+\frac{R}{x+2}.\]
\begin{sol}
	$Q(x)=x+1$, $R=-7$
\end{sol}
\end{ex}

\end{multicols}

\end{enumialphparenastyle}