\chapter{mathematical tool solutions}
\begin{abox}
	Practice set 1 solutions
	\end{abox}
\begin{enumerate}
	\begin{minipage}{\textwidth}
		\item Consider a particle in a one dimensional potential that satisfies $V(x)=V(-x)$. Let $\left|\psi_{0}\right\rangle$ and $\left|\psi_{1}\right\rangle$ denote the ground and the first excited states, respectively, and let $|\psi\rangle=\alpha_{0}\left|\psi_{0}\right\rangle+\alpha_{1}\left|\psi_{1}\right\rangle$ be a normalized state with $\alpha_{0}$ and $\alpha_{1}$ being real constants. The expectation value $\langle x\rangle$ of the position operator $x$ in the state $|\psi\rangle$ is given by
		\exyear{NET DEC 2011}
	\end{minipage}
	\begin{tasks}(2)
		\task[\textbf{A.}] $\alpha_{0}^{2}\left\langle\psi_{0}|x| \psi_{0}\right\rangle+\alpha_{1}^{2}\left\langle\psi_{1}|x| \psi_{1}\right\rangle$
		\task[\textbf{B.}]$\alpha_{0} \alpha_{1}\left[\left\langle\psi_{0}|x| \psi_{1}\right\rangle+\left\langle\psi_{1}|x| \psi_{0}\right\rangle\right]$
		\task[\textbf{C.}]$\alpha_{0}^{2}+\alpha_{1}^{2}$
		\task[\textbf{D.}]$2 \alpha_{0} \alpha_{1}$
	\end{tasks}
\begin{answer}
 Since $V(x)=V(-x)$ so potential is symmetric.
	$$
	\begin{aligned}
	&\left\langle\psi_{0}|x| \psi_{0}\right\rangle=0,\left\langle\psi_{1}|x| \psi_{1}\right\rangle=0 \\
	&\langle\psi|x| \psi\rangle=\left(\alpha _ { 0 } \left\langle\psi_{0}\left|+\alpha_{1}\left\langle\psi_{1}\right|\right) \times\left(\alpha_{0}\left|\psi_{0}\right\rangle+\alpha_{1}\left|\psi_{1}\right\rangle\right)=\alpha_{0} \alpha_{1}\left[\left\langle\psi_{0}|x| \psi_{1}\right\rangle+\left\langle\psi_{1}|x| \psi_{0}\right\rangle\right]\right.\right.
	\end{aligned}
	$$
	The correct option is \textbf{(b)}
\end{answer}
\begin{minipage}{\textwidth}
	\item The wave function of a particle at time $t=0$ is given by $|\psi(0)\rangle=\frac{1}{\sqrt{2}}\left(\left|u_{1}\right\rangle+\left|u_{2}\right\rangle\right)$, where
	$\left|u_{1}\right\rangle$ and $\left|u_{2}\right\rangle$ are the normalized eigenstates with eigenvalues $E_{1}$ and $E_{2}$ respectively, $\left(E_{2}>E_{1}\right)$. The shortest time after which $|\psi(t)\rangle$ will become orthogonal to $|\psi(0)\rangle$ is
	\exyear{NET DEC 2011}
\end{minipage}
\begin{tasks}(2)
	\task[\textbf{A.}] $\frac{-\hbar \pi}{2\left(E_{2}-E_{1}\right)}$
	\task[\textbf{B.}]$\frac{\hbar \pi}{E_{2}-E_{1}}$
	\task[\textbf{C.}]$\frac{\sqrt{2} \hbar \pi}{E_{2}-E_{1}}$
	\task[\textbf{D.}]$\frac{2 \hbar \pi}{E_{2}-E_{1}}$
\end{tasks}
\begin{answer}
	$|\psi(0)\rangle=\frac{1}{\sqrt{2}}\left(\left|u_{1}\right\rangle+\left|u_{2}\right\rangle\right) \Rightarrow|\psi(t)\rangle=\frac{1}{\sqrt{2}}\left(\left|u_{1}\right\rangle e^{\frac{-i E_{1} t}{\hbar}}+\left|u_{2}\right\rangle e^{\frac{-i E_{2} t}{\hbar}}\right)$\\
	$|\psi(t)\rangle$ is orthogonal to $|\psi(0)\rangle \Rightarrow\langle\psi(0) \mid \psi(t)\rangle=0 \Rightarrow \frac{1}{2} e^{\frac{-i E_{1} t}{\hbar}}+\frac{1}{2} e^{\frac{-i E_{2} t}{\hbar}}=0$
	\begin{align*}
	&\Rightarrow e^{\frac{-i E_{1} t}{\hbar}}+e^{\frac{-i E_{2} t}{\hbar}}=0 \Rightarrow e^{\frac{-i E_{1} t}{\hbar}}=-e^{\frac{-i E_{2} t}{\hbar}} \Rightarrow e^{i \frac{\left(E_{2}-E_{1}\right)}{\hbar}}=-1 \\
	&\Rightarrow \cos \frac{\left(E_{2}-E_{1}\right) t}{\hbar}=\cos \pi \Rightarrow t=\frac{\pi \hbar}{E_{2}-E_{1}}
	\end{align*}
	The correct option is \textbf{(b)}
\end{answer}
\begin{minipage}{\textwidth}
	\item $\text { The commutator }\left[x^{2}, p^{2}\right] \text { is }$
	\exyear{NET JUNE 2012}
\end{minipage}
\begin{tasks}(2)
	\task[\textbf{A.}] $2 i \hbar x p$
	\task[\textbf{B.}]$2 i \hbar(x p+p x)$
	\task[\textbf{C.}]$2 i \hbar p x$
	\task[\textbf{D.}]$2 i \hbar(x p-p x)$
\end{tasks}
\begin{answer}
$\left[x^{2}, p^{2}\right]=x\left[x, p^{2}\right]+\left[x, p^{2}\right] x=x p[x, p]+x[x, p] p+p[x, p] x+[x, p] p x$\\
$$\left[x^{2}, p^{2}\right]=x p(i \hbar)+x(i \hbar) p+p(i \hbar) x+(i \hbar) p x=2 i \hbar(x p+p x)$$
The correct option is \textbf{(b)}
\end{answer}
\begin{minipage}{\textwidth}
	\item Which of the following is a self-adjoint operator in the spherical polar coordinate system $(r, \theta, \phi)$ ?
	\exyear{NET JUNE 2012}
\end{minipage}
\begin{tasks}(2)
	\task[\textbf{A.}] $-\frac{i \hbar}{\sin ^{2} \theta} \frac{\partial}{\partial \theta}$
	\task[\textbf{B.}]$-i \hbar \frac{\partial}{\partial \theta}$
	\task[\textbf{C.}] $-\frac{i \hbar}{\sin \theta} \frac{\partial}{\partial \theta}$
	\task[\textbf{D.}] $-i \hbar \sin \theta \frac{\partial}{\partial \theta}$
\end{tasks}
\begin{answer}
	$\frac{-i \hbar}{\sin \theta} \frac{\partial}{\partial \theta} \text { is Hermitian. }$\\
	The correct option is \textbf{c}
\end{answer}
\begin{minipage}{\textwidth}
	\item Given the usual canonical commutation relations, the commutator $[A, B]$ of $A=i\left(x p_{y}-y p_{x}\right)$ and $B=\left(y p_{z}+z p_{y}\right)$ is
	\exyear{NET DEC 2012}
\end{minipage}
\begin{tasks}(2)
	\task[\textbf{A.}] $\hbar\left(x p_{z}-p_{x} z\right)$
	\task[\textbf{B.}]$-\hbar\left(x p_{z}-p_{x} z\right)$
	\task[\textbf{C.}]$\hbar\left(x p_{z}+p_{x} z\right)$
	\task[\textbf{D.}]$-\hbar\left(x p_{z}+p_{x} z\right)$
