\chapter{Exponential and Logarithmic Functions}
\section{Exponential Functions}
An exponential function is a defined as any function, $f(x)$ such that the
independent variable $x$ is bound up somewhere in the exponent.  $f(x)=3^x$ is
an example of such a function:

\graph{3^x}

This classification of functions have a few simple properties:

\begin{itemize}
  \item{They are defined for all $x\in(-\infty,\infty)$}
  \item{Their range is: $(0, \infty)$}
  \item{They have intercepts at $(0,1)$}
  \item{They are increasing on their entire domain}
  \item{The $x$-axis serves as a horizontal asymptote}
  \item{They are smooth and continuous}
\end{itemize}

\subsection{Interest Functions}
These types of functions have applications in a few different areas.  For us, we
will be primarily concerned with manually and continually compouding interest:

\begin{itemize}
  \item{For $n$ compoundings per year: $A=P(1+\frac{r}{n})^{nt}$}
  \item{For coninuous compounding: $A=Pe^{rt}$}
\end{itemize}

\section{Logarithmic Functions}
The parent function of the logarithmic family is defined as follows:
\begin{equation}
  f(x)=\log_ax
\end{equation}

\graph{ln(x)}

\subsection{Properties of Logarithms}
\begin{itemize}
  \item{$\log_a1=0$}
  \item{$\log_a=1$}
  \item{$\log_aa^x=x$}
  \item{If $\log_ax=\log_ay$ then $x=y$}
\end{itemize}

\section{Properties of Logarithms}
A logarithm of any base $a$ can be represented as a quotient of two other
logarithms of base $b$, according to the following (Change of Base rule)
\begin{equation}
  \log_ax=\frac{\log_bx}{\log_ba}
\end{equation}

The product property states that you can expand a logarithm that is the product
of two numbers $u$ and $v$ into two logarithms that are added together, as in
the following generalization:
\begin{equation}
  \log_a(uv)=\log_au+\log_av
\end{equation}

The quotient property states what is already implied, that a logarithm
represented as a quotient of two numbers $u$ and $v$ can be expanded equally as
a an expression of two logarithms which get subtracted, as in the following
generalization:
\begin{equation}
  \log_a(\frac{u}{v})=\log_au-\log_av
\end{equation}

The power property is implied from the product rule.  You can expand out a power
wrapped up in a logarithm into a scalar that is multiplied to the logarithmic
expression, as in the following generalization:
\begin{equation}
  \log_au^n=n\log_au
\end{equation}

\section{Solving Logarithmic Functions}
You can apply the rules that have been previously explained in order to solve
for expressions bound up in logarithmic or exponential expressions.  The genral
case for solving these types of problems is explained below:

\begin{enumerate}
  \item{Reduce all variables that are bound in exponential expressions to
    loosely hanging variables that are included in logarithmic expressions}
  \item{Apply the three rules that are stated above}
  \item{Expand}
  \item{Simplify}
\end{enumerate}


% !TEX root = main.tex

%-------------------------------------------------
\section{Transformations}\label{sec:transfs}

Random variables can be transformed into other random variables, and the distribution of a transformed variable can be deduced from the distribution of the original variable. Transformations of discrete distributions are relatively straightforward: here we focus on transformations of continuous distributions.

Applying a transformation $g:\R\to\R$ to a random variable $X:\Omega\to\R$ involves the \emph{composition} of these two functions,
\[
\begin{array}{rlcl}
g(X) : 	& \Omega & \to 		& \R \\
		& \omega & \mapsto	& g\big[X(\omega)\big],
\end{array}
\]

This can be interpreted in two ways:
\ben
\it $g(X)$ is a random variable on the probability space $(\Omega,\prob)$;
\it $g$ is a random variable on the probability space $(\R,\prob_X)$,
\een
where $\prob_X$ is the distribution of $X$. Here we focus on the first interpretation with $Y=g(X)$ denoting the transformed variable.

%-----------------------------
\subsection{Support}
Many PDFs are non-zero only over certain subsets of $\R$. When we transform continuous distributions we need only consider these subsets, provided we ensure that those over which PDFs are zero are carried over correctly into the transformed space. For technical reasons, it is not quite enough to focus on the \emph{range} of the random variable in question: instead we must consider the smallest closed set that contains the range (a closed set is one that contains all its limit points). This is called the \emph{support} of the associated PDF.

\begin{definition}
The \emph{support} of an arbitrary function $h:\R\to\R$, denoted by $\supp(h)$, is the smallest closed set for which $h(x)=0$ for all $x\notin\supp(h)$.
\end{definition}

Let $Y = g(X)$ where $g:\R\to\R$ is a transformation, and let $f_X$ and $f_Y$ denote the PMFs/PDFs of $X$ and $Y$ respectively. The support of the transformed variable $Y = g(X)$ is given by
\[
\supp(f_Y) = \big\{g(x) : x\in\supp(f_X)\big\}.
\]
In fact, $\supp(f_Y)$ should be defined as the \emph{closure} of this set, which is obtained by adding in its limit points where necessary. We will not pursue such matters here.

%-----------------------------
\subsection{Linear transformations}

Let $X$ be a random variable and let $Y = aX + b$ where $a\neq 0$.

The CDF of of the transformed variable $Y$ can be expressed in terms of the CDF of $X$ as follows:
\[
F_Y(y)
	= \prob(Y\leq y)
	= \prob(aX+b\leq y)
	= \begin{cases}
		\displaystyle\prob\left(X\leq\frac{y-b}{a}\right) = \phantom{1 -\ } F_X\left(\frac{y-b}{a}\right)		& \text{if $a>0$,} \\[3ex]
		\displaystyle\prob\left(X>\frac{y-b}{a}\right)	 = 1 - F_X\left(\frac{y-b}{a}\right)	& \text{if $a<0$.}
	\end{cases}
\]
Using the chain rule, the PDF of $Y$ can then be expressed in terms of the PDF of $X$:
\smallskip
\[
f_Y(y) = \frac{d}{dy}F_Y(y) =
	\left\{
	\begin{array}{ll}
		\phantom{-}\displaystyle\frac{1}{a}f_X\left(\frac{y-b}{a}\right)	& \text{if $a>0$,} \\[3ex]
		-\displaystyle\frac{1}{a}f_X\left(\frac{y-b}{a}\right)				& \text{if $a<0$.}
	\end{array}
	\right\}
	= \frac{1}{|a|}f_X\left(\frac{y-b}{a}\right).
\]
% example: linear transf.
\begin{example}
Let $X\sim\text{Uniform}[0,1]$. Find the distribution of the random variable $Y = 3X + 7$.
\begin{solution}
Let $g(x) = 3x+7$ denote the transformation. The PDF of $X\sim\text{Uniform}[0,1]$ is
\[
f_X(x) = \begin{cases}
	1	& 0\leq x\leq 1 \\
	0	& \text{otherwise.}
\end{cases}
\]
First we see that $\supp(f_X)$ is transformed as follows:
\[
\supp(f_Y) = \{g(x) : x\in\supp(f_X)\} = \{3x+7 : x\in [0,1]\} = [7,10].
\]
From the above discussion,
\[
f_Y(y) = \displaystyle\frac{1}{3}f_X\left(\frac{y-7}{3}\right)
	= \begin{cases}
		1/3	& \text{if $7\leq y\leq 10$,} \\
		0	& \text{otherwise,}
	\end{cases}
\]
so $Y\sim\text{Uniform}[7,10]$. We see that the original distribution has been scaled by a factor of $3$ and shifted $7$ units to the right.
\end{solution}
\end{example}

These ideas can be extended to any one-to-one transformation of $X$.

%-----------------------------
\subsection{Transformations of CDFs}

\begin{theorem}\label{thm:transf_cdf}
If $g:\R\to\R$ is one-to-one over $\supp(f_X)$ the CDF of $Y=g(X)$ is
\[
F_Y(y) = \begin{cases}
F_X\big[g^{-1}(y)\big]		& \text{if $g$ is increasing, and} \\[1ex]
1 - F_X\big[g^{-1}(y)\big]	& \text{if $g$ is decreasing.}
\end{cases}
\]
\end{theorem}

\begin{proof}
\ben
\it If $g$ is increasing, $g(x)\leq y$ implies that $x\leq g^{-1}(y)$ so
\[
F_Y(y)
	= \prob(Y\leq y)
	= \prob\big[g(X)\leq y\big]
	= \prob\big[X\leq g^{-1}(y)\big]
	= F_X\big[g^{-1}(y)\big].
\]
\it If $g$ is decreasing, $g(x)\leq y$ implies that $x\geq g^{-1}(y)$ so
\begin{align*}
F_Y(y)
	= \prob(Y\leq y)
	= \prob\big[g(X)\leq y\big]
	& = \prob\big[X\geq g^{-1}(y)\big] \\
	& = 1 - \prob\big[X\leq g^{-1}(y)\big] \quad\text{(because $X$ is a continuous r.v.)}\\
	& = 1 - F_X\big[g^{-1}(y)\big].
\end{align*}
\een
\end{proof}

\begin{example}
Let $X\sim\text{Uniform}[0,1]$ and let $Y = -\displaystyle\frac{1}{\lambda}\log X$ where $\lambda>0$. Show that $Y\sim\text{Exponential}(\lambda)$ where $\lambda$ is a rate parameter.
\begin{solution}
The CDF and PDF of $X\sim\text{Uniform}[0,1]$ are, respectively,
\[\begin{array}{lcl}
F_X(x) = \begin{cases}
	0	& x < 0, \\
	x	& 0\leq x\leq 1 \\
	1	& x > 1
\end{cases}
& \text{and} &
f_X(x) = \begin{cases}
	1	& 0\leq x\leq 1 \\
	0	& \text{otherwise.}
\end{cases}
\end{array}\]
Let $g(x) = -\log x/\lambda$ denote the transformation. Because $\lambda>0$ we see that $\supp(f_X)$ is transformed to
\[
\supp(f_Y) = \{g(x) : x\in\supp(f_X)\} =\{-\log/\lambda : x\in[0,1]\} = [0,\infty).
\]
The transformation is strictly decreasing over $\supp(f_X)$, and its inverse is $g^{-1}(y) = e^{-\lambda y}$ over $\supp(f_Y)$. Hence, by Theorem~\ref{thm:transf_cdf},
\[
F_Y(y)
	= 1 - F_X\big[g^{-1}(y)\big]
	= 1 - F_X(e^{-\lambda y})
	= 1 - e^{-\lambda y} \quad\text{for}\quad y\geq 0.
\]
This is the CDF of the $\text{Exponential}(\lambda)$ distribution (where $\lambda$ is a rate parameter).
\end{solution}
\end{example}

%-----------------------------
\subsection{Transformations of PDFs}

\begin{theorem}\label{thm:transf_pdfs}
If $g:\R\to\R$ is one-to-one over $\supp(f_X)$ the PDF of $Y=g(X)$ is
\[
f_Y(y) = f_X\big[g^{-1}(y)\big]\left|\frac{d}{dy}g^{-1}(y)\right| %\quad\text{for all}\quad y\in \supp(f_Y).
\]
\end{theorem}