\end{tasks}
\begin{answer}

	\begin{align*}
		&[A, B]=\left\lfloor\left(i x p_{y}-i y p_{x}\right),\left(y p_{z}+z p_{y}\right)\right]\\
		&{[A, B]=i\left[x p_{y}, y p_{z}\right]-i\left[y p_{x}, y p_{z}\right]+i\left\lfloor x p_{y}, z p_{y}\right\rfloor-i\left\lfloor y p_{x}, z p_{y}\right\rfloor} \\
		&\left.\left.[A, B]=i\left[x p_{y}, y p_{z}\right]-0+0-i \mid y p_{x}, z p_{y}\right\rfloor=i\left[x p_{y}, y p_{z}\right\rfloor-i \mid y p_{x}, z p_{y}\right\rfloor \\
		&\left.[A, B]=i x\left[p_{y}, y p_{z}\right\rfloor+i\left[x, y p_{z}\right] p_{y}-i y \mid p_{x}, z p_{y}\right\rfloor-i\left|y, z p_{y}\right| p_{x} \\
		&\left.[A, B]=i x\left[p_{y}, y p_{z}\right\rfloor+0-0-i\left\lfloor y, z p_{y}\right\rfloor p_{x}=i x \mid p_{y}, y p_{z}\right\rfloor-i\left\lfloor y, z p_{y}\right\rfloor p_{x} \\
		&{[A, B]=i x \times(-i \hbar) p_{z}-i z i \hbar \times p_{x}=\hbar\left[x p_{z}+z p_{x}\right]} \\
		&{[A, B]=\hbar\left(x p_{z}+p_{x} z\right)}
	\end{align*}
	The correct option is \textbf{(c)}
\end{answer}
\begin{minipage}{\textwidth}
	\item If the operators $A$ and $B$ satisfy the commutation relation $[A, B]=I$, where $I$ is the identity operator, then
	\exyear{NET JUNE 2013}
\end{minipage}
\begin{tasks}(2)
	\task[\textbf{A.}] $\left[e^{A}, B\right]=e^{A}$
	\task[\textbf{B.}]$\left[e^{A}, B\right]=\left[e^{B}, A\right]$
	\task[\textbf{C.}]$\left[e^{A}, B\right]=\left[e^{-B}, A\right]$
	\task[\textbf{D.}]$\left[e^{A}, B\right]=I$
\end{tasks}

\begin{answer}
	\begin{align*}
	&[A, B]=I \text { and } e^{A}=\left[1+\frac{A}{1}+\frac{A^{2}}{\lfloor 2}+\ldots \ldots . .\right]\\
	&{\left[e^{A}, B\right]=\left[1+\frac{A}{1}+\frac{A^{2}}{L 2}+\ldots \ldots . B\right]=[1, B]+[A, B]+\frac{\left[A^{2}, B\right]}{\lfloor 2}+\frac{\left[A^{3}, B\right]}{\lfloor 3} \ldots .} \\
	&{\left[e^{A}, B\right]=0+I+\frac{A[A, B]+[A, B] A}{2 !}+\frac{A\left[A^{2}, B\right]+\left[A^{2}, B\right] A}{3 !}+\ldots .} \\
	&{\left[e^{A}, B\right]=1+A+\frac{A^{2}}{2 !}+\ldots .=e^{A} \text { where }[A, B]=I,\left[A^{2}, B\right]=2 A \text { and }\left[A^{3}, B\right]=3 A^{2} .}
	\end{align*}
	The correct option is \textbf{(a)}
\end{answer}
\begin{minipage}{\textwidth}
	\item Suppose Hamiltonian of a conservative system in classical mechanics is $H=\omega x p$, where $\omega$ is a constant and $x$ and $p$ are the position and momentum respectively. The corresponding Hamiltonian in quantum mechanics, in the coordinate representation, is
	\exyear{NET DEC 2014}
\end{minipage}
\begin{tasks}(2)
	\task[\textbf{A.}] $-i \hbar \omega\left(x \frac{\partial}{\partial x}-\frac{1}{2}\right)$
	\task[\textbf{B.}]$-i \hbar \omega\left(x \frac{\partial}{\partial x}+\frac{1}{2}\right)$
	\task[\textbf{C.}] $-i \hbar \omega x \frac{\partial}{\partial x}$
	\task[\textbf{D.}]$-\frac{i \hbar \omega}{2} \times \frac{\partial}{\partial x}$
\end{tasks}
\begin{answer}
	$\text { Classically } H=\omega x p \text {, quantum mechanically } H \text { must be Hermitian, }$\\
	So, $H=\frac{\omega}{2}(x p+p x)$ and $H \psi=\frac{\omega}{2}(x p \psi+p x \psi)$
	\begin{align*}
	&\Rightarrow H \psi=\frac{\omega}{2}\left(x(-i \hbar) \frac{\partial \psi}{\partial x}+\frac{-i \hbar \partial(x \psi)}{\partial x}\right)=\frac{\omega}{2}(-i \hbar)\left(x \frac{\partial \psi}{\partial x}+x \frac{\partial \psi}{\partial x}+\psi\right) \\
	&\Rightarrow H \psi=\frac{-i \hbar \omega}{2}\left(2 x \frac{\partial \psi}{\partial x}+\psi\right)=-i \hbar \omega\left(x \frac{\partial}{\partial x}+\frac{1}{2}\right) \psi
	\end{align*}
The correct option is \textbf{(b)}
\end{answer}
\begin{minipage}{\textwidth}
	\item Let $x$ and $p$ denote, respectively, the coordinate and momentum operators satisfying the canonical commutation relation $[x, p]=i$ in natural units $(\hbar=1)$. Then the commutator $\left[x, p e^{-p}\right]$ is
	\exyear{NET DEC 2014}
\end{minipage}
\begin{tasks}(2)
	\task[\textbf{A.}] $i(1-p) e^{-p}$
	\task[\textbf{B.}]$i\left(1-p^{2}\right) e^{-p}$
	\task[\textbf{C.}]$i\left(1-e^{-p}\right)$
	\task[\textbf{D.}]ipe $^{-p}$
\end{tasks}
\begin{answer}
	$\because[x, p]=i$\\
	\begin{align*}
		\left[x, p e^{-p}\right] &=[x, p] e^{-p}+p\left[x, e^{-p}\right]=i e^{-p}+p\left[x, 1-p+\frac{p^{2}}{\lfloor 2}-\frac{p^{3}}{\lfloor 3} \ldots . .\right] \\
		&=i e^{-p}+p\left[[x, 1]-[x, p]+\left[x, \frac{p^{2}}{L 2}\right] \ldots\right]=i e^{-p}+p\left[0-i+\frac{2 i p}{\lfloor 2}-\frac{3 i p^{2}}{\lfloor 3} \ldots \ldots\right] \\
		\Rightarrow\left[x, p e^{-p}\right] &=i e^{-p}-i\left[p-p^{2}+\frac{p^{3}}{\lfloor 2} \ldots . .\right]=i e^{-p}-i p e^{-p}=i(1-p) e^{-p}
	\end{align*}
	The correct option is \textbf{(a)}
\end{answer}
\begin{minipage}{\textwidth}
	\item The wavefunction of a particle in one-dimension is denoted by $\psi(x)$ in the coordinate representation and by $\phi(p)=\int \psi(x) e^{\frac{-i p x}{\hbar}} d x$ in the momentum representation. If the action of an operator $\hat{T}$ on $\psi(x)$ is given by $\hat{T} \psi(x)=\psi(x+a)$, where $a$ is a constant then $\hat{T} \phi(p)$ is given by
	\exyear{NET JUNE 2015}
\end{minipage}
\begin{tasks}(2)
	\task[\textbf{A.}] $-\frac{i}{\hbar} \operatorname{ap} \phi(p)$
	\task[\textbf{B.}]$e^{\frac{-i a p}{\hbar}} \phi(p)$
	\task[\textbf{C.}]$e^{\frac{+i a p}{\hbar}} \phi(p)$
	\task[\textbf{D.}]$\left(1+\frac{i}{\hbar} a p\right) \phi(p)$
\end{tasks}
\begin{answer}
	$\phi(p)=\int \psi(x) e^{\frac{-i p x}{\hbar}} d x$\\
	\begin{align*}
		&T \psi(x)=\psi(x+a) \\
		&T \phi(p)=\int T \psi(x) e^{\frac{-i p x}{\hbar}} d x=\int \psi(x+a) e^{\frac{-i p x}{\hbar}} d x=e^{\frac{i p a}{\hbar}} \int \psi(x+a) e^{\frac{-i p(x+a)}{\hbar}} d x \\
		&\Rightarrow T \phi(p)=e^{\frac{i p a}{\hbar}} \phi(p)
	\end{align*}
	The correct option is \textbf{(c)}
\end{answer}
\begin{minipage}{\textwidth}
	\item Two different sets of orthogonal basis vectors $\left\{\left(\begin{array}{l}1 \\ 0\end{array}\right),\left(\begin{array}{l}0 \\ 1\end{array}\right)\right\}$ and $\left\{\frac{1}{\sqrt{2}}\left(\begin{array}{l}1 \\ 1\end{array}\right), \frac{1}{\sqrt{2}}\left(\begin{array}{c}1 \\ -1\end{array}\right)\right\}$ are given for a two dimensional real vector space. The matrix representation of a linear operator $\hat{A}$ in these basis are related by a unitary transformation. The unitary matrix may be chosen to be
	\exyear{NET JUNE 2015}
\end{minipage}
\begin{tasks}(2)
	\task[\textbf{A.}] $\left(\begin{array}{cc}0 & -1 \\ 1 & 0\end{array}\right)$
	\task[\textbf{B.}]$\left(\begin{array}{ll}0 & 1 \\ 1 & 0\end{array}\right)$
	\task[\textbf{C.}]$\frac{1}{\sqrt{2}}\left(\begin{array}{cc}1 & 1 \\ 1 & -1\end{array}\right)$
	\task[\textbf{D.}] $\frac{1}{\sqrt{2}}\left(\begin{array}{ll}1 & 0 \\ 1 & 1\end{array}\right)$
\end{tasks}
\begin{answer}
$u_{1}=\left(\begin{array}{ll}
	1 & 0 \\
	0 & 1
\end{array}\right), u_{2}=\frac{1}{\sqrt{2}}\left(\begin{array}{cc}
	1 & 1 \\
	1 & -1
\end{array}\right) \Rightarrow u=u_{1} \otimes u_{2}=\frac{1}{\sqrt{2}}\left(\begin{array}{cc}
	1 & 1 \\
	1 & -1
\end{array}\right)$\\
The correct option is \textbf{(c)}
\end{answer}
\begin{minipage}{\textwidth}
\item A Hermitian operator $\hat{O}$ has two normalized eigenstates $|1\rangle$ and $|2\rangle$ with eigenvalues 1 and 2 , respectively. The two states $|u\rangle=\cos \theta|1\rangle+\sin \theta|2\rangle$ and $|v\rangle=\cos \phi|1\rangle+\sin \phi|2\rangle$ are such that $\langle v|\hat{O}| v\rangle=7 / 4$ and $\langle u \mid v\rangle=0$. Which of the following are possible values of $\theta$ and $\phi$ ?
	\exyear{NET DEC 2015}
\end{minipage}
\begin{tasks}(2)
	\task[\textbf{A.}] $\theta=-\frac{\pi}{6}$ and $\phi=\frac{\pi}{3}$
	\task[\textbf{B.}]$\theta=\frac{\pi}{6}$ and $\phi=\frac{\pi}{3}$
	\task[\textbf{C.}]$\theta=-\frac{\pi}{4}$ and $\phi=\frac{\pi}{4}$
	\task[\textbf{D.}]$\theta=\frac{\pi}{3}$ and $\phi=-\frac{\pi}{6}$
\end{tasks}
\begin{answer}
	$|u\rangle=\cos \theta|1\rangle+\sin \theta|2\rangle, \quad|v\rangle=\cos \phi|1\rangle+\sin \phi|2\rangle$\\\\
	it is given
	$\hat{O}|1\rangle=|1\rangle, \quad \hat{O}|2\rangle=2|2\rangle \Rightarrow\langle v|\hat{O}| v\rangle=\frac{7}{4}$\\
	\begin{align*}
		&\cos ^{2} \phi+2 \sin ^{2} \phi=\frac{7}{4} \Rightarrow \cos ^{2} \phi+\sin ^{2} \phi=1 \Rightarrow \sin ^{2} \phi=\frac{7}{4}-1 \\
		&\sin \phi=\frac{\sqrt{3}}{2} \Rightarrow \phi=\frac{\pi}{3} \\
		&\langle u \mid v\rangle=0 \Rightarrow \cos \theta \cos \phi+\sin \theta \sin \phi=0 \Rightarrow \cos (\theta-\phi)=0 \\
		&\Rightarrow \theta-\phi=\frac{\pi}{2} \text { or } \phi-\theta=\frac{\pi}{2} \Rightarrow \theta=\frac{\pi}{2}+\frac{\pi}{3} \text { or } \theta=\frac{\pi}{3}-\frac{\pi}{2} \Rightarrow \theta=\frac{5 \pi}{6} \text { or } \theta=-\frac{\pi}{6}
	\end{align*}
\end{answer}
\begin{minipage}{\textwidth}
	\item If $\hat{L}_{x}, \hat{L}_{y}, \hat{L}_{z}$ are the components of the angular momentum operator in three dimensions the commutator $\left[\hat{L}_{x}, \hat{L}_{x} \hat{L}_{y} \hat{L}_{z}\right]$ may be simplified to
	\exyear{NET JUNE 2016}
\end{minipage}
\begin{tasks}(2)
	\task[\textbf{A.}] $i \hbar L_{x}\left(\hat{L}_{z}^{2}-\hat{L}_{y}^{2}\right)$
	\task[\textbf{B.}]$i \hbar \hat{L}_{z} \hat{L}_{y} \hat{L}_{x}$
	\task[\textbf{C.}]$i \hbar L_{x}\left(2 \hat{L}_{z}^{2}-\hat{L}_{y}^{2}\right)$
	\task[\textbf{D.}]0
\end{tasks}
\begin{answer}
	\begin{align*}
		&:\left[L_{x}, L_{x} L_{y} L_{z}\right]=L_{x}\left[L_{x}, L_{y} L_{z}\right]+\left[L_{x}, L_{x}\right] L_{y} L_{z} \\
		=& L_{x}\left[L_{x}, L_{y}\right] L_{z}+L_{x} L_{y}\left[L_{x}, L_{z}\right]+0=L_{x}\left[i \hbar L_{z}\right] L_{z}+L_{x} L_{y}\left(-i \hbar L_{y}\right) \\
		=& i \hbar L_{x} L_{z}^{2}-i \hbar L_{x} L_{y}^{2}=i \hbar L_{x}\left(L_{z}^{2}-L_{y}^{2}\right)
	\end{align*}
	The correct option is \textbf{(a)}
\end{answer}
\begin{minipage}{\textwidth}
	\item Consider the operator, $a=x+\frac{d}{d x}$ acting on smooth function of $x$. Then commutator $[\alpha, \cos x]$ is
	\exyear{NET DEC 2016}
\end{minipage}
\begin{tasks}(2)
	\task[\textbf{A.}] $-\sin x$
	\task[\textbf{B.}]$\cos x$
	\task[\textbf{C.}]$-\cos x$
	\task[\textbf{D.}]0
\end{tasks}
\begin{answer}

	\begin{align*}
	&a=x+\frac{d}{d x}\\
		&{[a, \cos x]=\left[x+\frac{d}{d x}, \cos x\right]=[x, \cos x]+\left[\frac{d}{d x}, \cos x\right]=0+\left[\frac{d}{d x}, \cos x\right]} \\
		&{\left[\frac{d}{d x}, \cos x\right] \psi(x)=\frac{d}{d x} \cos x \psi(x)-\cos x \frac{d \psi}{d x}} \\
		&=\cos x \frac{d \psi}{d x}+(-\sin x) \psi-\frac{\cos x d \psi}{d x}=-\sin x \psi \\
		&{[a, \cos x] \psi(x)=-\sin x \psi} \\
		&{[a, \cos x]=-\sin x}
	\end{align*}
	The correct option is \textbf{(a)}
\end{answer}
\begin{minipage}{\textwidth}
	\item Consider the operator $\vec{\pi}=\vec{p}-q \vec{A}$, where $\vec{p}$ is the momentum operator, $\vec{A}=\left(A_{x}, A_{y}, A_{z}\right)$ is the vector potential and $q$ denotes the electric charge. If $\vec{B}=\left(B_{x}, B_{y}, B_{z}\right)$ denotes the magnetic field, the $z$-component of the vector operator $\vec{\pi} \times \vec{\pi}$ is
	\exyear{NET DEC 2016}
\end{minipage}
\begin{tasks}(2)
	\task[\textbf{A.}] $i q \hbar B_{z}+q\left(A_{x} p_{y}-A_{y} p_{x}\right)$
	\task[\textbf{B.}]$-i q \hbar B_{z}-q\left(A_{x} p_{y}-A_{y} p_{x}\right)$
	\task[\textbf{C.}]$-i q \hbar B_{2}$
	\task[\textbf{D.}] $i q \hbar B_{z}$
\end{tasks}
\begin{answer}
	$\vec{\pi}=\vec{p}-q \vec{A}$\\
	\begin{align*}
	&(\vec{\pi} \times \vec{\pi}) \psi=(\vec{p}-q \vec{A}) \times(\vec{p}-q \vec{A}) \psi=\vec{p} \times \vec{p} \psi-q \vec{p} \times \vec{A} \psi-q \vec{A} \times \vec{p} \psi+q^{2} \vec{A} \times \vec{A} \psi \\
	&\vec{p} \times \vec{p} \psi=0 \\
	&-q \vec{p} \times \vec{A} \psi=-q(-i \hbar \vec{\nabla} \times \vec{A}) \psi=q i \hbar \vec{B} \psi \\
	&q \vec{A} \times \vec{p} \psi=q(\vec{A}(-i \hbar \vec{\nabla})) \psi=0 \\
	&q^{2} \vec{A} \times \vec{A} \psi=0 \\
	&\vec{\pi} \times \vec{\pi}=q i \hbar \vec{B}
	\end{align*}
	So, $z$ component is given by $q i \hbar B_{z}$\\
	The correct option is \textbf{(d)}
\end{answer}
\begin{minipage}{\textwidth}
	\item $\text { The two vectors }\left(\begin{array}{l}
		a \\
		0
	\end{array}\right) \text { and }\left(\begin{array}{l}
		b \\
		c
	\end{array}\right) \text { are orthonormal if }$
	\exyear{NET JUNE 2017}
\end{minipage}
\begin{tasks}(2)
	\task[\textbf{A.}] $a=\pm 1, b=\pm 1 / \sqrt{2}, c=\pm 1 / \sqrt{2}$
	\task[\textbf{B.}] $a=\pm 1, b=\pm 1, c=0$
	\task[\textbf{C.}]$a=\pm 1, b=0, c=\pm 1$
	\task[\textbf{D.}] $a=\pm 1, b=\pm 1 / 2, c=1 / 2$
\end{tasks}
\begin{answer}
	$\left|\phi_{1}\right\rangle=\left(\begin{array}{l}
		a \\
		0
	\end{array}\right),\left|\phi_{2}\right\rangle=\left(\begin{array}{l}
		b \\
		c
	\end{array}\right)$\\
	$\begin{array}{ll}
		\left\langle\phi_{1} \mid \phi_{1}\right\rangle=1 & \Rightarrow a=\pm 1 \\
		\left\langle\phi_{2} \mid \phi_{2}\right\rangle=1 & \Rightarrow|b|^{2}+|c|^{2}=1 \\
		\left\langle\phi_{1} \mid \phi_{2}\right\rangle=0 & \Rightarrow\left(\begin{array}{ll}
			a & 0
		\end{array}\right)\left(\begin{array}{l}
			b \\
			c
		\end{array}\right)=0 \\
		& a . b+0 \cdot c=0 \Rightarrow a \cdot b=0 \\
		|c|^{2}=1, \quad & \quad c=\pm 1 \quad \text { so } b=0 \\
		a=\pm 1, \quad & b=0, \quad c=\pm 1
	\end{array}$\\
	The correct option  is \textbf{(c)}
\end{answer}
\begin{minipage}{\textwidth}
	\item Let $x$ denote the position operator and $p$ the canonically conjugate momentum operator of a particle. The commutator
	$$
	\left[\frac{1}{2 m} p^{2}+\beta x^{2}, \frac{1}{m} p^{2}+\gamma x^{2}\right]
	$$
	where $\beta$ and $\gamma$ are constants, is zero if
	\exyear{NET DEC 2017}
\end{minipage}
\begin{tasks}(2)
	\task[\textbf{A.}] $\gamma=\beta$
	\task[\textbf{B.}]$\gamma=2 \beta$
	\task[\textbf{C.}]$\gamma=\sqrt{2} \beta$
	\task[\textbf{D.}]$2 \gamma=\beta$
\end{tasks}
\begin{answer}
	\begin{align*}
		&{\left[\frac{1}{2 m} p^{2}+\beta x^{2}, \frac{1}{m} p^{2}+\gamma x^{2}\right]=0 \Rightarrow \frac{1}{2 m} \gamma\left[p^{2}, x^{2}\right]+\frac{\beta}{m}\left[x^{2}, p^{2}\right]=0} \\
		&-\frac{\gamma}{2 m}\left[x^{2}, p^{2}\right]+\frac{\beta}{m}\left[x^{2}, p^{2}\right]=0 \Rightarrow \frac{1}{m}\left[x^{2}, p^{2}\right]\left[\frac{-\gamma}{2}+\beta\right]=0 \Rightarrow \gamma=2 \beta
	\end{align*}
	The correct option is \textbf{(b)}
\end{answer}
\begin{minipage}{\textwidth}
	\item Consider the operator $A_{x}=L_{y} p_{z}-L_{z} p_{y}$, where $L_{i}$ and $p_{i}$ denote, respectively, the components of the angular momentum and momentum operators. The commutator $\left[A_{x}, x\right]$ where $x$ is the $x$ - component of the position operator, is
	\exyear{NET DEC 2018}
\end{minipage}
\begin{tasks}(2)
	\task[\textbf{A.}] $-i \hbar\left(z p_{z}+y p_{y}\right)$
	\task[\textbf{B.}]$-i \hbar\left(z p_{z}-y p_{y}\right)$
	\task[\textbf{C.}]$i \hbar\left(z p_{z}+y p_{y}\right)$
	\task[\textbf{D.}]$i \hbar\left(z p_{z}-y p_{y}\right)$
\end{tasks}
\begin{answer}
	 $A_{x}=L_{y} p_{z}-L_{z} p_{y}, L_{y}=z p_{x}-x p_{z}, L_{z}=x p_{y}-y p_{x}$
	\begin{align*}
	&{\left[A_{x}, x\right]=\left[L_{y} p_{z}, x\right]-\left[L_{z} p_{y}, x\right]=\left[L_{y}, x\right] p_{z}-\left[L_{z}, x\right] p_{y}} \\
	&=\left[z p_{x}, x\right] p_{z}+\left[y p_{x}, x\right] p_{y}=z\left[p_{x}, x\right] p_{z}+y\left[p_{x}, x\right] p_{y} \\
	&=\left(-i \hbar z p_{z}\right)+\left(-i \hbar y p_{y}\right)=-i \hbar\left(z p_{z}+y p_{y}\right)
	\end{align*}
	The correct option is \textbf{(a)}
\end{answer}
\end{enumerate}

\newpage
\begin{abox}
	Practice set 2 solutions
	\end{abox}
\begin{enumerate}
\begin{minipage}{\textwidth}
	\item The quantum mechanical operator for the momentum of a particle moving in one dimension is given by
	\exyear{GATE 2011}
\end{minipage}
\begin{tasks}(2)
	\task[\textbf{A.}] $i \hbar \frac{d}{d x}$
	\task[\textbf{B.}]$-i \hbar \frac{d}{d x}$
	\task[\textbf{C.}]$i \hbar \frac{\partial}{\partial t}$
	\task[\textbf{D.}]$-\frac{\hbar^{2}}{2 m} \frac{d^{2}}{d x^{2}}$
\end{tasks}
\begin{answer}
	The correct option \textbf{(b)}
\end{answer}
\begin{minipage}{\textwidth}
	\item If $L_{x}, L_{y}$ and $L_{z}$ are respectively the $x, y$ and $z$ components of angular momentum operator $L$. The commutator $\left[L_{x} L_{y}, L_{z}\right]$ is equal to
	\exyear{GATE 2011}
\end{minipage}
\begin{tasks}(2)
	\task[\textbf{A.}] $i \hbar\left(L_{x}^{2}+L_{y}^{2}\right)$
	\task[\textbf{B.}]$2 i \hbar L_{z}$
	\task[\textbf{C.}]$i \hbar\left(L_{x}^{2}-L_{y}^{2}\right)$
	\task[\textbf{D.}] 0
\end{tasks}
\begin{answer}
$\left\lfloor L_{x} L_{y}, L_{z}\right]=L_{x}\left[L_{y} L_{z}\right]+\left[L_{x}, L_{z}\right] L_{y}=i \hbar\left(L_{x}^{2}-L_{y}^{2}\right)$\\
The correct option is \textbf{(c)}
\end{answer}
\textbf{common data questions 3 and 4 }\\
In a one-dimensional harmonic oscillator, $\varphi_{0}, \varphi_{1}$ and $\varphi_{2}$ are respectively the ground, first and the second excited states. These three states are normalized and are orthogonal to one another $\psi_{1}$ and $\psi_{2}$ are two states defined by
$$
\psi_{1}=\varphi_{0}-2 \varphi_{1}+3 \varphi_{2}, \psi_{2}=\varphi_{0}-\varphi_{1}+\alpha \varphi_{2}, \psi_{2}=\varphi_{0}-\varphi_{1}+\alpha \varphi_{2}
$$
where $\alpha$ is a constant\\
\begin{minipage}{\textwidth}
	\item $\text { The value of } \alpha \text { which } \psi_{2} \text { is orthogonal to } \psi_{1} \text { is }$
	\exyear{GATE 2011}
\end{minipage}
\begin{tasks}(2)
	\task[\textbf{A.}]2
	\task[\textbf{B.}]1
	\task[\textbf{C.}]-1
	\task[\textbf{D.}]-2
\end{tasks}
\begin{answer}
	$\text { For orthogonal condition scalar product }\left(\psi_{2}, \psi_{1}\right)=0, \text { so } 1+2+3 \alpha=0 \Rightarrow \alpha=-1$\\
	The correct option is \textbf{(c)}
\end{answer}
\begin{minipage}{\textwidth}
	\item For the value of $\alpha$ determined in $\mathrm{Q} 3$, the expectation value of energy of the oscillator in the state $\psi_{2}$ is
\end{minipage}
\begin{tasks}(1)
	\task[\textbf{A.}] $\hbar \omega$
	\task[\textbf{B.}]$3 \hbar \omega / 2$
	\task[\textbf{C.}]$3 \hbar \omega$
	\task[\textbf{D.}]$9 \hbar \omega / 2$
\end{tasks}
\begin{answer}
	$\psi_{2}=\phi_{0}-\phi_{1}+\alpha \phi_{2} \text { put } \alpha=-1,\langle H\rangle=\frac{\left\langle\psi_{2}|H| \psi_{2}\right\rangle}{\left\langle\psi_{2} \mid \psi_{2}\right\rangle}=\frac{\frac{\hbar \omega}{2}+\frac{3 \hbar \omega}{2}+\frac{5 \hbar \omega}{2}}{3}=\frac{3}{2} \hbar \omega$\\
	The correct option is \textbf{(b)}
\end{answer}
\begin{minipage}{\textwidth}
	\item Which one of the following commutation relations is NOT CORRECT? Here, symbols have their usual meanings.
	\exyear{GATE 2013}
\end{minipage}
\begin{tasks}(2)
	\task[\textbf{A.}] $\left[L^{2}, L_{z}\right]=0$
	\task[\textbf{B.}]$\left\lfloor L_{x}, L_{y}\right\rfloor=i \hbar L_{z}$
	\task[\textbf{C.}]$\left[L_{z}, L_{+}\right]=\hbar L_{+}$
	\task[\textbf{D.}] $\left[L_{z}, L_{-}\right]=\hbar L_{-}$
\end{tasks}
\begin{answer}
	The correct option is \textbf{(d)}
\end{answer}
\begin{minipage}{\textwidth}
	\item Let $\vec{L}$ and $\vec{p}$ be the angular and linear momentum operators, respectively, for a a particle. The commutator $\left\lfloor L_{x}, p_{y}\right\rfloor$ gives
	\exyear{GATE 2015}
\end{minipage}
\begin{tasks}(2)
	\task[\textbf{A.}] $-i \hbar p_{z}$
	\task[\textbf{B.}]0
	\task[\textbf{C.}]$i \hbar p_{x}$
	\task[\textbf{D.}]$i \hbar p_{z}$
\end{tasks}
\begin{answer}
\begin{align*}
	&:\left[L_{x}, p_{y}\right]=\left[y p_{z}-z p_{y}, p_{y}\right]=\left[y p_{z}, p_{y}\right]-\left[z p_{y}, p_{y}\right]=\left[y, p_{y}\right] p_{z} \\
	&\cdot\left[p_{y}, p_{y}\right]=0 \text { and }\left[z, p_{y}\right]=0 \Rightarrow\left[L_{x}, p_{y}\right]=i \hbar p_{z} \quad \because\left[y, p_{y}\right]=i \hbar
\end{align*}
The correct option is \textbf{(d)}
\end{answer}
\begin{minipage}{\textwidth}
	\item $\text { Which of the following operators is Hermitian? }$
	\exyear{GATE 2016}
\end{minipage}
\begin{tasks}(2)
	\task[\textbf{A.}] $\frac{d}{d x}$
	\task[\textbf{B.}]$\frac{d^{2}}{d x^{2}}$
	\task[\textbf{C.}]$i \frac{d^{2}}{d x^{2}}$
	\task[\textbf{D.}]$\frac{d^{3}}{d x^{3}}$
\end{tasks}
\begin{answer}
	The correct option is \textbf{(b)}
\end{answer}
\begin{minipage}{\textwidth}
	\item If $x$ and $p$ are the $x$ components of the position and the momentum operators of a particle respectively, the commutator $\left[x^{2}, p^{2}\right]$ is
	\exyear{GATE 2016}
\end{minipage}
\begin{tasks}(2)
	\task[\textbf{A.}] $i \hbar(x p-p x)$
	\task[\textbf{B.}]$2 i \hbar(x p-p x)$
	\task[\textbf{C.}]$i \hbar(x p+p x)$
	\task[\textbf{D.}]$2 i \hbar(x p+p x)$
\end{tasks}\begin{answer}
$\left[x^{2}, p^{2}\right]=p\left[x^{2}, p\right]+\left[x^{2} p\right] p=2 i \hbar p x+2 i \hbar x p \Rightarrow 2 i \hbar(x p+p x)$\\
The correct option is \textbf{(d)}
\end{answer}
\begin{minipage}{\textwidth}
	\item $\text { For the parity operator } P, \text { which of the following statements is NOT true? }$
	\exyear{GATE 2016}
\end{minipage}
\begin{tasks}(2)
	\task[\textbf{A.}] $P^{\dagger}=P$
	\task[\textbf{B.}] $P^{2}=-P$
	\task[\textbf{C.}] $P^{2}=I$
	\task[\textbf{D.}]$P^{\dagger}=P^{-1}$
\end{tasks}
\begin{answer}
	The correct option is \textbf{(b)}
\end{answer}
\begin{minipage}{\textwidth}
	\item $\text { Which one of the following operators is Hermitian? }$
	\exyear{GATE 2017}
\end{minipage}
\begin{tasks}(2)
	\task[\textbf{A.}] $i \frac{\left(p_{x} x^{2}-x^{2} p_{x}\right)}{2}$
	\task[\textbf{B.}]$i \frac{\left(p_{x} x^{2}+x^{2} p_{x}\right)}{2}$
	\task[\textbf{C.}]$e^{i p_{x} a}$
	\task[\textbf{D.}]$e^{-i p_{x} a}$
\end{tasks}
\begin{answer}
	$A=i \frac{\left(p_{x} x^{2}-x^{2} p_{x}\right)}{2}, A^{\dagger}=-i \frac{\left(\left(p_{x} x^{2}\right)^{\dagger}-\left(x^{2} p_{x}\right)^{\dagger}\right)}{2}=i \frac{\left(p_{x} x^{2}-x^{2} p_{x}\right)}{2}$\\
	The correct option is \textbf{(a)}
\end{answer}
\end{enumerate}

QM -CSIR/chapter/mathematical tool solutions.tex


%!TEX root = ../COSCFair.tex

\section{Theoretical Analysis}
\label{sec:theory}

In this section, we discuss the fairness metrics and perform a theoretical analysis to improve the fairness in the predictions of a given classifier. We provide formal definitions of the fairness metrics with more details than our discussion in Section \ref{sec:related}.

\subsection{Fairness Measures}

The concept of fairness is vague and can be interpreted in different ways. For that reason, there are multiple fairness measures that are similar in the intent. However, these measures (metrics) differ in the way of treating the protected groups and conflict with each other in some cases. We list here five of the well-known fairness metrics.

\stitle{Demographic Parity (DP):} this metric states that, the instances in both protected (unprivileged) and unprotected (privileged) groups should have equal probability of being predicted as positive outcome. This metric can be applied on the original class labels in a dataset as well as on the classifier predictions. For a dataset to be fair, the following condition must be satisfied:
\[P\left[Y({\bf x})=1\ |\ S({\bf x})=G' \right]  = P\left[Y({\bf x})=1\ |\ S({\bf x}) = G \right].\] That means,
% \begin{equation} \label{eq:DPDiff}
% \small
% DP_{diff} = P\left[Y({\bf x})=1\ |\ S({\bf x})=G' \right] - P\left[ {Y({\bf x})}=1\ |\ S({\bf x}) = G \right] \approx 0.
% \end{equation}
\begin{align} \label{eq:DPDiff}
\begin{split}
DP_{diff} = &\ P\left[Y({\bf x})=1\ |\ S({\bf x})=G' \right]
    \\& - P\left[ {Y({\bf x})}=1\ |\ S({\bf x}) = G \right] \approx 0.
\end{split}
\end{align}
The same definition can be applied to ensure the classifier's fairness by substituting the original labels by the predicted ones.% in the Equations.

\stitle{Disparate Impact Ratio (DIR):} is defined as the ratio between the probability of protected and unprotected groups getting positive or desired outcomes. Based on a legal rule \cite{US_guideline}, a dataset or a classifier is considered fair if its $DIR$ is at least 0.8, which is also known as the \emph{80\%-rule}. $DIR$ can be formulated as:
\begin{equation}\label{eq:di}
DIR(D) = \frac{ P\left[({\bf x}) = 1 | S({\bf x}) = G\right]} {P\left[Y({\bf x}) = 1 | S({\bf x})=G'\right]}.
\end{equation}
In this research we target increasing the value of $DIR$ to be close to or greater than $0.8$. Similar to demographic parity, this metric can also be used to measure the fairness of the classifier's predictions.

\stitle{Equalized Odds (EO):} this metric states that instances from protected and unprotected groups should have equal True Positive Rate (TPR) and False Positive Rate (FPR).
if we denote, \\
\begin{center}
$P_1 = P\left[ \widehat{Y}({\bf x})=1\ |\ S({\bf x})=G', Y ({\bf x})=1 \right],$\\
$P_2 = P\left[ \widehat{Y}({\bf x})=1\ |\ S({\bf x})=G, Y({\bf x})=1 \right],$\\
$P_3 = P\left[ \widehat{Y}({\bf x})=1\ |\ S({\bf x})=G', Y({\bf x})=0 \right]$, \\
$P_4 = P\left[ \widehat{Y}({\bf x})=1\ |\ S({\bf x})=G, Y({\bf x})=0 \right]$.\\
\end{center}
then the EO is defined as:
\begin{equation}\label{eq:eo}
P_1 = P_2\ \text{and}\ P_3 = P_4 \\
\end{equation}
In our experiments, we use the Average Equalized Odds difference (AEO Diff.), which is defined as:
\[
AEO_{diff} = \frac{(P_1 - P_2)+(P_3 - P_4)}{2}.
\]
According to AEO Diff., a classifier is fair if the $AEO_{diff}$ value should be close to $0$.

\stitle{Predictive Parity:} to deem a classifier as fair in terms of predictive parity, both protected and unprotected groups should have the same positive predictive value. It is formalized as:\\
\begin{small}
\[
P\left[Y({\bf x}) = 1\ |\ \widehat{Y}({\bf x})=1, S({\bf x})=G\right] = P\left[Y({\bf x}) = 1\ |\ \widehat{Y}({\bf x})=1, S({\bf x})=G'\right].
\]
\end{small}

\stitle{Consistency:} this individual fairness metric measures how similar the labels are for the similar instances in a dataset based on the k-neighbors of the instance. Thus, instances should have the same labels if they are similar in terms of features. This metric is formulated as:

% $ y_{NN} = 1 - \frac{1}{n}\sum_{i=1}^n |\hat{y}_i - \frac{1}{{k_{neighbors}}}  \sum_{j\in\mathcal{N}_{{n_{neighbors}}}(x_i)} \hat{y}_j|$.

%this is directly from AIF360 Consistency computation
\[
Consistency = 1 - \frac{1}{|D|}\sum_{i=1}^{|D|} \left| \widehat{y}({\bf x}_i) -
           \frac{1}{\left|kNN({\bf x}_i)\right|} \sum_{{\bf x}_j\in kNN({\bf x}_i)} \widehat{y}({\bf x}_j) \right|,
\]
where $\left|kNN({\bf x})\right|$ represents the set of closed $k$ neighbors for the kNN computation.

Even though the intention of these definitions of fairness through the different metrics is clear, there is no agreement on what should be considered fair/unfair. For example, for an algorithm to be deemed fair, the equalized odds difference should be close to $0$. However, there is no agreement on the cutoff value to consider the algorithm as fair or not. The only exception is the Disparate Impact Ratio (DIR) which is based on the $80\%$ legal rule. Moreover, it is mathematically impossible to satisfy a set of measures at the same time \cite{chouldechova2017fair,kleinberg2017inherent,pleiss2017calibration}. For these reasons, we focus on how to improve the $DIR$ of a dataset (or the output of a ML algorithm) and how the improvement in the $DIR$ values will affect the other metrics such as accuracy and F1-Score.

Let $|D|$ be the number of instances in the dataset $D$, $N_p$ %= \# +ve
be the total number positive examples in the dataset, $N_{G_p}/N_{G'_p}$ %  = \# +ve | S = G
be the number positive examples from the unprivileged/privileged groups, respectively. Let $\xi$ be the percentage value of $DIR$ for the original dataset ($DIR(D) = \xi/100$). Our goal is to increase the value of $DIR$ by $\delta/100$, with $0 < \delta < 125 - \xi $, to make $DIR(C)$ close to or greater than $80\%$, where $C$ is a given classifier. To do so, we should increase/decrease the number of instances that are predicted positive from the unprivileged/privileged groups. If $p(Y({\bf x}) = 1\ |\ S({\bf x}) = G) = \frac{N_{G_p}}{N_G}$, and $p(Y({\bf x}) = 1\ |\ S({\bf x}) = G') = \frac{N_{G'_p}}{N_{G'}}$.
% \fixme{--Hakim: I finished revising the analysis up to this point}
Since, $DIR(D) = \xi\%$ then:
\begin{equation} \label{eq:NGP}
\frac{N_{G_p}/{N_G}}{N_{G'_p}/{N_{G'}}} = \frac{\xi}{100}\ \text{and}\ N_{G_p} = \frac{\xi N_G N_{G'_p}}{100N_{G'}}.
\end{equation}
To increase the value of $DIR(C)$ to $(\xi+\delta)\%$, we need:
\begin{equation}\label{eq:general}
\frac{\left(N_{G_p}+\epsilon\right)/{N_G}}{\left(N_{G'_p}-\gamma\right)/{N_{G'}}} = \frac{\xi+\delta}{100},
% \frac{N_G+\epsilon}{W-\omega-\gamma} = \frac{\xi+\delta}{100}.
\end{equation}
where $\epsilon$ is the number of instances (records) from the unprivileged group that should be predicted positive while their original label is negative.
Conceptually, $\epsilon$ can take any integer value between $0$ and $N_G - N_{G_p}$.
Conversely, $0 < \gamma < N_{G'_p}$ is the number of instances from the privileged group that should be predicted negative while their original label is positive.
Solving for $\epsilon$ and $\gamma$, we get:
\begin{equation} \label{eq:compute_eps_gam}
    \frac{\left(N_{G_p}+\epsilon\right){N_{G'}}}{\left(N_{G'_p}-\gamma\right){N_{G}}} = \frac{\xi+\delta}{100}.
\end{equation}

Substituting $N_{G_P}$ from Eq. (\ref{eq:NGP}) in Eq. (\ref{eq:compute_eps_gam}), we get:
\[
\left(\xi + \delta\right)\left(N_{G'_p}-\gamma\right)N_{G} = 100 N_{G'} \left(\frac{\xi N_G N_{G'_p}}{100N_{G'}} + \epsilon\right)
\]
Hence:
\[
100 \epsilon N_{G'} +\gamma \left(\xi + \delta\right) N_{G} = \delta N_{G'_p} N_G
\]
We can distinguish between three special cases:
\begin{enumerate}[label=\textbf{C\arabic*:}]
    \item $\epsilon = \gamma$, in this case we need to increase the number of instances from the protected group that are predicted positive by $\epsilon = \frac{\delta N_{G'_p} N_G}{100N_{G'}+\left(\xi+\delta\right)N_G}$ and decrease the number of instances from the unprotected group that are predicted positive by the same amount.
    \item $\gamma = 0$, in this case we need to increase the number of instances from the protected group that are predicted positive by $\epsilon = \frac{\delta N_{G'_p} N_G}{100N_{G'}}$ while keeping the same number of positives from the unprotected group.
    \item $\epsilon = 0$, in this case we need to decrease the number of instances from the unprotected group that are predicted positive by $\gamma = \frac{\delta N_{G'_p} N_G}{\left(\xi+\delta\right)N_G}$ while keeping the same number of positives from the protected group.
\end{enumerate}

Since the number of instances (records) from the unprivileged group is significantly smaller than the number of instances from the privileged group, it can be easily shown that increasing the positives of the unprivileged group while keeping the number of positives from the privileged group unchanged will incur the minimum number of changes (case {\bf C2}: $\gamma = 0$). This cannot be achieved in real life scenarios but we can increase the probability of classifying an instance as positive given that it is from the unprivileged group.
To do so, we consider generating more examples from the  unprivileged group with positive label.To do so, we use oversampling technique to generate synthetic data from the class of the minority. Since the synthetic data generator, such as SMOTE~\cite{smote}, interpolates the original instances in the training set to generate new instances, the quality of the generated instances depends on the similarity between the interpolated instances. To increase the similarity between the instances, we cluster the data before generating the new instances.
In the evaluation section, we report the number of instances that have been predicted differently due to our solution.

It should be noted that improving the $DIR$ metric will certainly affect the other metrics. For example, according to Eq. (\ref{eq:general}), increasing $DIR$ by $\delta$ will have the following effects: i) the number of True Positives (TP) will be decreased by $\gamma$. We assume that we have trained a perfect classifier, which can predict all the labels in the test set correctly. Based on the required changes in the classifier's predictions, if the original true positives is $TP$ then the new true positives $TP'= TP - \gamma$; ii) similarly, the True Negatives will be decreased by $\epsilon$ (i.e. $TN'= TN -\epsilon$); iii) The False Positives (FP) will be increased by $\epsilon$ ($FP'= FP + \epsilon$) and the False Negatives (FN) will be increased by $\gamma$ ($FN'= FN + \gamma$). Thus, the perfect classifier's accuracy will be decreased by $\left(\frac{\gamma+\epsilon}{|D|}\right)$. If $F'_1$ is the new $F1\text{-}Score$, then $F'_1 = \frac{2*(TP-\gamma)}{2*TP+FN+FP+\epsilon-\gamma}$. For the case of perfect classifier, $F_1 = 1$ and $F'_1 = \frac{2(TP-\gamma)}{2TP -\gamma+\epsilon}$. The decrease in the $F1\text{-}Score$ will be $1 - \frac{2(TP-\gamma)}{2TP -\gamma+\epsilon}$.

\begin{example}
\noindent The German dataset \cite{UCIdfs} has 1000 instances. We split the dataset for training and testing using the 70/30 rule with stratification. In the test set $T$, we have $N_{G'} = 181$ instances from the privileged group and $N_G = 31$ from the unprivileged group. The number of positive instances from privileged/unprivileged is $(N_{G'_p} = 134)$/$(N_{G_p} = 17)$, respectively. In this case, improving $DIR(C)$ from $74\%$ to be greater than $80\%$ while considering $\epsilon = 0$ in Eq. (\ref{eq:general}) and assuming that we have a perfect classifier, we will need to predict approximately $10$ instances from the privileged group to be negative instead of their original positive label. In this case, the accuracy of the perfect classifier will decrease by $10/300 = 3.3\%$ and $F1\text{-}Score$ will be reduced by $\frac{10}{2*210-10}= 2.4\%$. However, when $\gamma = 0$, $\epsilon$ will be 2 and the decrease in accuracy and $F1\text{-}Score$ will be $0.6\%$ and $0.5\%$, respectively.
\end{example}

% Based on our analysis and the statistics from the data, we can conclude that the classifier fail to predict more positive instances from the unprivileged group because the number of positive instances in the training set is small compared to the number of positive instances from the privileged group. To solve the problem, we consider generating more examples from the  unprivileged group with positive label.To do so, we use oversampling technique to generate synthetic data from the class of the minority. Since the synthetic data generator, such as SMOTE~\cite{smote}, interpolates the original instances in the training set to generate new instances, the quality of the generated instances depends on the similarity between the interpolated instances. To increase the similarity between the instances, we cluster the data before generating the new instances.


\chapter{Number theory}
\label{chap:Number theory}

In this chapter, you will learn about the
number theoretic functions in libzahl.

\vspace{1cm}
\minitoc

\newpage
\section{Odd or even}
\label{sec:Odd or even}

There are four functions available for testing
the oddness and evenness of an integer:

\begin{alltt}
   int zodd(z_t a);
   int zeven(z_t a);
   int zodd_nonzero(z_t a);
   int zeven_nonzero(z_t a);
\end{alltt}

\noindent
{\tt zodd} returns 1 if {\tt a} contains an
odd value, or 0 if {\tt a} contains an even
number. Conversely, {\tt zeven} returns 1 if
{\tt a} contains an even value, or 0 if {\tt a}
contains an odd number. {\tt zodd\_nonzero} and
{\tt zeven\_nonzero} behave exactly like {\tt zodd}
and {\tt zeven}, respectively, but assumes that
{\tt a} contains a non-zero value, if not
undefined behaviour is invoked, possibly in the
form of a segmentation fault; they are thus
sligtly faster than {\tt zodd} and {\tt zeven}.

It is discouraged to test the returned value
against 1, we should always test against 0,
treating all non-zero value as equivalent to 1.
For clarity, we use also avoid testing that
the returned value is zero, for example, rather
than {\tt !zeven(a)} we write {\tt zodd(a)}.

\newpage
\section{Signum}
\label{sec:Signum}

There are two functions available for testing
the sign of an integer, one of the can be used
to retrieve the sign:

\begin{alltt}
   int zsignum(z_t a);
   int zzero(z_t a);
\end{alltt}

\noindent
{\tt zsignum} returns $-1$ if $a < 0$,
$0$ if $a = 0$, and $+1$ if $a > 0$, that is,

\vspace{1em}
\( \displaystyle{
    \mbox{sgn}~a = \left \lbrace \begin{array}{rl}
        -1 & \textrm{if}~ a < 0 \\
         0 & \textrm{if}~ a = 0 \\
        +1 & \textrm{if}~ a > 0
    \end{array} \right .
}\)
\vspace{1em}

\noindent
It is discouraged to compare the returned value
against $-1$ and $+1$; always compare against 0,
for example:

\begin{alltt}
   if (zsignum(a) >  0)  "positive";
   if (zsignum(a) >= 0)  "non-negative";
   if (zsignum(a) == 0)  "zero";
   if (!zsignum(a))      "zero";
   if (zsignum(a) <= 0)  "non-positive";
   if (zsignum(a) <  0)  "negative";
   if (zsignum(a))       "non-zero";
\end{alltt}

\noindent
However, when we are doing arithmetic with the
signum, we may relay on the result never being
any other value than $-1$, $0$, and $+0$.
For example:

\begin{alltt}
   zset(sgn, zsignum(a));
   zadd(b, sgn);
\end{alltt}

{\tt zzero} returns 0 if $a = 0$ or 1 if
$a \neq 0$. Like with {\tt zsignum}, avoid
testing the returned value against 1, rather
test that the returned value is not 0. When
however we are doing arithmetic with the
result, we may relay on the result never
being any other value than 0 or 1.

\newpage
\section{Greatest common divisor}
\label{sec:Greatest common divisor}

There is no single agreed upon definition
for the greatest common divisor of two
integer, that cover non-positive integers.
In libzahl we define it as

\vspace{1em}
\( \displaystyle{
    \gcd(a, b) = \left \lbrace \begin{array}{rl}
        -k & \textrm{if}~ a < 0, b < 0 \\
        b  & \textrm{if}~ a = 0 \\
        a  & \textrm{if}~ b = 0 \\
        k  & \textrm{otherwise}
    \end{array} \right .
}\),
\vspace{1em}

\noindent
where $k$ is the largest integer that divides
both $\lvert a \rvert$ and $\lvert b \rvert$. This
definion ensures

\vspace{1em}
\( \displaystyle{
    \frac{a}{\gcd(a, b)} \left \lbrace \begin{array}{rl}
        > 0 & \textrm{if}~ a < 0, b < 0 \\
        < 0 & \textrm{if}~ a < 0, b > 0 \\
        = 1 & \textrm{if}~ b = 0, a \neq 0 \\
        = 0 & \textrm{if}~ a = 0, b \neq 0 \\
        \in \textbf{N} & \textrm{otherwise if}~ a \neq 0, b \neq 0
    \end{array} \right .
}\),
\vspace{1em}

\noindent
and analogously for $\frac{b}{\gcd(a,\,b)}$. Note however,
the convension $\gcd(0, 0) = 0$ is adhered. Therefore,
before dividing with $\gcd(a, b)$ you may want to check
whether $\gcd(a, b) = 0$. $\gcd(a, b)$ is calculated
with {\tt zgcd(a, b)}.

{\tt zgcd} calculates the greatest common divisor using
the Binary GCD algorithm.

\vspace{1em}
\hspace{-2.8ex}
\begin{minipage}{\linewidth}
\begin{algorithmic}
    \RETURN $a + b$ {\bf if} $ab = 0$
    \RETURN $-\gcd(\lvert a \rvert, \lvert b \rvert)$ {\bf if} $a < 0$ \AND $b < 0$
    \STATE $s \gets \max s : 2^s \vert a, b$
    \STATE $u, v \gets \lvert a \rvert \div 2^s, \lvert b \rvert \div 2^s$
    \WHILE{$u \neq v$}
        \STATE $v \leftrightarrow u$ {\bf if} $v < u$
        \STATE $v \gets v - u$
        \STATE $v \gets v \div 2^x$, where $x = \max x : 2^x \vert v$
    \ENDWHILE
    \RETURN $u \cdot 2^s$
\end{algorithmic}
\end{minipage}
\vspace{1em}

\noindent
$\max x : 2^x \vert z$ is returned by {\tt zlsb(z)}
\psecref{sec:Boundary}.

\newpage
\section{Primality test}
\label{sec:Primality test}

The primality of an integer can be tested with

\begin{alltt}
   enum zprimality zptest(z_t w, z_t a, int t);
\end{alltt}

\noindent
{\tt zptest} uses Miller–Rabin primality test,
with {\tt t} runs of its witness loop, to
determine whether {\tt a} is prime. {\tt zptest}
returns either

\begin{itemize}
\item {\tt PRIME} = 2:
{\tt a} is prime. This is only returned for
known prime numbers: 2 and 3.

\item {\tt PROBABLY\_PRIME} = 1:
{\tt a} is probably a prime. The certainty
will be $1 - 4^{-t}$.

\item {\tt NONPRIME} = 0:
{\tt a} is either composite, non-positive, or 1.
It is certain that {\tt a} is not prime.
\end{itemize}

If and only if {\tt NONPRIME} is returned, a
value will be assigned to {\tt w} — unless
{\tt w} is {\tt NULL}. This will be the witness
of {\tt a}'s completeness. If $a \le 1$, it
is not really composite, and the value of
{\tt a} is copied into {\tt w}.

$\gcd(w, a)$ can be used to extract a factor
of $a$. This factor is however not necessarily,
and unlikely so, prime, but can be composite,
or even 1. In the latter case this becomes
utterly useless. Therefore using this method
for prime factorisation is a bad idea.

Below is pseudocode for the Miller–Rabin primality
test with witness return.

\vspace{1em}
\hspace{-2.8ex}
\begin{minipage}{\linewidth}
\begin{algorithmic}
    \RETURN NONPRIME ($w \gets a$) {\bf if} {$a \le 1$}
    \RETURN PRIME {\bf if} {$a \le 3$}
    \RETURN NONPRIME ($w \gets 2$) {\bf if} {$2 \vert a$}
    \STATE $r \gets \max r : 2^r \vert (a - 1)$
    \STATE $d \gets (a - 1) \div 2^r$
    \STATE {\bf repeat} $t$ {\bf times}

    \hspace{2ex}
    \begin{minipage}{\linewidth}
        \STATE $k \xleftarrow{\$} \textbf{Z}_{a - 2} \setminus \textbf{Z}_{2}$ \textcolor{c}{\{Uniformly random assignment.\}}
        \STATE $x \gets k^d \mod a$
        \STATE {\bf continue} {\bf if} $x = 1$ \OR $x = a - 1$
        \STATE {\bf repeat} $r$ {\bf times or until} $x = 1$ \OR $x = a - 1$

        \hspace{2ex}
        \begin{minipage}{\linewidth}
            \vspace{-1ex}
            \STATE $x \gets x^2 \mod a$
        \end{minipage}
        \vspace{-1.5em}
        \STATE {\bf end repeat}
        \STATE {\bf if} $x = 1$ {\bf return} NONPRIME ($w \gets k$)
    \end{minipage}
    \vspace{-0.8ex}
    \STATE {\bf end repeat}
    \RETURN PROBABLY PRIME
\end{algorithmic}
\end{minipage}
\vspace{1em}

\noindent
$\max x : 2^x \vert z$ is returned by {\tt zlsb(z)}
\psecref{sec:Boundary}.


% Copyright 2018 Melvin Eloy Irizarry-Gelpí
\chapter{ABW Octonion}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
An ABW octonion has the form
\begin{equation}
    a_{0} + a_{1} A + a_{2} B + a_{3} AB + a_{4} W + a_{5} AW + a_{6} BW + a_{7} ABW
\end{equation}
These follow from a parabolic Cayley-Dickson construct on the AB quaternions.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Arithmetic Operations}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Multiplication}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Conjugate Operations}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Asterisk Conjugation}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Quadrance}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Cloak Conjugation}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Dagger Conjugation}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Hodge Star}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Zero-Divisors}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Differential Operators}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
...


% !TeX root = ../thuthesis-example.tex

\chapter{MATHEMATICAL SYMBOLS AND FORMULA}

\section{Symbols}

As required by the national formatting standards, the template uses \pkg{unicode-math} for formatting mathematical symbols, which differs to the default used by LATEX.

\begin{enumerate}
  \item Capital Greek letters are italic by default e.g. \cs{Delta}：$\Delta$。
  \item Increment symbol: $\increment$（U+2206）
  \item Vectors, matrices, tensors should be ITALIC, and BOLD using the \cs{symbf} command; for example: $\symbf{A}$, $\symbf{\alpha}$.
  \item For constants and special functions, use the \cs{symup} command. For example:
    $\symup{\pi} = 3.14\dots$; $\symup{e} = 2.718\dots$，
  \item Example of integrals and differentials: $\int f(x) \dif x$。
\end{enumerate}

For more usage of symbols, you could use the following references
\href{http://mirrors.ctan.org/macros/latex/contrib/unicode-math/unicode-math.pdf}{\pkg{unicode-math}}
\href{http://mirrors.ctan.org/macros/latex/contrib/unicode-math/unimath-symbols.pdf}{\pkg{unimath-symbols}}.

For units and metrics, it is recommended to use the following package:
\href{http://mirrors.ctan.org/macros/latex/contrib/siunitx/siunitx.pdf}{\pkg{siunitx}}
It can conveniently handle the space between Greek letters/numbers and the unit. For example:
\SI{6.4e6}{m}，
\SI{9}{\micro\meter}，
\si{kg.m.s^{-1}}，
\SIrange{10}{20}{\degreeCelsius}。

\section{Mathematical formula}

You can use the following environments \env{equation} 和 \env{equation*} for mathematical formulae.

Please pay attention that round brackets should be included before and after referencing an equation: e.g. Equation \eqref{eq:example}.

\begin{equation}
  \frac{1}{2 \symup{\pi} \symup{i}} \int_\gamma f = \sum_{k=1}^m n(\gamma; a_k) \mathscr{R}(f; a_k)
  \label{eq:example}
\end{equation}

When there are multiple equations, please try to align them at the "equal" sign if possible. We recommend using the \env{align} environment.
For example:
\begin{align}
  a & = b + c + d + e \\
    & = f + g
\end{align}

\section{Mathematical axioms and proofs}

You can use \pkg{amsthm} or \pkg{ntheorem} packages to set up your axiom. After loading one of those package, the template will automatically setup the environments: \env{theorem} and \env{proof}

An example:
\begin{theorem}[Lindeberg--Lévy Central Limit Theorem]
  Set random variables $X_1, X_2, \dots, X_n$ i.i.d., with expectation mean of $\mu$ and variance $\sigma^2 \ne 0$. By formula, $\bar{X}_n = \frac{1}{n} \sum_{i+1}^n X_i$, we have
  \begin{equation}
    \lim_{n \to \infty} P \left(\frac{\sqrt{n} \left( \bar{X}_n - \mu \right)}{\sigma} \le z \right) = \Phi(z),
  \end{equation}
  where $\Phi(z)$ is the function of a normal distribution.
\end{theorem}
\begin{proof}
  Trivial.
\end{proof}

The template also provides the following environments: \env{assumption}、\env{definition}、\env{proposition}、
\env{lemma}、\env{theorem}、\env{axiom}、\env{corollary}、\env{exercise}、
\env{example}、\env{remar}、\env{problem}、\env{conjecture}


\subsubsection{Single Fungal Species}
It is simple to analyze and predict a single species of fungus, because in this ideal environment, the growth and reproduction process of a single fungus can be accurately represented by the \textbf{Logistic Model}. Substitute data of $F_A\sim F_E$ into the previous differential equation \textit{Eq.~(\ref{12eq})} and get \textit{Eq.~(\ref{14eq})} as follows.
\begin{equation}
  \label{14eq}
  \begin{cases}
    \frac{1}{N_A(t)}\frac{dN_A(t)}{dt} = r_A(1-\frac{N_A(t)}{{N_A}_{max}}) \\ \\
    \frac{1}{N_B(t)}\frac{dN_B(t)}{dt} = r_B(1-\frac{N_B(t)}{{N_B}_{max}}) \\ \\
    \frac{1}{N_C(t)}\frac{dN_C(t)}{dt} = r_C(1-\frac{N_C(t)}{{N_C}_{max}}) \\ \\
    \frac{1}{N_D(t)}\frac{dN_D(t)}{dt} = r_D(1-\frac{N_D(t)}{{N_D}_{max}}) \\ \\
    \frac{1}{N_E(t)}\frac{dN_E(t)}{dt} = r_E(1-\frac{N_E(t)}{{N_E}_{max}}) \\
  \end{cases}
\end{equation}
The function curves of $N_A(t)$, $N_B(t)$, $N_C(t)$, $N_D(t)$, and $N_E(t)$ are as follows.
\par
\begin{figure}[H]
  \centering
  \label{functioncurves}
  \includegraphics[width=\textwidth]{figures/Single.png}
  \caption{Function curves of each single fungus.}
\end{figure}
\par
The fungal data in the above figure are all based on the research and analysis of the environmental climate in \textit{Table~\ref{fivetypicalfungalspecies}}. The temperature, moisture and so on indicated in the table are the most suitable environmental conditions for the five fungi. Looking up the climatic data, it is found that the optimal growth environment of the five fungi corresponds exactly to the five typical climatic characteristics, including arid, semi-arid, temperate, arboreal and tropical rain forests. Therefore, it is obvious that when five species of fungi $F_A\sim F_E$, grow and reproduce under the optimal conditions, they can exert their greatest advantages in decomposing lignin or cellulose. On the contrary, these fungi will be at disadvantages due to excessive environmental blocking.
\begin{table}[H]
  \centering
  \caption{Corresponding optimal environment for the five fungi.}
  \label{correspondingoptimalenvironment}
  \begin{tabular*}{\hsize}{@{\extracolsep{\fill}}cccc}
    \toprule
    & Fungi & Corresponding Environment & \\
    \midrule
    & $F_A$ & Arid & \\
    & $F_B$ & Semi-arid & \\
    & $F_C$ & Temperate & \\
    & $F_D$ & Arboreal & \\
    & $F_E$ & Tropical rain forests & \\
    \bottomrule
  \end{tabular*}
\end{table}
The above table illustrates the corresponding optimal environment when the five fungi live alone, but it is quite different from the real situation in the nature. The following will further analyze the combinations between fungal species.


\documentclass{article}
\usepackage{amsmath}
\usepackage[margin=1.0in]{geometry}
\usepackage{xcolor}

\begin{document}

\noindent
Does $\displaystyle \sum_{n=1}^\infty \frac{1}{n^{3/2}}$
diverge, converge absolutely, or converge conditionally?

\subsection*{Solution}

$\displaystyle \sum_{n=1}^\infty \frac{1}{n^{3/2}}$ is a $p$-series with $p=\frac32$. Since $p>1$, the series $\displaystyle \sum_{n=1}^\infty \frac{1}{n^{3/2}}$ converges by the $p$-series test.

Since $\sum |a_n| = \sum a_n$, the series $\displaystyle \sum_{n=1}^\infty  \frac{1}{n^{3/2}}$ converges absolutely.

\subsection*{Other solution}

You can also use the Integral Test, but when the $p$-test works, why work more?

\end{document}%%%%%%%%%%%%%%%%%

\begin{align*}
L&=\lim_{n \to \infty} \sqrt[n]{|a_n|}\\
&= \lim_{n \to \infty} \sqrt[n]{\left| \right|}\\
\end{align*}

\begin{align*}
L&=\lim_{n \to \infty} \left|\frac{a_{n+1}}{a_n}\right|\\
&= \lim_{n \to \infty} \left| \right|\\
\end{align*}

\begin{align*}
\lim_{n \to \infty} a_n
&= \lim_{n \to \infty} \\
\end{align*}

Since $\sum |a_n| = \sum a_n$, the series $\displaystyle \sum_{n=1}^\infty AAAAAAAAAAAAAA$ converges absolutely.

Since $|r| < 1$, the series ...  converges by the Geometric Series Test.

Since $|r| \geq 1$, the series ...  diverges by the Geometric Series Test.

The function $f(x)=\frac{}{}$ is continuous, positive, and decreasing on $[1,\infty)$.

\subsection*{Solution}


\mychapter{14}{Lesson 14} %181114

\subsubsection{Decisional Diffie-Hellman (cont'd)}

%AP190913: Is p supposed to be prime?
\begin{claim}
    \ddh{} is not hard for groups $\integer_p^\times$
\end{claim}

\begin{proof}
    Let $\quadres_p$ be the group of quadratic residues modulo $p$, where the group operation is multiplication:
    \[
        \quadres(p) = \{y : \exists x \in \integer_p \implies y \equiv_p x^2\} = \{g^z : \forall z\}
    \]
    where $g$ generates $\integer_p^\times$.Then, we can test if a give number $y$ is in $\quadres_p$ by checking if $y^{(p-1)/2} \equiv_p 1$, because:
    \[
        \exists z : y = g^{2z} \implies y^{(p-1)/2} = g^{\frac{2z(p-1)}{2}} = g^{z(p-1)} \equiv_p 1
    \]
    Otherwise: % AP190208: Not sure at all that this is correct
    \[
        \nexists z : y = g^{2z} \implies y^{(p-1)/2} \equiv_p g^{z(p-1)} \cdot g^{(p-1)/2} \not\equiv_p 1
    \]

    Furthermore: $g^{xy} \in \quadres_p \implies x \equiv_2 0 \vee y \equiv_2 0$. With this in mind, given a random choice of $x$ and $y$, the probability that $g^{xy}$ falls in $\quadres(p)$ is $\frac{3}{4}$, and the probability of it being outside the group is $\frac{1}{4}$. This is an advantage available to a polynomial adversary.
\end{proof}

Nevertheless, some other groups are believed to harden quadratic residue membership; examples of such groups are $\quadres_p$ itself for $p = 2q + 1$, where $q$ is prime, or the elliptic curve groups.

\subsubsection{Extended \ddh}

This is a construction that takes the \ddh{} assumption to an extreme using groups. The \ddh{} assumption is reported here:
\[
    (G, g, q) \pickUAR \groupgen(1^\lambda), \forall i\: X_i, Y_i, Z_i \sim \unifdist(G) \implies (g^X, g^Y, g^{XY}) \compindist (g^X, g^Y, g^Z)
\]
where $X$, $Y$ and $Z$ are distribution ensembles.

The construction extends this concept of hardness in detecting $xy$ by replicating it $n$-times:
\begin{theorem}
    Let $X$, $Y_{1\upto n}$ and $Z_{1 \upto n}$ be distribution ensembles over a group $(G, g, q)$ Then:
    \[
        (g^X, g^{Y_1}, g^{XY_1}, \dots, g^{Y_n}, g^{XY_n}) \compindist (g^X, g^{Y_1}, g^{Z_1}, \dots, g^{Y_n}, g^{Z_n})
    \]
\end{theorem}

\begin{proof}
    \todo{The game is modified a bit to ease the analysis of the reduction, must take care...

    Also, this kind of proof is ``tight''; the hybridization would have introduced a negligible difference instead}

    The proof can be structured by progressive hybridization over the sequences, and breaking the \ddh{} assumption at any step $i$. Here instead, we will simulate the \textsc{ext} sequence directly in the distinguishing game, and assume there is $\distinguisher^{\textsc{ext}}$ capable of telling them apart; figure \ref{cryptoredux:extddh} shows the steps to take.

    \begin{cryptoredux}
        {extddh}
        {Breaking \ddh{} by distinguishing the \ddh{} sequence}
        {ddh}
        {ext}

        \cseqdelay
        \receive{\shortstack[l]{
            %AP190913: Actually, the adversary knows this!
            $(G, g, q) \pickUAR \groupgen(1^\lambda)$ \\
            $x, y \pickUAR \integer_q$ \\
            $b \pickUAR \binary$ \\
            $\beta_b \pickUAR \{0, \integer_q\setminus\{0\}\}$ \\
            $z_b = xy + \beta_b$
        }}{$(g^x, g^y, g^{z_b})$}{}

        \cseqbeginloop
        \cseqdelay
        \cseqadversary{\shortstack[r]{
            $u_i, v_i \pickUAR \integer_p$ \\
            $g^{y_i} = (g^y)^{u_j}g^{v_j}$ \\
            $g^{z_i} = (g^z)^{u_j}(g^x)^{v_j}$
        }}
        \cseqdelay
        \cseqendloop
        \cseqdelay

        \invoke{}{$(g^x, g^{y_1}, g^{z_1}, \dots)$}{}

        \return{}{$b'$}{}

        \send{}{$b'$}{\textsc{Output 1 iff} $b' = b$}

    \end{cryptoredux}

\end{proof}

Notice that $(g^y)^{u_j}g^{v_j}= g^{yu_j + v_j}$, and $(g^z)^{u_j}(g^x)^{v_j} = g^{zu_j + xv_j}$, which depending on what $z$ is, becomes either $g^{x(yu_j + v_j)}$, matching perfectly the $y_i$ case, or remains as a random linear combination, matching the $z_i$ case.

\subsubsection{Naor-Reingold \prf}

This is an alternative to the extended \ddh{} seen above, designed by Moni Naor and Omer Reingold. It constructs a \prf{} as follows:
\[
    F^{\textsc{nr}} \in \integer_q^{(n+1)} \times \binary^n \to (G, g, q) : f^{\textsc{nr}}_k(x_{1\upto n}) \mapsto g^{k_0\prod_{i = 1}^{n}k_i^{x_i}}
\]

\todo{Transcribing notes directly:
\{
This is \ggm{} with $G^{g, q, a}(g^b) = G_0(g^b) \mathrel{||} G_1(g^b) = (g^b, g^{ab})$

E.g.: $011 \mapsto g^{a_0a_1^0a_2^1a_3^1}$

\}

Notes about claw-free permutations follow; also, hash functions make an appearance

}

\begin{figure}
    \centering
    \begin{tikzpicture}[
        level 1/.style={sibling distance=16em},
        level 2/.style={sibling distance=8em},
        level 3/.style={sibling distance=4em}]

        \node{$g^{a_0}$}
            child{ node {}
                child { node {}
                    child { node (a) {$g^{a_0}$} node [below of = a] {$\vdots$}}
                    child { node (a) {} node [below of = a] {$\vdots$}}
                }
                child { node {}
                    child { node (a) {} node [below of = a] {$\vdots$}}
                    child { node (a) {} node [below of = a] {$\vdots$}}
                }
            }
            child { node {}
                child { node {}
                    child { node (a) {} node [below of = a] {$\vdots$}}
                    child { node (a) {} node [below of = a] {$\vdots$}}
                }
                child { node {}
                    child { node (a) {} node [below of = a] {$\vdots$}}
                    child { node (a) {$g^{a_0a_1a_2a_3}$} node [below of = a] {$\vdots$}}
                }
            };
    \end{tikzpicture}
    \caption{Depicting Naor-Reingold method as a tree-like structure}
    \label{fig:nrtree}
\end{figure}

\section{Public key encryption schemes}

Now we discuss a substantially different way of encrypting messages, which involves two separate keys per party instead of a single, shared key; hence the names \emph{Public key scheme}, or \pke{}, or \emph{Asymmetric key scheme}.

\subsubsection{\textsc{Cpa}-security, revisited}

In a \pke{} setting, the adversary knows the public key by design, which in turn is all that he needs to preform encryptions; therefore, the queries in a hypothetical \cpa{} game are moot, because \adversary{} can make the encryptions on its own; figure \ref{cryptogame:pkecpa} shows the changed game for a \pke{}.

\begin{cryptogame}
    {pkecpa}
    {Chosen plaintext attacks, revisited for \pke{} schemes}
    {cpa2}

    \receive{$(\pk, \sk) \pickUAR \keygen(1^\lambda)$}{$\pk$}{}

    \cseqbeginloop
    \cseqadversary{$c = \Enc(\pk, m)$}
    \cseqendloop

    \send{}{$m_0, m_1$}{}

    \receive{\shortstack[l]{
        $b \pickUAR \binary$ \\
        $c_b = \Enc(\pk, m_b)$
    }}{$m_b$}{}

    \cseqbeginloop
    \cseqadversary{$c = \Enc(\pk, m)$}
    \cseqendloop

    \send{}{$b'$}{\textsc{Output 1 iff} $b' = b$}

\end{cryptogame}

\todo{Another verbatim transcription:

Abstract construction (inefficient) for trapdoor permutation

$(Gen, f, f')$, where $gen= \keygen : \singleton \to \Xi_\pk, f(\pk, \cdot) \in \Xi_\pk \to \Xi_\pk, f' = f^{-1}(\sk, \cdot) \in \Xi_\pk \to \Xi_\pk$

Correctness: $f^{-1}(\sk, f(\pk, m)) = m$

$TDP \implies PKE$, Easy but not trivial

$\cryptog{tdp}$... same as \cpa2?

Why $f, f'$ is not cpa-secure? Because they are deterministic

Use $f$'s hardcore predicate

}


\def \bookname {Analysis II}

\documentclass[13pt,a4paper]{report}

\usepackage[margin=1in]{geometry}
\usepackage{amsthm}
\usepackage{amsmath}

\theoremstyle{definition}

\newtheorem{lemma}{Lemma}[section]
\newtheorem{exercise}{Exercise}[section]
\newtheorem{solution}{Solution}[section]

\begin{document}
\chapter{Metric spaces}
\section{Definitions and examples}

\begin{lemma}\label{convergence_lemma_1}
Let $(x_n)^\infty_{n=m}$ be a sequence of real numbers, and let $x$ be another real number. Then
$(x_n)^\infty_{n=m}$ converges to $x$ if and only if $\lim_{n \rightarrow \infty}
d(x_n, x) = 0$.
\end{lemma}

\begin{exercise}
Prove Lemma \ref{convergence_lemma_1}.
\end{exercise}

\begin{solution}
By definition of limit, for any $\varepsilon > 0$ there exists an $N \ge m$ such that
$d(x_n, x) = |x_n - x| < \varepsilon$ for all $n \ge N$. This is exactly the definition
of convergence in previous book.
\end{solution}

\begin{exercise}
Show that the real line with the metric $d(x, y) := |x - y|$ is indeed a metric space.
(Hint: you may wish to review your proof of Proposition 4.3.3.)
\end{exercise}

\begin{solution} We verify the four properties listed in Definition 1.1.2
\begin{itemize}
    \item[1.] $d(x, x) = |x - x| = 0$.
    \item[2.] For all $x \ne y$, $d(x, y) = |x - y| > 0$.
    \item[3.] For all $x$ and $y$, $d(x, y) = |x - y| = |y - x| = d(y, x)$.
    \item[4.] For all $x, y$ and $z$, $d(x, y) = |x - y| = |x - z + z - y| \le
    |x - z| + |z - y| = d(x, z) + d(z, y)$.
\end{itemize}
\end{solution}

\begin{exercise}
Let $X$ be a set, and let $d: X \times X \rightarrow [0, \infty)$ be a function.
\begin{itemize}
    \item[(a)] Give an example of a pair $(X, d)$ which obeys axioms (bcd) of Definition 1.1.2,
    but not (a). (Hint: modify the discrete metric.)
    \item[(b)] Give an example of a pair $(X, d)$ which obeys axioms (acd) of Definition 1.1.2,
    but not (b).
    \item[(c)] Give an example of a pair $(X, d)$ which obeys axioms (abd) of Definition 1.1.2,
    but not (c).
    \item[(d)] Give an example of a pair $(X, d)$ which obeys axioms (abc) of Definition 1.1.2,
    but not (d). (Hint: try examples where $X$ is a finite set.)
\end{itemize}
\end{exercise}

\begin{solution} In general, setting $X$ to be a finite set and defining $d$ by specifying values
for all pairs of elements can produce a lot of metric spaces for each of the problem. For this
exercise to be more challenging, we try to avoid abusing this approach.
\begin{itemize}
    \item[(a)] Let $d$ be the metric such that for all $x, y \in X$, $d(x, y) = 1$. This is similar
    to the discrete metric except that $d(x, x) = 1$ so it does not obey (a).
    \item[(b)] Similar to (a), we can as well set $d(x, y) = 0$ for all $x, y \in X$.
    \item[(c)]
    \item[(d)] Let $X = \{ 1, 2, 3 \}$ and define $d(x, x) = 0$ for $x \in X$, $d(1, 2) = d(2, 1)
    = 1$, $d(2, 3) = d(3, 2) = 1$ and finally $d(1, 3) = d(3, 1) = 3$.
\end{itemize}
\end{solution}

\begin{exercise}
Show that the pair $(Y, d|_{Y \times Y})$ defined in Example 1.1.5 is indeed a metric space.
\end{exercise}

\begin{solution}
Each of the four properties remains after $d$ is restricted to $Y \subset X$ and is vacuous to
verify.
\end{solution}

\begin{exercise}\label{exercise_1_1_5}
Let $N \ge 1$, and let $a_1, a_2, \ldots, a_n$ and $b_1, b_2, \ldots, b_n$ be real numbers. Verify
the identity
    \begin{equation*}
    \Bigg(\sum_{i = 1}^n a_i b_i\Bigg)^2 + \frac{1}{2} \sum_{i = 1}^n \sum_{j = 1}^n
    (a_i b_j - a_j b_i)^2 = \Bigg(\sum_{i = 1}^n a_i^2 \Bigg) \Bigg(\sum_{j = 1}^n b_j^2 \Bigg)
    \end{equation*}
and conclude the \it{Cauchy-Schwarz inequality}
    \begin{equation*}
    \Bigg|\sum_{i = 1}^n a_i b_i \Bigg| \le \Bigg(\sum_{i = 1}^n a_i^2\Bigg)^{\frac{1}{2}}
    \Bigg(\sum_{j = 1}^n b_j^2\Bigg)^{\frac{1}{2}}
    \tag{(1.3)}
    \end{equation*}
Then use the Cauchy-Schwarz inequality to prove the \it{triangle inequality}
    \begin{equation*}
    \Bigg(\sum_{i = 1}^n (a_i + b_i)^2\Bigg)^{\frac{1}{2}} \le
    \Bigg(\sum_{i = 1}^n a_i^2\Bigg)^{\frac{1}{2}} +
    \Bigg(\sum_{j = 1}^n b_j^2\Bigg)^{\frac{1}{2}}
    \end{equation*}
\end{exercise}

\begin{solution}
\end{solution}

\begin{exercise}
Show that $({\bf R}^n, d_{l^2})$ in Example 1.1.6 is indeed a metric space. (Hint: use Exercise
\ref{exercise_1_1_5}.)
\end{exercise}

\begin{exercise}
Show that the pair $({\bf R}^n, d_{l^1})$ in Example 1.1.7 is indeed a metric space.
\end{exercise}

\begin{exercise}
Prove the two inequalities in (1.1). (For the first inequality, square both sides. For the second
inequality, use Exercise \ref{exercise_1_1_5}.)
\end{exercise}

\begin{exercise}
Show that the pair $({\bf R}^n, d_{l^\infty})$ in Example 1.1.9 is indeed a metric space.
\end{exercise}

\begin{exercise}
Prove the two inequalities in (1.2).
\end{exercise}

\begin{exercise}
Show that the discrete metric ${\bf R}^n, d_{\text{disc}}$ in Example 1.1.11 is indeed a metric
space.
\end{exercise}

\begin{exercise}
Prove Proposition 1.1.18.
\end{exercise}

\begin{exercise}
Prove Proposition 1.1.19.
\end{exercise}

\begin{exercise}
Prove Proposition 1.1.20. (Hint: modify the proof of Proposition 6.1.7.)
\end{exercise}

\begin{exercise}
Let
    \begin{equation*}
    X := \Bigg\{ (a_n)_{n = 0}^\infty : \sum_{n = 0}^\infty |a_n| < \infty \Bigg\}
    \end{equation*}
be the space of absolutely convergent sequences. Define the $l^1$ and $l^\infty$ metrics on this
space by
    \begin{equation*}

    \end{equation*}
\end{exercise}

\begin{exercise}
\end{exercise}

\end{document}


\chapter{Derivation Steps in Detail}
In this appendix chapter we provide some further derivation steps used to derive some of our equations.

\section{Taylor Series Approximation}
\label{chap:taylorseriesapproxappendix}

In order to prove equation $\ref{eq:taylorseriesapproximationofp}$ from section $\ref{sec:taylorapproximation}$ we have to show the following: For any $N\mathbb{\in N}$ and
\begin{equation}
 \sum_{n=0}^{N}\frac{(ikwh)^{n}}{n!}\mathcal{F}\left\{ h{}^{n}\right\} (\alpha,\beta) \approx P(\alpha,\beta)
\end{equation}
we have to prove:

\begin{enumerate}
\item Show that there exist such an $N\mathbb{\in N}$s.t the approximation
holds true.
\item Find a value for B s.t. this approximation is below a certain error
bound, for example machine precision $\epsilon$.
\end{enumerate}

\subsection{Proof Sketch of 1.}
By using the \textbf{ratio test} which is on Taylor's theorem$\footnote{Please have a look at \texttt{http://en.wikipedia.org/wiki/Taylors\textunderscore theorem} in order to see a proper definiton of the ratio test.}$ it is possible to show that the series

\begin{equation}
  \sum_{n=0}^{N}\frac{(ikwh)^{n}}{n!}\mathcal{F}\left\{ h{}^{n}\right\} (\alpha,\beta)
\end{equation}
converges absolutely.

\myparagraph{Proof of that the section converges absolutely}
Let us Consider

\begin{equation}
  \sum_{k=0}^{\infty}\frac{y^{n}}{n!}
\end{equation}

for which we define

\begin{equation}
  a_{k}=\frac{y^{k}}{k!}
\end{equation}

By applying the definition of the ratio test for this series it follows:

\begin{equation}
 \forall y:limsup_{k\rightarrow\infty}|\frac{a_{k+1}}{a_{k}}|=limsup_{k\rightarrow\infty}\frac{y}{k+1}=0
\end{equation}

Thus this series converges absolutely, no matter what value we will pick for $y$. Q.E.D.

\subsection{Part 2: Find such an N}
Let $f(x)=e^{x}$. We can formulate its Taylor series, stated above. Let $P_{n}(x)$ denote the n-th Taylor polynomial,

\begin{equation}
 P_{n}(x)=\sum_{k=0}^{n}\frac{f^{(k)}(a)}{k!}(x-a)^{k}
\end{equation}

where $a$ is our developing point (here a is equal zero). We can define the error of the n-th Taylor polynomial to be equal to

\begin{equation}
  E_{n}(x)=f(x)-P_{n}(x)
\end{equation}

The error of the n-th Taylor polynomial is difference between the value of the function and the Taylor polynomial. This directly implies that

\begin{equation}
  |E_{n}(x)|=|f(x)-P_{n}(x)|
\end{equation}

By using the Lagrangian Error Bound it follows:

\begin{equation}
 |E_{n}(x)|\leq\frac{M}{(n+1)!}|x-a|^{n+1}
\end{equation}

with $a=0$, where \textbf{M} is some value satisfying

\begin{equation}
  |f^{(n+1)}(x)|\leq M
\end{equation}

on the interval $I=[a,x]$. Since we are interested in an upper bound of the error and since \textbf{a} is known, we can reformulate the interval as $I=[0,x_{max}]$, where

\begin{equation}
 x_{max} = \|i\| k_{max} w_{max} h_{max}
\end{equation}

We are interested in computing an error bound for $e^{ikwh(x,y)}$. E.g. let us assuming the following parameters (used within Stam's Paper):

\begin{itemize}
  \item Height of bump: 0.15$\mu m$
  \item Width of a bump: 0.5$\mu m$
  \item Length of a bump: 1$\mu m$
  \item $k=\frac{2\pi}{\lambda}$ is the wavenumber, $\lambda\in[\lambda_{min,}\lambda_{max}]$ and
  thus $k_{max}=\frac{2\pi}{\lambda_{min}}$. Since $(u,v,w) = -\omega_i - \omega_r$ and both are unit direction vectors,
  each component can have a value in range {[}-2, 2{]}.
  \item for simplification, assume$[\lambda_{min,}\lambda_{max}]=[400nm,700nm].$
\end{itemize}

We get:

\begin{align}
x_{max}
 &= \|i\| \cdot k_{max} \cdot w_{max} \cdot h_{max} \nonumber \\
 &= k_{max} \cdot w_{max} \cdot h_{max} \nonumber \\
 &=2\cdot(\frac{2\pi}{4 \cdot 10^{-7}m}) \cdot 1.5 \cdot 10^{-7} \nonumber \\
 &=1.5\pi
\end{align}

and it follows for our interval $I=[0,1.5\pi]$. Next we are going to find the value for $M$. Since the exponential function is monotonically growing (on the interval $I$) and the derivative of the exponential function is again an exponential function, we can find such an $M$:

\begin{align*}
 M
 &=e^{x_{max}} \nonumber \\
 &=exp(1.5\pi)
\end{align*}

and $|f^{(n+1)}(x)|\leq M$ holds. With

\begin{align}
|E_{n}(x_{max})|
 &\leq\frac{M}{(n+1)!}|x_{max}-a|^{n+1} \nonumber \\
 &= \frac{exp(1.5\pi)*(1.5\pi)^{n+1}}{(n+1)!}
\end{align}

we now can find a value of $n$ for a given bound, i.e. we can find an value of $N\mathbb{\in N}$ s.t. $\frac{exp(1.5\pi)*(1.5\pi)^{N+1}}{(N+1)!}\leq\epsilon$. With Octave/Matlab we can see:

\begin{itemize}
\item if N=20 then $\epsilon\approx2.9950*10^{-4}$
\item if N=25 then $\epsilon\approx8.8150*10^{-8}$
\item if N=30 then $\epsilon\approx1.0050*10^{-11}$
\end{itemize}

With this approach we have that $\sum_{n=0}^{25}\frac{(ikwh)^{n}}{n!}\mathcal{F}\left\{ h{}^{n}\right\} (\alpha,\beta)$ is an approximation of $P(u,v)$ with error $\epsilon\approx8.8150*10^{-8}$. This means we can precompute 25 Fourier Transformations in order to approximate P(u,v) having an error $\epsilon\approx8.8150*10^{-8}$.

\section{PQ approach}
\subsection{One dimensional case}
\label{sec:pqonedimappendix}
Since our series is bounded, we can simplify the right-hand-side of equation $\ref{eq:pqgeometricseries}$. Note that $e^{-ix}$ is a complex number. Every complex number can be written in its polar form, i.e.

\begin{equation}
e^{-ix} = cos(x) + i sin(x)
\label{eq:polarform}
\end{equation}

Using the following trigonometric identities
\begin{gather}
cos(-x) = cos(x) \nonumber \\
sin(-x) = -sin(x)
\end{gather}

combined with $\ref{eq:polarform}$ we can simplify the series $\ref{eq:pqgeometricseries}$ even further to:

\begin{align}
\frac{1-e^{iwT(N+1)}}{1-e^{-iwT}}
& =\frac{1-cos(wT(N+1)) + i sin(wT(N+1)) }{1-cos(wT) + i sin(wT)}
\label{eq:pq1minusexp}
\end{align}

Equation $\ref{eq:pq1minusexp}$ is still a complex number, denoted as $(p+iq)$. Generally, every complex number can be written as a fraction of two complex numbers. This implies that the complex number $(p+iq)$ can be written as $(p+iq) = \frac{(a+ib)}{(c+id)}$ for any $(a+ib), (c+id) \neq 0$. Let us use the following substitutions:

\begin{align}
a& := 1 - cos(wT(N+1))&
b& =sin(wT(N+1)) \nonumber \\
c& =1-cos(wT)&
d& =sin(wT)
\label{eq:pqabcdsubstitudes}
\end{align}

Hence, using $\ref{eq:pqabcdsubstitudes}$, it follows

\begin{equation}
  \frac{1-e^{iwT(N+1)}}{1-e^{-iwT}} = \frac{(a+ib)}{(c+id)}
\end{equation}

By rearranging the terms, it follows $(a+ib) = (c+id)(p+iq)$ and by multiplying its right hand-side out we get the following system of equations:

\begin{align}
(cp-dq)& =a \nonumber \\
(dp + cq)& =b
\label{eq:cdadcn}
\end{align}

After multiplying the first equation of $\ref{eq:cdadcn}$ by $c$ and the second by $d$ and then adding them together, we get using the law of distributivity new identities for $p$ and $q$:

\begin{align}
p& =\frac{(ac+bd)}{c^2 + d^2} \nonumber \\
q& =\frac{(bc+ad)}{c^2 + d^2}
\label{eq:pq1}
\end{align}

Using some trigonometric identities and putting our substitution from $\ref{eq:pqabcdsubstitudes}$ for $a$, $b$, $c$, $d$ back into the current representation $\ref{eq:pq1}$ of $p$ and $q$ we will get:

\begin{align}
p& =\frac{1}{2}+\frac{1}{2}\left(\frac{cos(wTN)-cos(wT(N+1))}{1-cos(wT)}\right) \nonumber \\
q& =\frac{sin(wT(N+1))-sin(wTN)-sin(wT)}{2(1-cos(wT))}
\end{align}

Since we have seen, that $\sum_{n=0}^N e^{-uwnT}$ is a complex number and can be written as $(p+iq)$, we now know an explicit expression for $p$ and $q$. Therefore, the one dimensional inverse Fourier transform of $S$ is equal:

\begin{align}
\mathcal{F}^{-1}\{S\}(w)
& =\mathcal{F}^{-1}\{f\}(w) \sum_{n=0}^{N} e^{-iwnT} \nonumber \\
& = (p+iq) \mathcal{F}^{-1}\{f\}(w)
\label{eq:mainfinding1dappendix}
\end{align}

\subsection{Two dimensional case}
\label{sec:pqtwodimappendix}

\begin{align}
\mathcal{F}^{-1}\{S\}(w_1, w_2)
& = \int_{-\infty}^{\infty}\int_{-\infty}^{\infty} \sum_{n_2=0}^{N_1} \sum_{n_2=0}^{N_2} h(x_1 + n_1 T_1, x_2 + n_2 T_2) e^{iw(x_1 + x_2)}dx_1 dx_2 \nonumber \\
& = \int_{-\infty}^{\infty}\int_{-\infty}^{\infty} \sum_{n_2=0}^{N_1} \sum_{n_2=0}^{N_2} h(y_1, y_2) e^{iw((y_1 - n_1 T_1) + (y_2 + n_2 T_2))}dx_1 dx_2 \nonumber \\
& =\sum_{n_2=0}^{N_1} \sum_{n_2=0}^{N_2} \int_{-\infty}^{\infty}\int_{-\infty}^{\infty} h(y_1, y_2) e^{iw(y_1 + y_2)} e^{-iw(n_1 T_1 + n_2 T_2)}dy_1 dy_2 \nonumber \\
& =\sum_{n_2=0}^{N_1} \sum_{n_2=0}^{N_2} e^{-iw(n_1 T_1 + n_2 T_2)} \int_{-\infty}^{\infty}\int_{-\infty}^{\infty} Box(y_1, y_2) e^{iw(y_1 + y_2)} dy_1 dy_2 \nonumber \\
& =\left(\sum_{n_2=0}^{N_1} \sum_{n_2=0}^{N_2} e^{-iw(n_1 T_1 + n_2 T_2)}\right) \mathcal{F}^{-1}\{h\}(w_1,w_2) \nonumber \\
& =\left(\sum_{n_2=0}^{N_1} e^{-iw n_1 T_1}\right) \left(\sum_{n_2=0}^{N_2} e^{-iw n_2 T_2}\right) \mathcal{F}^{-1}\{h\}(w_1,w_2) \nonumber \\
& =(p_1 + i q_1)(p_2 + i q_2) \mathcal{F}^{-1}\{h\}(w_1,w_2) \nonumber \\
& =((p_1 p_2 - q_1 q_2) + i(p_1 p_2 + q_1 q_2)) \mathcal{F}^{-1}\{h\}(w_1,w_2) \nonumber \\
& =(p + iq) \mathcal{F}_{DTFT}\{h\}(w_1,w_2)
\label{eq:pqmainfindingappendix}
\end{align}

Where we have defined

\begin{align}
p := (p_1 p_2 - q_1 q_2) \nonumber \\
q := (p_1 p_2 + q_1 q_2)
\label{eq:pqsubst2dappendix}
\end{align}


\section{Algorithms}\label{section:word}

\begin{definition}[Approximation algorithm]
    Find approximate solutions to~\nameref{optproblem}
\end{definition}

\begin{definition}[Asymptotic Polynomial-time Approximation Scheme, APTAS]
\label{APTAS}
    A family of algorithms, and a constant $c$ such that all solutions has an
    approximation of $(1 + \epsilon)\times{OPT} + c$ for minimization problems.
\end{definition}

\begin{definition}[Bin-packing]
    A series of algorithms to learn how to distribute $n$ numbers into $k$ bins.
    First-fit, best-fit, worst-fit (stack into where there is most free space),
    best-fit, etc.
\end{definition}

\begin{definition}[Complimentary slackness]
    Given an optimal solution to a linear program,
    $Z_{LP}$ and it's dual $Y_{LP}$, with $x_{1}, x_{2}, \dots x_{n}$ and
    $y_{1}, y_{2}, \dots y_{n}$ respecively, with
    $w_{1}, w_{2}, \dots w_{n}$ and $z_{1}, z_{2}, \dots z_{n}$  as slack
    variables for each solution, respectively,
    then $\forall x, x_{i}z_{i} = 0$ and $\forall y, y_{i} w_{i} = 0$

    This necessary condition for optimality conveys a fairly simple economic
    principle.  In standard form (when maximizing), if there is slack in a
    constrained primal resource (i.e., there are ``leftovers''),
    then additional quantities of that resource must have no value.
\end{definition}

\begin{definition}[Difference heuristic and approximation]
    While an heurisitc makes a choice, without a guarantee of optimality,
    an approximation can make a choice and know that this choice will render
    a solution within a factor of OPT.\
\end{definition}

\begin{definition}[EDD]\label{EDD}
    Earliest Due Date
\end{definition}

\begin{definition}[F-approximation]
    Also referred to as a linear approximation, using a function f,
    which is affine.
\end{definition}

\begin{definition}[FPTAS, fully polynomial approximation scheme]\label{FPTAS}
    As in~\nameref{PTAS}, just $\frac{1}{\epsilon}$.
    The algoritm is required to be polynomial both in running time and problem
    size.

    Note that strongly NP-complete problems do not have any FPTAS.\
\end{definition}

\begin{definition}[Integrality gap]\label{integralitygap}
    The biggest difference between an IP and LP
\end{definition}

\begin{definition}[Locality of Reference]
     also known as the principle of locality, is a phenomenon describing the
     same value, or related storage locations, being frequently accessed. There
     are two basic types of reference locality – temporal and spatial locality.
     Temporal locality refers to the reuse of specific data, and/or resources,
     within a relatively small time duration. Spatial locality refers to the
     use of data elements within relatively close storage locations. Sequential
     locality, a special case of spatial locality, occurs when data elements
     are arranged and accessed linearly, such as, traversing the elements in a
     one-dimensional array

\end{definition}

\begin{definition}[Makespan]
    The total length of a schedule; from 0 to $C_{\max}$
\end{definition}

\begin{definition}[$\tilde{O}$]\label{otilde}
    Given function $f(x)$, $\tilde{O}(f(x)) = O(f(x)\cdot{\log^{k}{f(x)}})$
\end{definition}

\begin{definition}[Optimization problem]\label{optproblem}
    To find the best solution of $n$ feasible solutions.
\end{definition}

\begin{definition}[Perfect matching]
    A collection $E^{\prime} \subseteq E$ of edges in a graph
    $G = (V,E)$, such that $\forall v \in V$, are connected
    from $E^{\prime}$ only once.
\end{definition}

\begin{definition}[Pre-empty schedule]\label{pre-emptive}
    You can interrupt task and re-continue them.
\end{definition}

\begin{definition}[PTAS, Polynomial-time approximation scheme]\label{PTAS}
    Given an optimization problem (e.g.\ an NP-problem) and a parameter
    $\epsilon$, produce a solution within (($1 + \epsilon) \times OPT$)
    $\epsilon > 0$

    E.g.\ for the traveling salesman, a tour would be of length max
    $(1 + \epsilon) \times L$, with $L$ being the length of the tour

    Note that for minimization, there is $1 + \epsilon$, and for maximization,
    there is $1 - \epsilon$

    If you have a scheme with $(1 \pm \epsilon) \times OPT + \kappa$, then
    it is not under PTAS.\ PTAS only handles the former part, $(1 \pm \epsilon)$

    For MAX SNP, there does not exist polynomial approximation schemes
\end{definition}

\begin{definition}[Parallel Random Access Machine]
    an abstract computer for designing parallel algorithms

\end{definition}

\begin{definition}[$\rho$-approximation]
    Polynomial algorithm that is guaranteed to have objective function
    to OPT within $\rho$ of
    optimum (not the ($1 + \epsilon$) of~\nameref{PTAS}).
\end{definition}

\begin{definition}[Scheduling]
    See~\nameref{srpt},
    \begin{itemize}
        \item \textbf{$P_{i}$} = time to do a job $i$
        \item \textbf{$R_{i}$} = earliest time a job $i$ can start
        \item \textbf{$C_{i}$} = time of completion for job $i$
        \item \textbf{$D_{i}$} = due date for job $i$
        \item \textbf{$L_{i}$} = $C_{i} - D_{i}$
    \end{itemize}
\end{definition}

\begin{definition}[Strong duality]
    The optimal value of the dual is equal to that of the primal linear program.

    $ \sum{y^{*}_{i}} = \sum{w_{i}x_{i}}$
\end{definition}

\begin{definition}[Weak duality property]
    No dual program has a solution greater than the optimal of the primal
    linear program
\end{definition}

\begin{definition}[$\alpha$ approximation]
    Produce a solution who's value is within a factor of $\alpha$
    of the optimal.
\end{definition}