\begin{proof}
For clarity of notation, let $h(y)$ denote the inverse function $g^{-1}(y)$.
\ben
\it If $g$ is increasing then $F_Y(y) = F_X\big[g^{-1}(y)\big]$, so by the chain rule (and using the fact that $h$ is also increasing),
\begin{align*}
f_Y(y)
	= \frac{d}{dy} F_Y(y)
	& = \frac{d}{dy} F_X\big[h(y)\big] \\
	& = \frac{d}{dh(y)} F_X\big[h(y)\big]\cdot \frac{dh(y)}{dy} \\
	& = f_X\big[h(y)\big]\left|\frac{dh(y)}{dy}\right|, \text{\qquad\qquad because } \frac{dh(y)}{dy}>0\text{ over $\supp(f_Y)$.}
\end{align*}

\it If $g$ decreasing, $F_Y(y) = 1 - F_X\big[g^{-1}(y)\big]$, so by the chain rule  (and using the fact that $h$ is also decreasing),
\begin{align*}
f_Y(y)
	= \frac{d}{dy} F_Y(y)
	& = \frac{d}{dy} \big[1 - F_X[h(y)]\big] \\
	& = 0 - \frac{d}{dh(y)} F_X\big[h(y)\big]\cdot \frac{dh(y)}{dy} \\
	& = - f_X\big[h(y)\big] \frac{dh(y)}{dy} \\
	& = f_X\big[h(y)\big]\left|\frac{dh(y)}{dy}\right|, \text{\qquad\qquad because} \frac{dh(y)}{dy}<0\text{ over $\supp(f_Y)$.}
\end{align*}
\een
\end{proof}

% remark
\begin{remark}
The term $\left|\frac{d}{dy}g^{-1}(y)\right|$ in Theorem~\ref{thm:transf_pdfs} is a \emph{scale factor}, which ensures that $f_Y$ integrates to one.
\end{remark}

\begin{example}
Let $X$ be a continuous random variable with the following PDF,
\[
f_X(x) = \begin{cases}
	1/x^2	& \text{for $x > 1$,} \\
	0		& \text{otherwise.}
\end{cases}
\]
Find the PDF of $Y=1/X$.
\end{example}

\begin{solution}
Let $g(x) = 1/x$. Since $\supp(f_X)=[x,\infty)$, the support of $f_Y$ is
\[
\supp(f_Y) = \{g(x): x\in\supp(f_X)\} = \{1/x :x\in[0,\infty)\} = [0,1].
\]
The transformation is one-to-one over $\supp(f_X)$, and its inverse is $g^{-1}(y) = 1/y$ over $\supp(f_Y)$. Hence, by Theorem~\ref{thm:transf_pdfs}, the PDF of $Y$ is given by
\begin{align*}
f_Y(y)
	& = f_X\big[g^{-1}(y)\big]\left|\frac{d}{dy}g^{-1}(y)\right| \\
	& = f_X\left(\frac{1}{y}\right)\left|\frac{d}{dy}\left(\frac{1}{y}\right)\right| \\
	& = y^2 \left|-\frac{1}{y^2}\right|
	= \begin{cases}
		1	& \text{for } 0<y<1 \\
		0	& \text{otherwise.}
	\end{cases}
\end{align*}
Thus $Y\sim\text{Uniform}(0,1)$.
\end{solution}

%-----------------------------
\subsection{The probability integral transform}

What happens when a random variable is transformed using its own CDF?

\begin{theorem}%[The Probability Integral Transform]
Let $X$ be a continuous random variable, and suppose that the inverse of its CDF exists for all $x\in\R$. Then the random variable $U=F(X)$ has the uniform distribution on $[0,1]$.
\end{theorem}

\begin{proof}
Because $F(x)=P(X\leq x)$ is a CDF we know that $F(x)\in [0,1]$ for all $x\in\R$. In particular, $\prob(U<0)=0$ and $\prob(U>1)=0$. For $u\in[0,1]$, because the inverse $F^{-1}$ exists for all $x\in\R$ we have that
\begin{align*}
F_U(u) = P(U\leq u)
	& = P\big(F(X)\leq u\big) \\
	& = P\big(X\leq F^{-1}(u)\big) \\
	& = F\big(F^{-1}(u)\big) \\
	& = u,
\end{align*}
which is the CDF of the continuous uniform distribution on $[0,1]$.
\end{proof}

% corollary
\begin{corollary}
Let $F$ be a CDF whose inverse exists for all $x\in\R$, and let $U\sim\text{Uniform}[0,1]$. Then $F$ is the CDF of the random variable $X = F^{-1}(U)$.
\end{corollary}

Although it is difficult to generate truly random numbers, there are fast deterministic algorithms which generate numbers that are approximately random - such numbers are called \emph{pseudo-random numbers}. Many such algorithms can generate numbers that are approximately uniformly distributed in $[0,1]$. Using the probability integral transform we can convert these into pseudo-random numbers from other continuous distributions.

\ben
\it First we obtain a uniformly distributed pseudo-random number $u\in [0,1]$.
\it The number $x = F^{-1}(u)$ is then a pseudo-random number from the distribution $F$.
\een

% example:
\begin{example}
Given an algorithm which generates uniformly distributed pseudo-random numbers in the range $[0,1]$, show how to obtain a pseudo-random number from the exponential distribution having rate parameter $2$.
\begin{solution}
The CDF of the exponential distribution with rate parameter $2$ is
\[
F(x) = \begin{cases}
	1 - e^{-2x}	& x>0 \\
	0			& \text{otherwise.}
\end{cases}
\]
First we invert $F$:
\begin{align*}
u = 1 - e^{-2x}
	& \iff e^{-2x} = 1-u \\
	& \iff e^x = \frac{1}{\sqrt{1-u}} \\
	& \iff x = \log\left(\frac{1}{\sqrt{1-u}}\right)
\end{align*}
Then we generate a pseudo-random number $u$ from the $\text{Uniform}[0,1]$ distribution and
\[
x = \log\left(\frac{1}{\sqrt{1-u}}\right)
\]
which is a pseudo-random number from the $\text{Exponential}(\lambda)$ distribution.
\end{solution}
\end{example}

\begin{exercise}
\begin{questions}

\question % transf
Let $X\sim\text{Uniform}(-1,1)$. Find the CDF and PDF of $X^2$.

\begin{answer}
The PDF of $X$ is
\[
f_X(x) = \left\{\begin{array}{ll}
	1/2	& -1\leq x\leq 1 \\
	0	& \text{otherwise}
\end{array}\right.
\]
For $x\in[-1,1]$,
\[
\prob(X\leq x)
	= \int_{-\infty}^x f_X(t)\,dt
	= \int_{-1}^x \frac{1}{2}\,dt
	= \left[\frac{t}{2}\right]_{-1}^x
	= \frac{1}{2}(x+1).
\]
The CDF of $X$ is:
\[
F(x) = \left\{\begin{array}{ll}
	0				 	& x < -1, \\
	\frac{1}{2}(x+1) 	& -1\leq x\leq 1, \\
	1					& x > 1.
\end{array}\right.
\]
Let $Y=X^2$. For $0\leq y\leq 1$ we have
\begin{align*}
\prob(Y\leq y)
	= \prob(X^2\leq y)
	& = \prob(-\sqrt{y}\leq X\leq\sqrt{y}) \\
	& = \prob(X\leq\sqrt{y}) - \prob(X\leq-\sqrt{y}) \\
	& = \sqrt{y}.
\end{align*}
Hence the CDF of $Y$ is
\[
F_Y(y) = \left\{\begin{array}{ll}
	0		 	& y < 0, \\
	\sqrt{y} 	& 0\leq y\leq 1, \\
	1			& y > 1.
\end{array}\right.
\]
and the PDF of $Y$ is
\[
f_Y(y) = \left\{\begin{array}{ll}
\frac{1}{2}y^{-1/2}	& 0\leq y\leq 1, \\
0					& \text{otherwise}.
\end{array}\right.
\]
\end{answer}

\question % transf
Suppose that $X$ has the exponential distribution with rate parameter $\lambda>0$. (The PDF of $X$ is $f(x) = \lambda\exp(-\lambda x)$ for $x \geq 0$ and zero otherwise.)
%\[
%f(x) = \left\{\begin{array}{ll}
%	\lambda\exp(-\lambda x)	& \text{for } x \geq 0, \\
%	0						& \text{otherwise.}
%\end{array}\right.
%\]
Find the PDFs of $Y=X^2$ and $Z=e^X$.

\begin{answer}
\ben
\it % << (i)
The transformation $g(x)=x^2$ is one-to-one and increasing over $[0,\infty)$; its inverse function is
\[
g^{-1}(y) =  \sqrt{y},\text{\quad which has first derivative \quad} \frac{d}{dy}g^{-1}(y) = \frac{1}{2\sqrt{y}}.
\]

Since $\supp(f_X)=[0,\infty)$ it follows immediately that $\supp(f_Y)=[0,\infty)$.
\par
For $y>0$,
\[
f_Y(y)
	= f_X\big[g^{-1}(y)\big]\left|\frac{d}{dy}g^{-1}(y)\right|
	= \lambda\exp(\lambda\sqrt{y}) \left| \frac{1}{2\sqrt{y}}\right|
	= \frac{\lambda}{2\sqrt{y}}\exp(-\lambda\sqrt{y}).
\]
Hence the PDF of $Y=X^2$ is given by
\[
f_Y(y) = \left\{\begin{array}{ll}
	\displaystyle\frac{\lambda}{2\sqrt{y}}\exp(-\lambda\sqrt{y}) & y\geq 0, \\[2ex]
	0 & \text{otherwise}.
\end{array}\right.
\]

\it % << (ii)
The transformation $g(x)=e^x$ is one-to-one and increasing over $[0,\infty)$; its inverse function is
\[
g^{-1}(z) = \log y \text{\quad and\quad} \frac{d}{dy}g^{-1}(z) = \frac{1}{z}.
\]

Since $\supp(f_X)=[0,\infty)$ it follows immediately that $\supp(f_Z)=[1,\infty)$.
\par
For $z\geq 1$,
\[
f_Z(z)
	= f_X\big[g^{-1}(z)\big]\left|\frac{d}{dz}g^{-1}(z)\right|
	= \lambda\exp(-\lambda\log z)\left|\frac{1}{z}\right|
	= \lambda z^{-(\lambda+1)}.
\]
Hence the PDF of $Z=e^X$ is given by
\[
f_Z(z) = \left\{\begin{array}{ll}
	\lambda z^{-(\lambda+1)} & z\geq 1, \\
	0 & \text{otherwise}.
\end{array}\right.
\]
\een
\end{answer}

\question % transf
A continuous random variable $U$ has PDF
$f(u) = 12u^{2}(1-u)$ for $0 < u < 1$ and zero otherwise.
%\[
%f(u) = \left\{\begin{array}{ll}
%	12u^{2}(1-u) 	& \text{for}\quad 0 < u < 1, \\
%	0				& \text{otherwise.}
%\end{array}\right.
%\]
Find the PDF of $V = (1 - U)^{2}$.
\begin{answer}
\bit
\it The transformation $g(u) = (1 - u)^{2}$ is one-to-one and decreasing over $[0,1]$.
\it The inverse transformation is $g^{-1}(v) = 1 - v^{1/2}$, for which $\displaystyle \frac{d}{dv}g^{-1}(v) = -\frac{1}{2v^{1/2}}$.
\it Since $\supp(f_U)=(0,1)$ it follows that $\supp(f_V)=(0,1)$.
\eit
Hence for $0<v<1$ the PDF of $V$ is
\begin{align*}
f_V(v)
	& = f_U\big[g^{-1}(v)\big]\left|\frac{d}{dv}g^{-1}(v)\right| \\
	& = 12(1-v^{1/2})^2 v^{1/2}\left|-\frac{1}{2v^{1/2}}\right| \\
	& = 6(1-v^{1/2})^2,
\end{align*}
and zero otherwise.
\end{answer}

\question % probability integral transform
The CDF of a random variable $X$ is $F(x) = 1-1/x^3$ for $x\geq 1$ and zero otherwise.
%\[
%F_X(x) = \left\{\begin{array}{ll}
%	\displaystyle 1-\frac{1}{x^3}		& \text{for $x\geq 1$,} \\
%	0								& \text{otherwise.}
%\end{array}\right.
%\]
Find the CDF of the random variable $Y=1/X$, then describe how a pseudo-random number from the distribution of $Y$ can be obtained using an algorithm that generates uniformly distributed pseudo-random numbers in the range $[0,1]$.
\begin{answer}
Let $g(x) = 1/x$ denote the transformation.
\bit
\it $\supp(f_X) = [1,\infty] \Rightarrow\ \supp(f_Y) = [0,1]$.
\it The inverse transformation: $g^{-1}(y) = 1/y$.
\eit
\par
Because $g(x)$ is a decreasing function over $\supp(f_X)$,
\[
F_Y(y)
	= 1 - F_X\big[g^{-1}(y)\big]
	= 1 - F_X\left(\frac{1}{y}\right)
	= \left\{\begin{array}{ll}
		0	& y < 0 \\
		y^3	& 0\leq y\leq 1 \\
		1	& y > 1.
	\end{array}\right.
\]
For the second part we use the fact that $F_Y(Y)\sim\text{Uniform}(0,1)$. First we invert $F_Y$ by letting $u=F_Y(y)$ from which we obtain.
\[
y = F_Y^{-1}(u) = u^{1/3}.
\]
Next we obtain a pseudo-random number $u$ from the $\text{Uniform}[0,1]$ distribution, then compute
\[
y = u^{1/3},
\]
which is a pseudo-random number from the distribution of $Y$.
\end{answer}

\end{questions}
\end{exercise}


\documentclass[letterpaper]{article}

\usepackage[utf8x]{luainputenc}
\usepackage{aeguill}
%\usepackage{nopageno}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathrsfs}
\usepackage{fullpage}
\usepackage{fancyhdr}
\setlength{\headheight}{12pt}
\pagestyle{fancy}
\chead{Linear Algebra}
\lhead{September 23, 2015}
\rhead{Jon Allen}
\allowdisplaybreaks

\newcommand{\abs}[1]{\left\lvert #1 \right\rvert}

\begin{document}
%\renewcommand{\labelenumii}{\alph{enumii}.}
%\renewcommand{\labelenumiii}{\alph{enumiii}.}
%\renewcommand{\labelenumi}{(\arabic{enumi})}
\section*{Excercise Set 1}
\begin{enumerate}
\item
Prove the matrix
\[A=\left[\begin{array}{cc}a&b\\c&d\end{array}\right]\]
is invertible if and only if $ad-bc\ne 0$. Find $A^{-1}$ in this case by solving a system of two equations with two unknowns.

We need some matrix $A^{-1}$ such that $AA^{-1}=I_2$.
Assume $A^{-1}$ exists, then let $A^{-1}=\left[\begin{array}{cc}a'&b'\\c'&d'\end{array}\right]$ and we have
\begin{align*}
  AA^{-1}&= \left[\begin{array}{cc}a&b\\c&d\end{array}\right]
            \left[\begin{array}{cc}a'&b'\\c'&d'\end{array}\right]\\
  &=\left[\begin{array}{cc}aa'+bc'&ab'+bd'\\ca'+dc'&cb'+dd'\end{array}\right]
  =\left[\begin{array}{cc}1&0\\0&1\end{array}\right]\\
\end{align*}
In particular
\begin{align*}
  aa'+bc'&=1&
  ca'+dc'&=0\\
\end{align*}
Now if $c=0$ then $d=0$ or $c'=0$. We know that $d\ne 0$ because $cb'+dd'=1$. And so if $c=0$ then $c'=0$. But then $aa'+bc'=1$ so $a\ne 0$ in this case. We will proceed in two cases then for $c\ne 0$ and $a\ne 0$.

If we assume that $c\ne 0$ then we have
\begin{align*}
  ca'+dc'&=0&
  a'+\frac{d}{c}c'&=0&
  -aa'-\frac{ad}{c}c'&=0\\
\end{align*}
Now if we add $aa'+bc'=1$ to the above result we get $\left(b-\frac{ad}{c}\right)c'=1$. Solving for $c'$ gives us $c'=-\frac{c}{ad-bc}$. Using we can solve $ca'+dc'=0$ to find $a'=\frac{d}{ad-bc}$. Moving on we have
\begin{align*}
  cb'+dd'&=1&b'+\frac{d}{c}d'&=\frac{1}{c}&-ab'-\frac{ad}{c}d'&=-\frac{a}{c}
\end{align*}
Adding in $ab'+bd'=0$ leads us to $\frac{bc-ad}{c}d'=\frac{-a}{c}$, or $d'=\frac{a}{ad-bc}$. And finally substituting $d'$ in for $cb'+dd'=1$ leads to $cb'+d\frac{a}{ad-bc}=cb'+1+\frac{bc}{ad-bc}=1$ or $b'=-\frac{b}{ad-bc}$.

The case when $a\ne 0$ is similar.
\begin{align*}
  ab'+bd'&=0&cb'+dd'&=1\\
  -cb'-\frac{cb}{a}d'&=0&cb'+dd'&=1\\
  \left(d-\frac{cb}{a}\right)d'&=1&d'&=\frac{a}{ad-bc}\\
\end{align*}
If we continue as we did when $c\ne 0$ then we will arrive at $A^{-1}=\frac{1}{ad-bc}\left[\begin{array}{cc}d&-b\\-c&a\end{array}\right]$ just as we did when $c\ne 0$.

In this way we see that when we assume that $A^{-1}$ exists and that $ad-bc=0$ we arrive at a contradiction. Namely that $\frac{1}{ad-bc}$ is undefined and therefore $A^{-1}$ can't exist. However, if we assume that $ad-bc\ne 0$ we find our inverse, and so it must exist. Thus we have proven both directions of the hypothesis.
$\Box$
\item
Let
\[A=\left[\begin{array}{ccc}0&0&1\\1&0&2\\0&1&-3\end{array}\right]\]
  \begin{enumerate}
  \item
  Show that $A^3+3A^2-2A-I_3=\mathbf{0}$
  \begin{align*}
    A^3+3A^2-2A-I_3&=0\\
    (A^2+3A-2I_3)A&=I_3\\
    \left( \left[\begin{array}{ccc}0&0&1\\1&0&2\\0&1&-3\end{array}\right]^2
    +3\left[\begin{array}{ccc}0&0&1\\1&0&2\\0&1&-3\end{array}\right]
    +\left[\begin{array}{ccc}-2&0&0\\0&-2&0\\0&0&-2\end{array}\right]
    \right)A&=I_3\\
    \left( \left[\begin{array}{ccc}0&1&-3\\0&2&-5\\1&-3&11\end{array}\right]
    +\left[\begin{array}{ccc}0&0&3\\3&0&6\\0&3&-9\end{array}\right]
    +\left[\begin{array}{ccc}-2&0&0\\0&-2&0\\0&0&-2\end{array}\right]
    \right)A&=I_3\\
    \left[\begin{array}{ccc}-2&1&0\\3&0&1\\1&0&0\end{array}\right]
    \left[\begin{array}{ccc}0&0&1\\1&0&2\\0&1&-3\end{array}\right]&=I_3\\
    \left[\begin{array}{ccc}1&0&0\\0&1&0\\0&0&1\end{array}\right]&=I_3
  \end{align*}
  \item
  Use part (a) to see that $A$ is invertible and compute $A^{-1}$

  Obviously $A^{-1}=A^2+3A-2I_3=\left[\begin{array}{ccc}-2&1&0\\3&0&1\\1&0&0\end{array}\right]$
  \end{enumerate}
\item
Let $A\in \mathcal{M}_n$ be a diagonal matrix. Prove that $A$ is invertible if and only if $\text{ent}_{ii}(A)\ne0$ for all $i\le n$. Find $A^{-1}$ in this case.

Let us assume that there exists some $\text{ent}_{ii}(A)=0$ and that $A^{-1}$ exists with $\text{ent}_{jk}(A^{-1})=a_{jk}^{-1}$ and $\text{ent}_{jk}(A)=a_{jk}$. Then $\text{ent}_{ii}(AA^{-1})=\sum\limits_{k=1}^n{a_{ik}a_{ki}^{-1}}=\sum\limits_{k=1}^n{0a_{ki}^{-1}}=0$. But $AA^{-1}=I_n$ and $\text{ent}_{ii}(I_n)=1$ and so we have a contradiction.

Now lets assume that $\text{ent}_{ii}(A)=c_i$ with $i\le n$ and $c_i\ne 0$. Lets choose another diagonal matrix and name it $A^{-1}$. We will assign $\text{ent}_{ii}(A^{-1})=c_{i}^{-1}$. Now we see that if we choose any $i\le n,j\le n$ such that $j\ne i$ then we see that $\text{ent}_{ij}(AA^{-1})=\sum\limits_{k=1}^n{a_{ik}a_{kj}^{-1}}=0+\dots+a_{ii}a_{ij}^{-1}+a_{ij}a_{jj}^{-1}+\dots0=0+\dots+a_{ii}0+0a_{jj}^{-1}+\dots0=0$.
But $\text{ent}_{ii}(AA^{-1})=\sum\limits_{k=1}^n{a_{ik}a_{ki}^{-1}}=0+\dots+a_{ii}a_{ii}^{-1}+\dots+0=cc^{-1}=1$. And so we see that $AA^{-1}$ is a diagonal matrix with all ones for its entries. But that is $I_n$ and so we have found the inverse of $A^{-1}$.
$\Box$
\item
If $A,B\in \mathcal{M_n}$ are invertible such that $A+B\ne 0$, does it follow that $(A+B)^{-1}$ exists? Prove or find a counterexample.

\[
\left[\begin{array}{cc}3&2\\8&4\end{array}\right]+
\left[\begin{array}{cc}3&2\\4&4\end{array}\right]
=\left[\begin{array}{cc}6&4\\12&16\end{array}\right]
\]

Notice that $3\cdot 4-8\cdot 2=-4$ and $3\cdot 4-2\cdot 4=4$ but $6\cdot8-4\cdot 12=6\cdot4\cdot2-4\cdot2\cdot6=0$ and so by excercise 1 we have found a counterexample.
\end{enumerate}
\section*{Excercise Set 2}

\[A=
\left[\begin{array}{ccccc}
  a_{11}&a_{12}&a_{13}&a_{14}&a_{15}\\
  a_{21}&a_{22}&a_{23}&a_{24}&a_{25}\\
  a_{31}&a_{32}&a_{33}&a_{34}&a_{35}\\
  a_{41}&a_{42}&a_{43}&a_{44}&a_{45}
\end{array}\right]\]

\begin{enumerate}
\item
For the matrix $A$ in the example above, determine $E_{3\to c3}$ where $c$ is any nonzero real number.

\[E_{3\to c3}=\left[\begin{array}{cccc}1&0&0&0\\0&1&0&0\\0&0&c&0\\0&0&0&1\\\end{array}\right]\]

\item
For the matrix $A$ in the example above, determine $E_{4\to4+c2}$ where $c$ is any nonzero real number.

\[E_{4\to 4+c2}=\left[\begin{array}{cccc}1&0&0&0\\0&1&0&0\\0&0&1&0\\0&c&0&1\\\end{array}\right]\]

\item
Prove that each of $E_{i\leftrightarrow k},E_{i\to ci}, E_{i\to i+ck}$ is invertible by finding an inverse. Prove that the inverse of an elementary matrix is an elementary matrix.

We assume that $i\ne k$.
We posit that $E_{i\leftrightarrow k}$ is the identity matrix, save that $\text{ent}_{ii}E_{i\leftrightarrow k}=\text{ent}_{kk}E_{i\leftrightarrow k}=0$ and $\text{ent}_{ki}E_{i\leftrightarrow k}=\text{ent}_{ik}E_{i\leftrightarrow k}=0$

We shall now verify this claim.
First we choose some $j\not\in\{i,k\}$ and any $l$.
Now we see that for any $A\in \mathcal{M}_n$ we have $\text{ent}_{jl}(E_{i\leftrightarrow k}A)=\sum\limits_{m=1}^n{\text{ent}_{jm}(E_{i\leftrightarrow k})a_{ml}}=a_{jl}$ because all entries in the elementary matrix row are zero except the $j$ element which is one.
And so as we wish $E_{i\leftrightarrow k}$ leaves everything off of rows $i$ and $k$ undisturbed.
Now lets see what happens for $\text{ent}_{il}(E_{i\leftrightarrow k}A)$ and $\text{ent}_{kl}(E_{i\leftrightarrow k}A)$.
\begin{align*}
  \text{ent}_{il}(E_{i\leftrightarrow k}A)
  &=\sum\limits_{m=1}^n{\text{ent}_{im}(E_{i\leftrightarrow k})a_{ml}}=a_{kl}\\
  \text{ent}_{kl}(E_{i\leftrightarrow k}A)
  &=\sum\limits_{m=1}^n{\text{ent}_{km}(E_{i\leftrightarrow k})a_{ml}}=a_{il}
\end{align*}
Thus we see that the $i$ and $k$ rows of $A$ and its product with the elementary matrices have been switched. This occurs because $\text{ent}_{ki}(E_{i\leftrightarrow k})=\text{ent}_{ik}(E_{i\leftrightarrow k})=1$ but all other entries on these two rows is zero.

Now that we know what $E_{i\leftrightarrow k}$ is, we see that for
$i\ne l$ we have $\text{ent}_{il}(E_{i\leftrightarrow k}E_{i\leftrightarrow k})=\text{ent}_{kl}(E_{i\leftrightarrow k})=0$.
And we have $\text{ent}_{ii}(E_{i\leftrightarrow k}E_{i\leftrightarrow k})=\text{ent}_{ki}(E_{i\leftrightarrow k})=1$.
Similarly
we have $\text{ent}_{kl}(E_{i\leftrightarrow k}E_{i\leftrightarrow k})=\text{ent}_{il}(E_{i\leftrightarrow k})=0$ when $k\ne l$ and
$\text{ent}_{kk}(E_{i\leftrightarrow k}E_{i\leftrightarrow k})=\text{ent}_{ik}(E_{i\leftrightarrow k})=1$ when $k=l$. Thus $E_{i\leftrightarrow k}^{2}=I_n$ and so this matrix is it's own inverse.

For the matrix $E_{i\to ci}$ we must have $c\ne 0$.
Now if we take the identity matrix, but change $\text{ent}_{ii}$ to be $c$ then I claim we have our elementary matrix.
As above, when $j\ne i$ we have $\text{ent}_{jk}(E_{i\to ci}A)=a_{jk}$ for any  $A\in \mathcal{M}_n$ and $k\le n$.
And so our matrix leaves all rows but $i$ untouched. Now if we examine row $i$ we see that $\text{ent}_{ik}(E_{i\to ci}A)=\sum\limits_{l=1}^n{\text{ent}_{il}(E_{i\to ci})a_{li}}=ca_{ik}$ as desired. So we have found our elementary matrix.

Now let us examine $E_{i\leftrightarrow (1/c)i}E_{i\leftrightarrow ci}$. We have already seen that $\text{ent}_{jk}(E_{i\leftrightarrow (1/c)i}E_{i\to ci})=\text{ent}_{jk}(E_{i\to ci})=\text{ent}_{jk}(I_n)$. And $\text{ent}_{ik}(E_{i\leftrightarrow (1/c)i}E_{i\to ci})=\frac{1}{c}\text{ent}_{ik}(E_{i\to ci})$. Of course when $k\ne i$ then this is zero and when $k=i$ then this entry will be $\frac{1}{c}c=1$. Thus we have exactly the identity matrix. And so we have found our inverse.

Finally we look at $E_{i\to i+ck}$. As before we start with the identity matrix. This time the only entry on $I_n$ that we change is $\text{ent}_{ik}(E_{i\to i+ck})=c$.

Obviously if we have $j\ne i, l\le n$ and any $A\in\mathcal{M}_n$ then $\text{ent}_{jl}(E_{i\to i+ck}A)=\sum\limits_{m=1}^n{\text{ent}_{jm}(E_{i\to i+ck})a_{ml}}=a_{jl}$.
But $\text{ent}_{il}(E_{i\to i+ck}A)=\sum\limits_{m=1}^n{\text{ent}_{im}(E_{i\to i+ck})a_{ml}}=a_{il}+ca_{kl}$. Fantastic, we have found something that takes the entry from row k and multiplies it by c and adds it to the entry in row i, then places the result in row i. This then is the elementary matrix we require.

Now if we take $E_{i\to i-ck}$ for
$j\ne i, l\le n$ we have $$\text{ent}_{jl}(E_{i\to i-ck}E_{i\to i+ck})=\sum\limits_{m=1}^n{\text{ent}_{jm}(E_{i\to i-ck})\text{ent}_{jm}(E_{i\to i+ck})}=\text{ent}_{jl}(I_n)$$

And $\text{ent}_{il}(E_{i\to i-ck}E_{i\to i+ck})=\sum\limits_{m=1}^n{\text{ent}_{im}(E_{i\to i-ck})\text{ent}_{im}(E_{i\to i+ck})}=\text{ent}_{il}(E_{i\to i+ck})-c\cdot\text{ent}_{kl}(E_{i\to i+ck})$. Of course if $i=l$ then this will give us $1-0=1$ and if $k=l$ then we have $c-c=0$. This will leave us with our identity. And so we have our inverse.

For each of the three elementary matrices we have found an inverse, and thus one must exist. Further, these inverses are simply elementary matrices themselves.
$\Box$
\item
Define a relation $\sim$ on $\mathcal{M}_{m\times n}$ given by $A\sim B$ if and only if there exists a $P\in \mathcal{M}_{m\times n}$ such that $A=PB$ where $P\in \mathcal{M}_{m\times n}$ is a product of elementary matrices.

We know that $A=I_nA$ and $I_n$ is an elementary matrix and so this relation is reflexive.

We also know that every elementary matrix has an inverse and that inverse is an elementary matrix. And so if $P=E_1E_2\dots E_n$ then $P^{-1}$ exists. In fact $P^{-1}=E_n^{-1}\dots E_1^{-1}$ which is the product of elementary matrices also. Therefore if $A=PB$ then $P^{-1}A=B$ and so commutativity is preserved with this relation.

Now of we have $P_1,P_2$ both products of elementary matrices, then it follows that $P_1P_2$ is also the product of elementary matrices. And so if $A=P_1B$ and $B=P_2C$ then $A=P_1(P_2C)=(P_1P_2)C$ and so the relation is transitive.

Those are the three properties we need for the relation to fit the definition of an equivalence relation.
$\Box$
\end{enumerate}
\end{document}
%hw 1.5:1,2b,3ce,10,11,13,14,15


\section{Arc Length}{}{}\label{sec:Arc Length}
Here is another geometric application of the integral: Find the length
of a portion of a curve. As usual, we need to think about how we might
approximate the length, and turn the approximation into an integral.

We already know how to compute one simple arc length, that of a line
segment. If the endpoints are $\ds P_0(x_0,y_0)$ and $\ds P_1(x_1,y_1)$
then the length of the segment is the distance between the points,
$\ds \sqrt{(x_1-x_0)^2+(y_1-y_0)^2}$, from the Pythagorean theorem, as
illustrated in Figure~\ref{fig:length of a line segment}.

\figure[H]
%\texonly
\centerline{\vbox{\beginpicture
\normalgraphs
%\sevenpoint
\setcoordinatesystem units <1.5truecm,1.5truecm>
\setplotarea x from 0 to 5, y from 0 to 3
\axis bottom /
\axis left /
\putrule from 2 1 to 4.5 1
\putrule from 4.5 1 to 4.5 2.5
\plot 2 1 4.5 2.5 /
\put {$(x_1,y_1)$} [bl] <3pt,3pt> at 4.5 2.5
\put {$(x_0,y_0)$} [tr] <-3pt,-3pt> at 2 1
\put {$x_1-x_0$} [t] <0pt,-3pt> at 3.25 1
\put {$y_1-y_0$} [l] <3pt,0pt> at 4.5 1.75
\put {$\sqrt{(x_1-x_0)^2+(y_1-y_0)^2}$} [br] <-3pt,3pt> at 3.25 1.75
\endpicture}}
%\endtexonly
%\figrdef{fig:length of a line segment}
%\htmlfigure{Integration_applications-arc_length.html}
\caption{\label{fig:length of a line segment}
The length of a line segment.}
%\endcaption
\endfigure

Now if the graph of $f$ is ``nice'' (say, differentiable) it appears
that we can approximate the length of a portion of the curve with line
segments, and that as the number of segments increases, and their
lengths decrease, the sum of the lengths of the line segments will
approach the true arc length; see
Figure~\ref{fig:approximating arc length}.

\figure[H]
%\texonly
\centerline{\vbox{\beginpicture
\normalgraphs
%\sevenpoint
\setcoordinatesystem units <1.5truecm,0.8truecm>
\setplotarea x from 0 to 8, y from 0 to 5
\axis bottom /
\axis left /
\setquadratic\plot
1.000 1.000 1.150 1.953 1.300 2.694 1.450 3.246 1.600 3.636
1.750 3.884 1.900 4.012 2.050 4.041 2.200 3.990 2.350 3.874
2.500 3.711 2.650 3.515 2.800 3.299 2.950 3.075 3.100 2.853
3.250 2.644 3.400 2.454 3.550 2.290 3.700 2.157 3.850 2.060
4.000 2.000 4.150 1.979 4.300 1.996 4.450 2.050 4.600 2.138
4.750 2.255 4.900 2.396 5.050 2.554 5.200 2.721 5.350 2.886
5.500 3.039 5.650 3.168 5.800 3.258 5.950 3.294 6.100 3.261
6.250 3.140 6.400 2.912 6.550 2.556 6.700 2.051 6.850 1.374
7.000 0.500 /
\multiput {$\bullet$} at 1 1 2.050 4.041 3.250 2.644
4.300 1.996 5.500 3.039 6.250 3.140 7 0.5 /
\setlinear\plot
1 1 2.050 4.041 3.250 2.644
4.300 1.996 5.500 3.039 6.250 3.140 7 0.5 /
\endpicture}}
%\endtexonly
%\figrdef{fig:approximating arc length}
%\htmlfigure{Integration_applications-arc_length_line_segments.html}
\caption{\label{fig:approximating arc length}
Approximating arc length with line segments.}
%\endcaption
\endfigure

Now we need to write a formula for the sum of the lengths of the line
segments, in a form that we know becomes an integral in the limit.  So
we suppose we have divided the interval $[a,b]$ into $n$ subintervals
as usual, each with length $\Delta x =(b-a)/n$, and endpoints $\ds
a=x_0$, $\ds x_1$, $\ds x_2$, \dots, $\ds x_n=b$.  The length of a
typical line segment, joining $\ds (x_i,f(x_i))$ to $\ds
(x_{i+1},f(x_{i+1}))$, is $\ds\sqrt{(\Delta x )^2
  +(f(x_{i+1})-f(x_i))^2}$.  By the Mean Value Theorem, %(\xrefn{thm:mvt}),
there is a number $\ds t_i$ in $\ds (x_i,x_{i+1})$
such that $\ds f'(t_i)\Delta x=f(x_{i+1})-f(x_i)$, so the length of
the line segment can be written as
$$
  \sqrt{(\Delta x)^2 + (f'(t_i))^2\Delta x^2}=
  \sqrt{1+(f'(t_i))^2}\,\Delta x.
$$
Then arc length is:
$$
  \lim_{n\to\infty}\sum_{i=0}^{n-1} \sqrt{1+(f'(t_i))^2}\,\Delta x=
  \int_a^b \sqrt{1+(f'(x))^2}\,dx.
$$
Note that the sum looks a bit different than others we have
encountered, because the approximation contains a $\ds t_i$ instead of an
$\ds x_i$. In the past we have always used left endpoints (namely, $\ds x_i$)
to get a representative value of $f$ on $\ds [x_i,x_{i+1}]$; now we are
using a different point, but the principle is the same.

To summarize, to compute the length of a curve on the interval
$[a,b]$, we compute the integral
$$\int_a^b \sqrt{1+(f'(x))^2}\,dx.$$
Unfortunately, integrals of this form are typically difficult or
impossible to compute exactly, because usually none of our methods for
finding antiderivatives will work. In practice this means that the
integral will usually have to be approximated.

\begin{example}{Circumference of a Circle}{Circumference of a Circle}\label{Circumference of a Circle}
Let $\ds f(x) = \sqrt{r^2-x^2}$, the upper half circle of radius
$r$. The length of this curve is half the circumference, namely $\pi
r$. Compute this with the arc length formula.
\end{example}

\begin{solution}
The derivative $f'$ is $\ds \ds -x/\sqrt{r^2-x^2}$ so the integral is
$$
  \int_{-r}^r \sqrt{1+{x^2\over r^2-x^2}}\,dx
  =\int_{-r}^r \sqrt{r^2\over r^2-x^2}\,dx
  =r\int_{-r}^r \sqrt{1\over r^2-x^2}\,dx.
$$
Using a trigonometric substitution, we find the antiderivative, namely
$\ds \arcsin(x/r)$. Notice that the integral is improper at both
endpoints, as the function $\ds \sqrt{1/(r^2-x^2)}$ is undefined when
$x=\pm r$. So we need to compute
$$
  \lim_{D\to-r^+}\int_D^0  \sqrt{1\over r^2-x^2}\,dx +
  \lim_{D\to r^-}\int_0^D  \sqrt{1\over r^2-x^2}\,dx.
$$
This is not difficult, and has value $\pi$, so the original integral,
with the extra $r$ in front, has value $\pi r$ as expected.
\end{solution}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Opensolutionfile{solutions}[ex]
\section*{Exercises for \ref{sec:Arc Length}}

\begin{enumialphparenastyle}

%%%%%%%%%%
\begin{ex}
 Find the arc length of $\ds f(x)=x^{3/2}$ on $[0,2]$.
\begin{sol}
 $\ds (22\sqrt{22}-8)/27$
\end{sol}
\end{ex}

%%%%%%%%%%
\begin{ex}
 Find the arc length of $\ds f(x) = x^2/8-\ln x$
on $[1,2]$.
\begin{sol}
 $\ln(2)+3/8$
\end{sol}
\end{ex}

%%%%%%%%%%
\begin{ex}

Find the arc length of $\ds f(x) = (1/3)(x^2 +2)^{3/2}$
on the interval $[0,a]$.
\begin{sol}
 $\ds a+a^3/3$
\end{sol}
\end{ex}

%%%%%%%%%%
\begin{ex}
 Find the arc length of $f(x)=\ln(\sin x)$ on the
interval $[\pi/4,\pi/3]$.
\begin{sol}
 $\ds \ln((\sqrt2+1)/\sqrt3)$
\end{sol}
\end{ex}

%%%%%%%%%%
\begin{ex}
 Let $a>0$. Show that the length of $y=\cosh x$ on
$[0,a]$ is equal to $\ds \int _0 ^a \cosh x\,dx$.
\end{ex}

%%%%%%%%%%
\begin{ex}
 Find the arc length of $f(x)=\cosh x$ on $[0, \ln 2]$.
\begin{sol}
 $3/4$
\end{sol}
\end{ex}

%%%%%%%%%%
\begin{ex}
 Set up the integral to find the arc length of $\sin x$
on the interval $[0,\pi]$; do not evaluate the integral. If you have
access to appropriate software, approximate the value of the integral.
\begin{sol}
 $\approx 3.82$
\end{sol}
\end{ex}

%%%%%%%%%%
\begin{ex}
 Set up the integral to find the arc length of $\ds y=xe^{-x}$
on the interval $[2,3]$; do not evaluate the integral. If you have
access to appropriate software, approximate the value of the integral.
\begin{sol}
 $\approx 1.01$
\end{sol}
\end{ex}

%%%%%%%%%%
\begin{ex}
 Find the arc length of $\ds y=e^x$ on the interval $[0,1]$.
(This can be done exactly; it is a bit tricky and a bit long.)
\begin{sol}
 $\ds \sqrt{1+e^2}-\sqrt2+
{1\over2}\ln\left({\sqrt{1+e^2}-1\over\sqrt{1+e^2}+1}\right)+
{1\over2}\ln(3+2\sqrt2)$
\end{sol}
\end{ex}

\end{enumialphparenastyle}


\documentclass{article}
\usepackage{graphicx}
\usepackage{amssymb,amsmath}
\usepackage{pdflscape}
\usepackage{subfigure}
\usepackage{dcolumn}
%\usepackage{rotating}
\usepackage{fancyhdr}
\pagestyle{fancyplain}

\newcommand\T{\rule{0pt}{2.6ex}}
\newcommand\B{\rule[-1.2ex]{0pt}{0pt}}

\begin{document}
\rhead{Prepared by Adam Beardsley on \today}

\centerline{\sc \large Interpreting Discrete Fourier Transforms}
\vspace{.5pc}

\begin{abstract}
We present a systematic way of interpreting the discrete Fourier transform as an approximation to the continuous Fourier transform.  The argument is made for general conventions, and several examples are given.
\end{abstract}

\section{Introduction}

Often times it is necessary to approximate a continuous Fourier transform (CFT) with a discrete Fourier transform (DFT) when an analytic form of the data is not available.  For example, a DFT can be performed on a sampling of time-ordered electric field measurements to approximate the frequency spectrum of the field.  In order to perform these transforms, we utilize the numerical packages of programming languages such as IDL, MATLAB, or Mathematica.  However, the definition of a Fourier transform is not completely constrained, and freedoms exist that give rise to multiple conventions in the normalization\footnote{There are of course constraints limiting these freedoms, but for this argument we will leave them completely free.}, and scaling of the Fourier domain variables.  In particular, the numerical package being used may not follow the desired convention.  Below we outline a method for interpreting the results of a DFT, in terms of the CFT desired.  Then we provide several examples of common conventions.

\section{Derivation}\label{sec:derivation}

We start by assuming we have a continuous function, $f_c(x)$, of which we would like to compute a continuous Fourier transform of the form
\begin{equation}
\label{eq:continuous}
F_c(u;C_c,p_c)=C_c\int_{-\infty}^{\infty}dx \ f_c(x) e^{i p_c u x}
\end{equation}
where the constants $C_c$ and $p_c$ are determined by convention of the transform.  However, in reality we often have a discrete sample of the continuous function, $f_d(j)$, where $j$ indexes the samples and runs from $0$ to $N-1$, $N$ being the number of samples.  Then it is necessary to use a discrete Fourier transform.  Numerical packages have various conventions for their DFTs, but in general they can be expressed in the form
\begin{equation}
\label{eq:discrete}
F_d(k;C_d,p_d)=C_d\sum\limits_{j=0}^{N-1}f_d(j)e^{i p_d j k}
\end{equation}
where $k$ indexes the Fourier domain samples, and also runs from $0$ to $N-1$.  In some cases, the indices can be shifted.  For example, MATLAB counts arrays from 1 rather than 0, so the sum would run from $1$ to $N$, and the values in the exponent are adjusted accordingly.  For simplicity, we assume counting from 0.  The translation is straighforward, and an example is given in Section \ref{sec:examples}.  We wish to approximate the CFT with the DFT.

In order to proceed, we assume the function $f_c(x)$ is only significantly non-zero within a domain $\mathcal{D}$.  Furthermore, we will assume $\mathcal{D}=[0,x_{max}]$.  This constraint is not actually necessary, and a translation of the domain results in a phase in the Fourier transform, as seen in Section \ref{sec:shifting}.  Then we can relate the indices in Eq. \eqref{eq:discrete} to the axis values with the following expressions:
\begin{subequations}
\label{eq:axes}
\begin{align}
x(j)=j\Delta x \label{eq:x_axis}\\
u(k)=k\Delta u \label{eq:u_axis}
\end{align}
\end{subequations}
where $\Delta x = x_{max}/(N-1)$, and $\Delta u$ will be derived below.  We can now approximate the CFT with a finite sum.

\begin{eqnarray}
\label{eq:approx_cont}
F_c(u;C_c,p_c) 	& \approx	&	C_c\int_0 ^{x_{max}} dx \ f_c(x)e^{i p_c u x} \nonumber \\
								& \approx	&	C_c\sum\limits_{j=0}^{N-1}\Delta x f_c(x(j))e^{i p_c u j \Delta x} \nonumber \\
								& =				&	C_c \Delta x \sum\limits_{j=0}^{N-1} f_d(j) e^{i p_c u j \Delta x}
\end{eqnarray}

In order to force the sum in Eq. \eqref{eq:approx_cont} to the form of the DFT (Eq. \eqref{eq:discrete}), we write $u(k)$ in the following way.

\begin{eqnarray}
\label{eq:delta_u}
u(k) = k\Delta u	&	= & \frac{p_d k}{p_c \Delta x} \nonumber \\
		\Rightarrow	\Delta u	&	=	&	\frac{p_d}{p_c \Delta x}
\end{eqnarray}

This expression for $\Delta u$ defines our Fourier axis, which is an extremely important part of interpreting a Fourier transform and in particular comparing to other computational conventions.

We can now simplify Eq. \ref{eq:approx_cont}.

\begin{eqnarray}
\label{eq:related}
F_c(u;C_c,p_c)	&	\approx	&	C_c \Delta x \sum\limits_{j=0}^{N-1}f_d(j)e^{i p_d j k} \nonumber \\
								&	=				&	\frac{C_c}{C_d} \Delta x F_d(k;C_d,p_d) \nonumber \\
								&	=				&	\frac{C_c}{C_d} \Delta x F_d(u / \Delta u;C_d,p_d)
\end{eqnarray}

In the first line of Eq. \ref{eq:related} we introduced an intermediate index $k=u/\Delta u$ for clarity in replacing the sum with the DFT.  Of course any computer package will compute the DFT for integer values of $k$, and it should be noted that this approximation for the CFT is only used for $u$ equal to integer multiples of $\Delta u$.

To summarize, we have related an arbitrary convention of the continuous Fourier transform to an arbitrary convention of the discrete Fourier transform (Eq. \ref{eq:related}).  In addition, we have shown the resulting Fourier axis is described by Eq. \ref{eq:delta_u}.  For reference, several examples are discussed in Section \ref{sec:examples}.

\section{Shifting Domains}\label{sec:shifting}

The above derivation applied to functions significantly non-zero only within a domain $\mathcal{D}=[0,x_{max}]$.  We can relax that condition slightly by allowing $\mathcal{D}\rightarrow[x_{min},x_{max}]$.  The same process can be followed as in Section \ref{sec:derivation}, with a simple translation of the variable of integration.  The result is a mode-dependent phase, and we can generalize Eq. \ref{eq:related} as
\begin{equation}
\label{eq:related_general}
F_c(u;C_c,p_c) \approx \frac{C_c}{C_d} \Delta x e^{i p_c u x_{min}}F_d(u / \Delta u;C_d,p_d)
\end{equation}
where now $\Delta x = (x_{max}-x_{min})/(N-1)$.

A particular case of interest is to shift the real and Fourier domains such that they are centered at zero.  This can be achieved by a couple shifts of the arrays.  In this case, $x_{min} = -\Delta x (N-1)/2$.  The phases in Eq. \ref{eq:related_general} are now negative, but can be shifted properly to make them positive.  This amounts to exchanging the positive and negative $x$ data in $f_d(j)$.  This is illustrated in Step A in Fig. \ref{fig:shifting}.

Once the DFT is performed, our approximation for $F_c(u)$ is still only valid for positive (or in some cases only negative) values of $u$.  But we note that by the periodic nature of a complex phase, for $k>(N-1)/2$, and for $p_d = 2 \pi / N$ (as is normally the case), we can make the substituion $k\rightarrow-N+k$ and the sum in Eq. \ref{eq:discrete} remains unchanged.  In other words, we can relabel and shift our $u$ axis to center our Fourier axis on $u=0$, as shown in Steps C and D in Fig. \ref{fig:shifting}.  All these operations can be easily implemented using shifting functions built into many software packages.  In MATLAB, for example, \texttt{ifftshift} (Step A) and \texttt{fftshift} (Step D) are provided for this very reason.

\begin{figure}
\begin{center}
\centerline{\includegraphics[width=7in]{FFT_shifts.jpg}}
\end{center}
\caption{Centering axes on 0.  \emph{Step A}: Shift the real axis to be fed into DFT package.  \emph{Step B}: Perform discrete Fourier transform.  \emph{Step C}: Relabel Fourier modes to equivalent negative modes.  \emph{Step D}: Shift Fourier axis to recover correct order.}
\label{fig:shifting}
\end{figure}

\section{Examples}\label{sec:examples}

Here we apply the interpretation of Section \ref{sec:derivation} specifically to the default MATLAB discrete Fourier transform.  Further examples are listed in Table \ref{table:examples}.  For the forward DFT, MATLAB uses the convention

\begin{equation}
F_d(k) = \sum\limits_{j=1}^N f_d(j)e^{-2 \pi i (j-1)(k-1)/N}, \nonumber
\end{equation}
so that $C_d=1$ and $p_d = -2 \pi / N$.  Note the shift in indices due to the fact that MATLAB counts from 1, rather than zero.  This can be accounted for by writing the axes as
\begin{eqnarray}
x(j) = (j-1)\Delta x \nonumber \\
u(k) = (k-1)\Delta u \nonumber
\end{eqnarray}
where $\Delta u = p_d/(p_c \Delta x) = -2 \pi / (p_c N \Delta x)$.

Let us now assume that we have sampled a function of position, $f_d(j)$, with resolution $\Delta x = 3$m, and $N = 1001$ ($x_{range} = 3000$m).  We are interested in the Fourier transform of the form
\begin{equation}
F_c(u) = \frac{1}{\sqrt{2 \pi}}\int_{-\infty}^{\infty} dx \ f_c(x) e^{i u x} \nonumber
\end{equation}
so that $C_c=1/\sqrt{2\pi}$ and $p_c=1$.  Then we use Eq. \ref{eq:related} to approximate the CFT as
\begin{equation}
F_c(u) \approx \frac{3\mbox{m}}{\sqrt{2\pi}} F_d(-u \frac{3003\mbox{m}}{2\pi}+1;1,2\pi/N) \nonumber
\end{equation}
where $F_d(k,1,2\pi/N)$ is the array output from MATLAB's \texttt{fft} function, given $f_d(j)$.  Note that because the sign of $p_c$ is opposite the sign of $p_d$, the approximation for the CFT will only be valid for negative Fourier modes.  In most applications this difference will not be significant, but in some cases it may be important to account for the axis reversal.

Similar steps can be taken for any DFT convention, and some common default parameters are listed in Table \ref{table:examples}.  We also list several common CFT conventions and their corresponding conversions from common numerical packages in Table \ref{table:applied_examples}.

%Figure format
%\begin{figure}
%\begin{center}
%\includegraphics[width=4in]{file.jpg}
%\end{center}
%\caption{Put a caption here, if you dare}
%\label{fig:figure_label}
%\end{figure}

%appendix if needed
%\clearpage
%\appendix
%\section{appendix section}\label{app_section}

\begin{table}
\begin{center}
\centerline{\begin{tabular}{c c c c c c}
\hline
Package	\T \B			&	$F_d(k)$	&	$C_d$	&	$p_d$	&	$x(j)$	&	$u(k)$	\\ \hline
IDL			\T \B			&	$\frac{1}{N}\sum\limits_{j=0}^{N-1} f_d(j)e^{-2\pi i j k /N}$					&	$1/N$									&	$-2\pi/N$	&	$j\Delta x$			&	$-k\frac{2\pi}{p_c N \Delta x}$			 \\
MATLAB	\T \B			&	$\sum\limits_{j=1}^N f_d(j)e^{2\pi i (j-1)(k-1)/N}$										&	1											&	$-2\pi/N$	&	$(j-1)\Delta x$	&	$-(k-1)\frac{2\pi}{p_c N \Delta x}$	 \\
Mathematica	\T \B	&	$\frac{1}{\sqrt{N}}\sum\limits_{j=1}^N f_d(j)e^{2\pi i (j-1)(k-1)/N}$	&	$\frac{1}{\sqrt{N}}$	&	$2\pi/N$	&	$(j-1)\Delta x$	&	$(k-1)\frac{2\pi}{p_c N \Delta x}$	 \\
Python (numpy) \T \B & $\sum\limits_{j=0}^{N-1} f_d(j)e^{-2\pi i j k /N}$					&	1									&	$-2\pi/N$	&	$j\Delta x$			&	$-k\frac{2\pi}{p_c N \Delta x}$			 \\
\hline
\end{tabular}}
\caption{Example default parameters for the forward discrete Fourier transform for various numerical packages}
\label{table:examples}
\end{center}
\end{table}

\begin{table}
\begin{center}
\begin{tabular}{c c c c}
\hline
DFT Package	\T \B	&	$F_c(u)$ Desired																	&	Amplitude Factor					&	$\left|\Delta u\right|$		\\ \hline
IDL		\T \B				&	$\frac{1}{\sqrt{2\pi}}\int dx \ f_c(x) e^{i u x}$	&	$\Delta x N/\sqrt{2\pi}$	&	$2\pi/(N\Delta x)$ 				\\
			\T \B				&	$\frac{1}{2\pi}\int dx \ f_c(x) e^{i u x}$				&	$\Delta x N/2\pi$					&	$2\pi/(N\Delta x)$				\\
			\T \B				&	$\int dx \ f_c(x) e^{2\pi i u x}$									&	$\Delta x N$							&	$1/(N\Delta x)$						\\ \hline
MATLAB	\T \B			&	$\frac{1}{\sqrt{2\pi}}\int dx \ f_c(x) e^{i u x}$	&	$\Delta x/\sqrt{2\pi}$		&	$2\pi/(N\Delta x)$			 	\\
				\T \B			&	$\frac{1}{2\pi}\int dx \ f_c(x) e^{i u x}$				&	$\Delta x/2\pi$						&	$2\pi/(N\Delta x)$				\\
				\T \B			&	$\int dx \ f_c(x) e^{2\pi i u x}$									&	$\Delta x$								&	$1/(N\Delta x)$						\\ \hline
Mathematica	\T \B	&	$\frac{1}{\sqrt{2\pi}}\int dx \ f_c(x) e^{i u x}$	&	$\Delta x\sqrt{N/2\pi}$		&	$2\pi/(N\Delta x)$ 				\\
				\T \B			&	$\frac{1}{2\pi}\int dx \ f_c(x) e^{i u x}$				&	$\Delta x\sqrt{N}/2\pi$		&	$2\pi/(N\Delta x)$				\\
				\T \B			&	$\int dx \ f_c(x) e^{2\pi i u x}$									&	$\Delta x\sqrt{N}$				&	$1/(N\Delta x)$						\\ \hline
Python (numpy)	\T \B			&	$\frac{1}{\sqrt{2\pi}}\int dx \ f_c(x) e^{i u x}$	&	$\Delta x/\sqrt{2\pi}$		&	$2\pi/(N\Delta x)$			 	\\
				\T \B			&	$\frac{1}{2\pi}\int dx \ f_c(x) e^{i u x}$				&	$\Delta x/2\pi$						&	$2\pi/(N\Delta x)$				\\
				\T \B			&	$\int dx \ f_c(x) e^{2\pi i u x}$									&	$\Delta x$								&	$1/(N\Delta x)$						\\ \hline
\end{tabular}
\caption{Common CFT conventions listed with the normalization factor and axis scaling factors for sample numerical packages.}
\label{table:applied_examples}
\end{center}
\end{table}

\section{Inverse Fourier Transform}

The above argument holds for the inverse Fourier transform as well.  Define the inverse CFT as
\begin{equation}
\label{eq:inverse_continuous}
f_c(x;C'_c,p'_c)=C'_c\int_{-\infty}^{\infty}du \ F_c(k) e^{i p'_c u x}
\end{equation}
and the inverse DFT as
\begin{equation}
\label{eq:inverse_discrete}
f_d(j;C'_d,p'_d)=C'_d\sum\limits_{k=0}^{N-1}F_d(k)e^{i p'_d j k}.
\end{equation}
Then the result for the approximation of the inverse CFT is
\begin{equation}
\label{eq:inverse_related}
f_c(x;C'_c,p'_c) \approx \frac{C'_c}{C'_d} \Delta u f_d(x / \Delta x;C'_d,p'_d)
\end{equation}
where $\Delta x = p_d'/p_c' \Delta u$.

We summarize the default parameters for the inverse DFT for various numerical packages in Table \ref{table:inverse_examples}, and provide a few applied examples to common CFTs in Table \ref{table:inverse_applied_examples}.

\begin{table}
\begin{center}
\centerline{\begin{tabular}{c c c c c c}
\hline
Package	\T \B			&	$f_d(j)$																																&	$C'_d$								&	$p'_d$		&	$u(k)$					&	$x(j)$																\\ \hline
IDL			\T \B			&	$\sum\limits_{k=0}^{N-1} F_d(k)e^{2\pi i j k /N}$												&	$1$										&	$2\pi/N$	&	$k\Delta u$			&	$j\frac{2\pi}{p'_c N \Delta u}$				\\
MATLAB	\T \B			&	$\frac{1}{N}\sum\limits_{k=1}^N F_d(k)e^{-2\pi i (j-1)(k-1)/N}$					&	$1/N$									&	$2\pi/N$	&	$(k-1)\Delta u$	&	$(j-1)\frac{2\pi}{p'_c N \Delta u}$		\\
Mathematica	\T \B	&	$\frac{1}{\sqrt{N}}\sum\limits_{k=1}^N F_d(k)e^{-2\pi i (j-1)(k-1)/N}$	&	$\frac{1}{\sqrt{N}}$	&	$-2\pi/N$	&	$(k-1)\Delta u$	&	$-(j-1)\frac{2\pi}{p'_c N \Delta u}$ 	\\
Python (numpy)			\T \B			&	$\frac{1}{N}\sum\limits_{k=0}^{N-1} F_d(k)e^{2\pi i j k /N}$												&	$1/N$										&	$2\pi/N$	&	$k\Delta u$			&	$j\frac{2\pi}{p'_c N \Delta u}$				\\
\hline
\end{tabular}}
\caption{Example default parameters for the inverse discrete Fourier transform for various numerical packages}
\label{table:inverse_examples}
\end{center}
\end{table}

\begin{table}
\begin{center}
\centerline{\begin{tabular}{c c c c}
\hline
DFT Package	\T \B	&	$f_c(x)$ Desired																		&	Amplitude Factor					&	$\left|\Delta x\right|$	\\ \hline
IDL			\T \B			&	$\frac{1}{\sqrt{2\pi}}\int dx \ f_c(x) e^{-i u x}$	&	$\Delta u/\sqrt{2\pi}$		&	$2\pi/(N \Delta u)$			\\
				\T \B			&	$\int dx \ f_c(x) e^{-i u x}$												&	$\Delta u$								&	$2\pi/(N \Delta u)$			\\
				\T \B			&	$\frac{1}{2\pi}\int dx \ f_c(x) e^{-2\pi i u x}$		&	$\Delta u/2\pi$						&	$1/(N \Delta u)$				\\ \hline
MATLAB	\T \B			&	$\frac{1}{\sqrt{2\pi}}\int dx \ f_c(x) e^{-i u x}$	&	$\Delta u N/\sqrt{2\pi}$	&	$2\pi/(N \Delta u)$ 		\\
				\T \B			&	$\int dx \ f_c(x) e^{-i u x}$												&	$\Delta u N$							&	$2\pi/(N \Delta u)$			\\
				\T \B			&	$\frac{1}{2\pi}\int dx \ f_c(x) e^{-2\pi i u x}$		&	$\Delta u N/2\pi$					&	$1/(N \Delta u)$				\\ \hline
Mathematica	\T \B	&	$\frac{1}{\sqrt{2\pi}}\int dx \ f_c(x) e^{-i u x}$	&	$\Delta u\sqrt{N/2\pi}$		&	$2\pi/(N \Delta u)$ 		\\
				\T \B			&	$\int dx \ f_c(x) e^{-i u x}$												&	$\Delta u\sqrt{N}$				&	$2\pi/(N \Delta u)$			\\
				\T \B			&	$\frac{1}{2\pi}\int dx \ f_c(x) e^{-2\pi i u x}$		&	$\Delta u\sqrt{N}/2\pi$		&	$1/(N \Delta u)$				\\ \hline
Python (numpy)	\T \B			&	$\frac{1}{\sqrt{2\pi}}\int dx \ f_c(x) e^{-i u x}$	&	$\Delta u N/\sqrt{2\pi}$	&	$2\pi/(N \Delta u)$ 		\\
				\T \B			&	$\int dx \ f_c(x) e^{-i u x}$												&	$\Delta u N$							&	$2\pi/(N \Delta u)$			\\
				\T \B			&	$\frac{1}{2\pi}\int dx \ f_c(x) e^{-2\pi i u x}$		&	$\Delta u N/2\pi$					&	$1/(N \Delta u)$				\\ \hline
\end{tabular}}
\caption{Common inverse CFT conventions listed with the normalization factor and axis scaling factors for sample numerical packages.}
\label{table:inverse_applied_examples}
\end{center}
\end{table}

\end{document}


\documentclass[10pt,a4paper]{article}

% Packages
\usepackage[utf8]{inputenc}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{gensymb}
\usepackage{amsmath}
\usepackage{MnSymbol}
\usepackage{pgfplots}

\title{\textbf{Mathematical proofs}}
\author{Michal Špano}
\date{March 2022}

\begin{document}

\maketitle

\section*{The inner angle of an $n-sided$ convex regular polygon}

% Introduction
Suppose an $n-sided$ convex regular polygon. Its 4 consecutive vertices are shown in the figures, $N_1, N_2, N_3, ..., N_i$ respectively.
Thus $\Delta_{N_1,N_2,S} \cong \Delta_{N_2,N_3,S}$, i.e. such $n-sided$ polygon consists of $n$ congruent isosceles triangles.
That is, $|\measuredangle N_2 N_1 S| = |\measuredangle N_1 N_2 S| \Rightarrow |\measuredangle N_1 N_2 S| = |\measuredangle S N_2 N_3|$, denoted as $\beta, \beta'$ respectively.

% Section I
An angle $\alpha = |\measuredangle N_1 S N_2| = \cfrac{360}{n}$, since such an angle multiplied by $n$ makes for a perfect circle of $360\degree$. Likewise $\alpha = 180\degree - 2 \beta$.

% Section I
Let $\Phi$ be an inner angle of the polygon, such that $\phi = 2 \beta$ (shown in the figure at the vertex $N_2$).

% Steps of computations
Express in terms of $\beta$: $\alpha = 180 - 2 \beta \iff \beta = \cfrac{-\alpha + 180}{2}$

Substitute $\alpha$ for $\alpha = \cfrac{360}{n}$: $\beta = \cfrac{-\cfrac{360}{n} + 180}{2} \iff \beta = \cfrac{180n - 360}{2n}$

Express in terms of $\Phi$: $\Phi = 2 \beta = 2 \Big( \cfrac{180n - 360}{2n} \Big) = \cfrac{180n - 360}{n}$ \\

The expression can be further simplified to the following form:

% End of the proof
$$\Phi = \cfrac{(n-2) \pi}{n}$$.

% Include a picture of a unit circle
\begin{figure}[htp]
    \centering
    \includegraphics[width=4.cm]{polygon_export.png}
    \caption{$n-sided$ polygon with its 4 vertices in a plane}
\end{figure}

\newpage

\section*{The number of diagonals of an $n-sided$ convex regular polygon}

Suppose a geometrical locus of $n$ points on the plane,
% Steps of the proof
i.e. a set of points $A_1, A_2, ..., A_n$
such that $A_1, A_2, ..., A_n$ create an $n-sided$ convex regular polygon.
The number of different abscissas in the geometrical locus is ${n \choose 2}$
and denoted as $N_a$. It implies that no abscissa in the locus is given by more than two points,
i.e. each point is unique. Likewise, $\overlinesegment{A_1A_2} \equiv \overlinesegment{A_2A_1}$
holds for any 2 points in the locus, thus such abscissas are counted as one. It can be inferred
that the number of diagonals, denoted as $N_D$, is the same as \textit{the difference of the number of
abscissas and the number of sides}:

% End of the proof
$$N_D = N_s - n$$

\section*{The similarity coefficient}

% Start of the proof
Suppose a scalene triangle $\Delta_{ABC}$. We assume that there exists a triangle $\Delta_{A'B'C'}$,
such that $\Delta_{ABC} \cong \Delta_{A'B'C'}$. It implies that there exists some constant $c$,
such that any abscissa created in the locus of points (from the original triangle) is equal to the
product of $c$ and the corresponding abscissa of the similar triangle. Symbolically:

% General expression
$\exists! c \in \mathbb{Q}: |V_1 V_2| = c \times |V_1' V_2'| \land c \gneqq 1$, where $V_1, V_2$
are the vertices of the original triangle.

% Section 1 - perimeters
Then, it can be easily inferred, that for the \textbf{perimeters} of the triangles
holds the following: Let $P = \overlinesegment{AB} + \overlinesegment{BC} + \overlinesegment{AC}$, similarly
$P' = \overlinesegment{A'B'} + \overlinesegment{B'C'} + \overlinesegment{A'C'}$. Likewise
% Enumerating the similar sides with a constant
$
\overlinesegment{AB} = c \times \overlinesegment{A'B'} \land
\overlinesegment{BC} = c \times \overlinesegment{B'C'} \land
\overlinesegment{AC} = c \times \overlinesegment{A'C'}
$. \\

% Steps of computation - perimeter
$P = c \times \overlinesegment{A'B'} + c \times \overlinesegment{B'C'} + c
\times \overlinesegment{A'C'} \Rightarrow$
$P = c \times \Big( \overlinesegment{A'B'} + \overlinesegment{B'C'} + \overlinesegment{A'C'} \Big) = c \times P'$

$$P = c \times P'$$.

% Conclusion of section 1
It implies that the ratio of the lengths of the sides of the similar triangles,
i.e. the ratio of their perimeters, is equal to the similarity coefficient:
$c = \cfrac{P}{P'}$. \\

% Section 2 - areas
Similar methodology is applied to the similarity coefficient of the areas of the triangles:

% Steps of computation - area
Let $A = \dfrac{\overlinesegment{AB} \times \overlinesegment{H_{AB}}}{2} \land
A' = \dfrac{\overlinesegment{A'B'} \times \overlinesegment{H'_{AB}}}{2}$,
where $H_{AB}$ and $H'_{AB}$ are the heights of the triangles. Thus,
$A = \dfrac{c \times \overlinesegment{A'B'} c \times \overlinesegment{H'_{AB}}}{2} =
c^2 \times \Bigg( \dfrac{\overlinesegment{A'B'}
\times \overlinesegment{H'_{AB}}}{2} \Bigg) = c^2 \times A'$

$$A = c^2 \times A'$$

% Conclusion of section 2
It implies, that the ratio of the areas equals to the similarity coefficient
taken to the second power: $c^2 = \cfrac{A}{A'}$. \\

% Conclusion
To sum up, such a methodology is also applicable to derive the similarity coefficient
of the volume of the tetrahedron. Moreover, it is also applicable to derive the similarity coefficient
of any planar polygon or solid figure (a scalene triangle per the given example is just an exemplary instance).
Still, the following holds: $P = c \times P' \land A = c^2 \times A' \land V = c^3 \times V'$
based on the principles of \textbf{congruence}.

% End of the proof

\section*{Function bounded above and/or below}

% Start of the proof - bounded above and/or below function

Suppose a function $f$ which has a finite domain, say $D_f$. A function is bounded above if:
$\exists! a \in \mathbb{R}, \forall x \in D_f \subset \mathbb{R}: f(x) \leq a$. That is to say,
that every function value is smaller or equal to some constant, say $a$. Similarly, a function
is bounded below if: $\exists! b \in \mathbb{R}, \forall x \in D_f \subset \mathbb{R}: f(x)
\geq b$. That implies, that every function value is greater or equal to some constant, say $b$.
Lastly, a function is bounded if both of the previous statements hold, i.e.:
$\exists! a \in \mathbb{R}, \exists! b \in \mathbb{R}, \forall x \in D_f \subset \mathbb{R}:
f(x) \leq a \land f(x) \geq b$. Hence, some bounded function $f$ has the following range of
values: $[b;a]$, where $\{a,b\} \in \mathbb{R}$. For example, the function $f(x) = sin(x)$
is bounded, such that $[-1;1]$ is its range of values. \\

% Sample sin(x) plot
\begin{figure}[htp]
    \begin{center}  % Center the image
        \begin{tikzpicture}
            \begin{axis}[domain=0:2*pi,samples=100,smooth,xlabel={$x$},ylabel={$f(x)$}]
                \addplot[color=blue] {sin(deg(x))};  % sine function
                \addplot[color=black] {0};  % vertical line y = 0
            \end{axis}
        \end{tikzpicture}
    \end{center}

    % Caption the figure
    \caption{$sin(x)$, where $x \in [0;2 \pi]$}
\end{figure}

% End of the proof

\newpage

\section*{The standard rules of logarithms}

% Start of the proof - standard rules of logarithms

The following rules of logarithms hold for $x,y,a,s$, such that:

% Variable enumeration
\[\forall x,y \in\mathbb{R^+}, \forall a > 0 \land a \neq 1, \forall s \in\mathbb{R}\]

\begin{enumerate}
    \item{$\boldsymbol{\log_a 1 = 0}$}  % Rule number 1

    For any $a$ holds the following $a^0 = 1$. Therefore $log_a 1 = 0$.

    \item{$\boldsymbol{\log_a a = 1}$}  % Rule number 2

    For any $a$ holds the following $a^1 = a$. Therefore $log_a a = 1$.

    \item{$\boldsymbol{a^{\log_a x} = x}$}  % Rule number 3

    Let $l = \log_a x$. Therefore $a^{l} = x$. Combining the two rules, we obtain the following:
    $a^{\log_a x} = x$.

    \item{$\boldsymbol{\log_a (x \times y) = \log_a x + \log_a y}$}  % Rule number 4

    Suppose some $x,y$, where $x = a^{\log_a x}$, $y = a^{\log_a y}$. If we compute the product
    of them, we obtain that $x \times y = a^{\log_a x} \times a^{\log_a y}$. Furthermore, we
    have that $a^{\log_a x + \log_a y} = x \times y$. According to the previous rule, we
    obtain that $\log_a (x \times y) = \log_a x + \log_a y$.

    \item{$\boldsymbol{\log_a \Big( \frac{x}{y} \Big) = \log_a x - \log_a y}$}  % Rule number 5

    Similarly, suppose some $x,y$, where $x = a^{\log_a x}$, $y = a^{\log_a y}$. If we compute
    the quotient of them, we obtain that $\cfrac{x}{y} = \cfrac{a^{\log_a x}}{a^{\log_a y}}$.
    Furthermore,  we obtain that $a^{\log_a x - \log_a y} = \cfrac{x}{y}$. According to the third
    rule, we have that $\log_a \big(\frac{x}{y}\big) = \log_a x - \log_a y$.

    \item{$\boldsymbol{\log_a x^{s} = s \times \log_a x}$}  % Rule number 6

    Suppose some $x$, where $x = a^{\log_a x}$. Power both sides of the equation by $s$, we
    obtain that $x^{s} = (a^{\log_a x})^{s}$. Therefore $a^{s \times \log_a x} = x^{s}$.
    Having applied the third rule, it can be inferred that $\log_a x^{s} = s \times \log_a x$.

    \item{$\boldsymbol{\log_a x = \dfrac{\log_b x}{\log_b a}}$}  % Rule number 7

    Suppose some $x$, where $x = a^{\log_a x}$. Then, for some $\log$ with the base $b$ and the
    argument $x$ holds $\log_b x = \log_b a^{\log_a x}$. Applying the sixth rule, we obtain that
    $\log_b x = \log_b a \times \log_a x$. Divide the equation by $\log_b a$, thus obtaining
    $\log_a x = \cfrac{\log_b x}{\log_b a}$.

\end{enumerate}

% End of the pr

\newpage

% Start of the proof - sum of n terms of an arithmetic sequence
\section*{The sum of $n$ terms of an arithmetic sequence}

Suppose an arithmetic sequence (also called a progression or a series) $\{a_{n}\}_{n=1}^{\infty}$. That is, a sequence of $n$ terms, where:
$$\exists! d \in \mathbb{R} - \{0\}, \forall i,j \in \mathbb{N}: d = a_{i} - a_{j} \land i - j = 1$$

That implies, that there exists exactly one constant, say $d$, such that the difference between every 2
consecutive terms is $d$. We label the sum of the first $n$ terms of the sequence as $S_{n}=\sum_{i=1}^n a_{i}$.
More explicitly, we have $S_{n} = a_{1} + a_{2} + \dots + a_{n-1} + a_{n}$. Similarly, if we reverse the
sequence, we obtain $S_{n} = a_{n} + a_{n-1} + \dots + a_{2} + a_{1}$. Add the two sums, we obtain:

$$2 \times S_{n} = (a_{1} + a_{n}) + (a_{2} + a_{n-1}) + \dots + (a_{n-1} + a_{2}) + (a_{n} + a_{1})$$

Observe the similarity between the sums. E. g.
$(1 + 4) + (2 + 3) + \dots + (n + k) = (k + n) + \dots + (3 + 2) + (4 + 1)$
Thus, it can be infered that $2 \times S_{n} = n \times (a_{n} + a_{1})$.
Lastly, we have that: $$S_{n} = \cfrac{n \times (a_{n} + a_{1})}{2}$$

\textbf{Conclusion:} The sum of $n$ terms of an arithmetic sequence is $\dfrac{n}{2} (a_{n} + a_{1})$.

% End of the proof

% Start of the proof - sum of n terms of an arithemtic sequence by mathematical induction

\section*{The sum of $n$ terms of an arithmetic sequence (proof)}

Suppose you are given a simple arithmetic sequence, where the difference between every 2 consecutive terms
$d$ is 1. We assume the following (using the notation from the previous section):
$$S_{n} = 1 + 2 + \dots + (n - 1) + n = \sum_{i=1}^{n} i = \frac{n}{2} (n + 1)$$

Formulate a statement, say $S(n)$, which is to be proven.

$$S(n): \forall n \in \mathbb{N}: 1 + 2 + \dots + n = \frac{n}{2} (n + 1)$$

First and foremost, we let $n=1$: $S(1): 1 = \frac{1}{2} (1 + 1)$. That is true. \linebreak  % Step 1
Secondly, assume that $S(k)$ holds for some arbitrary $k \in \mathbb{N}$.  % Step 2
That is our \textbf{induction hypothesis} (also called the induction assumption). We obtain:
$$S(k): 1 + 2 + \dots + k = \frac{k}{2} (k + 1)$$

Thirdly, $S(k) \implies S(k^{+})$, so we let $n=k+1$. Steps of the proof:  % Step 3

$$S(k + 1): 1 + 2 + \dots + k + (k + 1) = \cfrac{(k+1)(k+2)}{2}$$  % Steps of the proof
$$S(k + 1): S(k) + (k + 1) = \cfrac{(k+1)(k+2)}{2}$$
$$S(k + 1): \frac{k}{2} (k + 1) + (k + 1) = \cfrac{(k+1)(k+2)}{2}$$
$$S(k + 1): \cfrac{k(k+1) + 2(k+1)}{2} = \cfrac{(k+1)(k+2)}{2}$$
$$S(k + 1): \cfrac{(k+1)(k+2)}{2} = \cfrac{(k+1)(k+2)}{2}$$

We obtain that $S(k+1)$ holds and so must $S(k)$ (our induction hypothesis). That suffices to prove $S(n)$.
Finally, we have that $S(n)$ holds for all $n \in \mathbb{N}$, and thus \textbf{the proof is complete}.  % Step 4

% End of the proof

\end{document}


\subsection{part a}

We used get\_fog and opt\_app to find first order time delay transfer function (FOTF).
\begin{itemize}
    \item frequency
    $$
    G(s) =  e^{-1.45s} \dfrac{0.375}{0.9587s + 1}
    $$
    \item transfer function
    $$
    G(s) =  e^{-1.39s} \dfrac{0.375}{0.9428s + 1}
    $$
    \item optimum
    $$
    G(s) =  e^{-1.38s} \dfrac{0.383}{s + 1.021}
    $$
\end{itemize}
\begin{figure}[H]
    \caption{system and FOTD step responde}
    \centering
    \includegraphics[width=12cm]{../Figure/Q1/a/FOTD.png}
\end{figure}
I used below cost function to see witch one fits better.
$$
\text{Cost} = \int_{0}^{8} \vert G(t) - G'(t)\vert dt,\qquad \text{$G'$ is FOTD transfer function}
$$
\begin{itemize}
    \item frequency

    Cost = 1.5949
    \item transfer function

    Cost = 1.3208
    \item optimum

    Cost = 1.0345
\end{itemize}
Optimum hase minimum cost so we choise FOTD that used optimum function.