\documentclass[letterpaper, 8pt]{extarticle}

\usepackage{steven}
\usepackage[margin=1.5cm]{geometry}
\usepackage{physics}
\usepackage{oubraces}
\usepackage{parskip}
\usepackage{fancyhdr}
\usepackage{multicol}
\usepackage{titlesec}
\usepackage{mathtools}
\usepackage[nodisplayskipstretch]{setspace}

\setstretch{0.1}

\pagestyle{fancy}
\fancyhf{}
\setlength{\headheight}{20pt}
\setlength{\headsep}{8pt}
\lhead{STA261 Cheatsheet}
\rhead{Steven Tran}

\titlespacing{\section}{0pt}{\parskip}{\parskip}

\titleformat{\section}
	{\normalfont\upshape\bfseries}{\thesection}{1em}{}

\pagenumbering{gobble}
\setlength\parindent{0pt}
\hfuzz=\maxdimen

\begin{document}
\begin{multicols*}{3}
	\section{STA257 Basics}
	Set stuff
	\begin{gather*}
		A,B\text{ disjoint}\Leftrightarrow A\cap B=\emp \\
		A\cup B=B\cup A \\
		(A\cup B)\cup C=A\cup (B\cup C) \\
		(A\cup B)\cap C=(A\cap C)\cup (B\cap C)
	\end{gather*}
	Probability Measure:
	\begin{gather}
		P(\Omega)=1 \\
		A\subset\Omega\IMP P(A)\geq 0\\
		A_i\text{ mutually disjoint}\scriptstyle\IMP P\mqty(\bigcup_{i=1}^nA_i)=\sum_{i=1}^nP(A_i)
	\end{gather}
	\text{PMF} $p(x_i)$\quad\text{PDF} $f(x_i)$\quad CDF $F(x_i)$
	\begin{gather*}
		\shortintertext{Conditional Probability}
		P(A|B)=P(A\cap B)/P(B)
		\shortintertext{Law of Total Probability ($\bigcup_{i=1}^nB_i=\Omega,B_i$ disjoint, $P(B_i)>0$)}
		P(A)=\sum_{i=1}^nP(A|B_i)P(B_i)
		\shortintertext{Bayes': $A,B_i$ disjoint, $\sum_{i=1}^nB_i=\Omega,P(B_i)>0$, then}
		P(B_j|A)=\frac{P(A|B_j)P(B_j)}{\sum_{i=1}^nP(A|B_i)P(B_i)}
		\shortintertext{Multinomial Coefficient: group $n$ objects into $k$ classes, each of size $n_i$}
		\binom{n}{n_1,\cdots,n_k}=\frac{n!}{n_1!n_2!\cdots n_k!}
		\shortintertext{Binomial Theorem}
		(a+b)^n=\sum_{k=0}^n\binom{n}{k}a^kb^{n-k}
	\end{gather*}
	\section{Distributions}
	Bernouilli: success ($p$) or failure ($1-p$) with $p\IN[0,1]$. $X\sim Ber(p)$ then
	\[p(x)=\begin{cases}p^x(1-p)^{1-x}, &x=0, 1\\0&\text{otherwise}\end{cases}\]
	Expectation $p$ Variance $(1-p)p$ MGF $q+pe^t$

	Binomial: $n$ $Ber(p)$ trials with $k$ successes. $X\sim Bin(n, p)$ then
	\[p(k)=\binom{n}{k}p^k(1-p)^{n-k}\]
	E $np$\quad V $npq$\quad MGF $(1-p+pe^t)^n$

	Geometric: $k$ $Ber(p)$ trials until 1 success. $X\sim Geo(p)$ then
	\[p(k)=p(1-p)^{k-1}\]
	E $\frac{1}{p}$\quad V $\frac{1-p}{p^2}$\quad MGF $\frac{pe^t}{1-(1-p)e^t}$
	\begin{gather*}
		\sum_{n=1}^\infty az^{n-1}=\sum_{n=0}^\infty az^n \\
		\sum_{n=1}^ka_nr^{n-1}=a_n\mqty(\frac{1-r^k}{1-r})
	\end{gather*}
	Neg. Binomial: $Ber(p)$ trials conducted until $r$ successes. $X\sim NB(r,p)$ then
	\[p(k)=\binom{k-1}{r-1}p^r(1-p)^{k-r}\]
	E $\frac{r}{p}$\quad V $\frac{rp}{(1-p)^2}$\quad MGF $\mqty(\frac{1-p}{1-pe^t})^2$

	Hypergeometric: $X\sim HG(n,m,r)$ where $n$ is the total number of items, $m$ is the number of items sampled, and $r$ is the number of items with a property, then
	\[p(k)=\frac{\binom{r}{k}\binom{n-r}{m-k}}{\binom{n}{m}} \tag{$k\IN 0,\cdots, \min(r,m)$}\]
	E $\frac{mr}{n}$

	Poisson: \# events. $X\sim Poi(\text{rate}=\lambda)$ then
	\[p(k)=\frac{\lambda^ke^{-\lambda}}{k!}\]
	E $\lambda$\quad V $\lambda$\quad MGF $e^{\lambda(e^t-1)}$

	Properties of Poisson:
	\begin{itemize}
		\item For $|S_i|=N_i$ independent $Poi(\lambda)$, $N_i\sim Poi(\lambda|S_i|)$
		\item For $n$ large, $Bin(n,p)\sim Poi(np)$ can be approximated
	\end{itemize}

	Exponential ($Gamma(1,\lambda)$): $X$ waiting time $\sim Exp(\lambda)$, then
	\[f(x)=\lambda e^{-\lambda x}\quad F(x)=1-e^{-\lambda x}\]
	E $\frac{1}{\lambda}$\quad V $\frac{1}{\lambda^2}$\quad M $\frac{\lambda}{\lambda-t}$

	Gamma (sum $a$ iid $Exp(\lambda)$): $X\sim \Gamma(a,\lambda)$ then
	\[f(x)=\frac{\lambda^a}{\Gamma(a)}x^{a-1}e^{-x\lambda}\]
	E $\frac{a}{\lambda}$\quad V $\frac{a}{\lambda^2}$\quad M $\mqty(\frac{\lambda}{\lambda-t})^a$

	Beta: used to model proportions between $0$ and $1$ with $a,b>0$ shape parameters. $X\sim Beta(a,b)$ then
	\[f(x)=\frac{\Gamma(a+b)}{\Gamma(a)\Gamma(b)}x^{a-1}(1-x)^{b-1}\]
	E $\frac{a}{a+b}$\quad V $\frac{ab}{(a+b)^2(a+b+1)}$

	Normal: $X\sim N(\mu, \sigma^2)$ then
	\begin{gather*}
		f(x)=\frac{1}{\sqrt{2\pi\sigma^2}}e^{-\frac{(x-\mu)^2}{2\sigma^2}} \\
		\text{MGF } e^{\mu t+\frac{\sigma^2t^2}{2}}\quad f(\mu-x)=f(\mu+x) \\
		\frac{X-\mu}{\sigma}\sim N(0,1)
	\end{gather*}
	Std. Normal $Z\sim N(0,1)$ $\phi(z)$ given in table

	$X_i\sim N(\mu_i,\sigma^2_i$ for $i\IN\{1,\cdots,n\}$. $Y=\sum_{i=1}^na_iX_i+b$, then
	\[Y\sim N\mqty(\displaystyle \sum_{i=1}^na_i\mu_i+b,\sum_{i=1}^na_i^2\sigma_i^2)\]

	Chi-Square distribution: $U=Z^2$ where $Z\sim N(0,1)$, then $U\sim\chi^2_{df=1}$. If $X\sim \chi^2_{(m)}$ and $Y\sim \chi^2_{(n)}$ then $X+Y\sim \chi^2_{(m+n)}$. If $X\sim\chi^2_{(m)}$ then $E(X)=m$.

	$t$ distribution: $Z\sim N(0,1)\perp U\sim\chi^2_{(m)}$ then $\frac{Z}{\sqrt{\frac{U}{m}}}\sim t_{(m)}$, the $t$ distribution with $m$ degrees of freedom

	$F$ distribution: $X\sim\chi^2_{(m)}\perp Y\sim\chi^2_{(n)}$ then $\frac{\frac{X}{m}}{\frac{Y}{n}}\sim F(m,n)$.

	\section{Inequalities, Expectation, Variance, MGFs}

	Markov's Inequality: $P(X\geq 0)=1, E(X)$ exists then
	\[P(X\geq t)\leq \frac{E(X)}{t}\]
	Chebyshev's Inequality: $P(|X-\mu|>t)\leq\frac{\sigma^2}{t^2}$ (proof: set $Y=(x-\mu)^2$ and apply Markov))
	\begin{gather*}
		\text{r-th moment}=E(X^r) \\
		\text{r-th central moment}=E\mqty[(X-E(X))^r]\\
		M(t)=E(e^{tX})\\
		X\perp Y\IMP M_{X+Y}=M_XM_Y\\
		M_{XY}(s,t)=E(e^{sX+tY})\\
		M^{(r)}(0)=E(X^r)\\
		E(X)=\sum_ix_ip(x_i)\quad E(X)=\int_\R xf(x)\dd x \tag{provided these converge} \\
		Y=g(X)\IMP E(Y)=\sum_ig(x_i)p(x_i) \\ E(Y)=\int_\R g(x)f(x)\dd x \\
		E(aX+b)=aE(X)+E(b)\quad E(XY)=E(X)E(Y) \tag{if $X\perp Y$} \\
		Var(X)=E\mqty[(X-E(X))^2]\\
		=E(X^2)-(E(X))^2=\int_\R(x-\mu)f(x)\dd x \\
		sd=\sqrt{Var(X)} \\
		Y=aX+b\IMP Var(Y)=a^2Var(X)
	\end{gather*}
	\section{Conditional \& Multivariate Stuff}
	Law of Total Expectation
	\begin{gather*}
		E(Y)=E(E(Y|X))
		\shortintertext{Law of Total Variance}
		Var(Y)=Var(E(Y|X))+E(Var(Y|X))\\
		p_{xy}(x,y)=p_{X|Y}(x|y)p_y(y)\\
		p_x(x)=\int_yp_{xy}(x,y)\dd y\\
		E(Y)=\idotsint \underbrace{g(x_1,\cdots,x_n)}_\text{may do nothing}f(x_1,\cdots,x_n)\dd \{x_i\}\\
		E(Y|X=x)=\sum_yp_{Y|X}(y|x) \\
		E(h(Y)|X=x)=\int_yh(Y)f_{Y|X}(y|x)\dd y\\
		\shortintertext{$X_i\perp X_j$ then $Var(\sum x_i)=\sum Var(X_i)$ and $Cov(X_i,X_j)=0$)}\\
		Cov(X,Y)=E\mqty[(X-\mu_X)(Y-\mu_Y)]\\
		=E(XY)-E(X)E(Y)\\
		Cov(a+X,Y)=Cov(X,Y)\\
		Cov(aX,bY)=abCov(X,Y)\\
		Cov(X,Y+Z)=Cov(X,Y)+Cov(X,Z)\\
		Var(X+Y)=Var(X)+Var(Y)+2Cov(X,Y)\\
		\begin{align*}
			Cov(aW+bX,cY+dZ)&=acCov(W,Y)\\
			&+bcCov(X,Y)\\
			&+adCov(W,Z)\\
			&+bdCov(X,Z)
		\end{align*}\\
		Var(a+\sum b_ix_i)=\sum_{i,j}b_ib_jCov(x_i,x_j)
	\end{gather*}
	\newpage
	Posterior density:
	\[f_{P|X}(p|x)=\frac{f_{X,P}(x,p)}{f_X(x)}=\frac{f_{X|P}(x|p)f_P(p)}{f_X(x)}\]
	\section{Limit Theorems}
	Law of Large Numbers: $X_1,X_2,\cdots,X_i,\cdots$ independent and $E(X_i)=\mu$, $Var(X_i)=\sigma^2$, $\bar X_n=\frac{1}{n}\sum_{i=1}^nX_i$.

	Then $\forall\epsilon>0, P(|\bar X_n-\mu|>\epsilon)\overset{n\to\infty}{\longrightarrow} 0$ by Chebyshev's inequality.

	Convergence in Distribution: $X_1,\cdots$ are random variables with $F_1,\cdots$, and $X$ has cdf $F$. $X_n\overset{D}{\longrightarrow}X$ if $F_n(X)\overset{D}{\rightarrow}F(X)$ wherever $F$ is continuous.
	\begin{itemize}
		\item the next outcome (as we get more and more $X_i$s) converge closer and closer to some cdf
		\item to show converge in distribution, we usually use MGFs. Call $\{F_n\}$ a sequence of cdfs with MGFs $\{M_n\}$.
		\[\overbrace{M_N(t)\to M(t)}^{\forall t\IN I\sth 0\IN t}\IMP F_n(x)\to F(x)\]
		since the MGF uniquely determines the distribution of a RV.
	\end{itemize}

	Central Limit Theorem: $X_1,\cdots$ iid with mean $\mu$, variance $\sigma^2$, cdf $F$, MGF $M$ defined in a neighbourhood of $0$. Let $S_n=\sum_{i=1}^n X_i$. Then $\bar X_n\overset{D}{\to}N(\mu,\frac{\sigma^2}{n})$ or $\frac{\bar X_n-\mu}{\frac{\sigma}{\sqrt n}}\overset{D}{\to}N(0,1)$ or $P\mqty(\frac{S_n}{\sigma\sqrt x}\leq x)\rightarrow\phi(x)$.

	Proof: $M_{S_n}(t)=\mqty(M_x(t))^n,M_{Z_n}(t)=\mqty(M_x\mqty(\frac{t}{\sigma\sqrt x}))^n,M_X(s)=M_X(0)+SM'(0)+\frac{S^2}{2}M''(0)+\epsilon_S$ with $\frac{\epsilon_S}{S^2}\to 0$. This equals $1+\frac{1}{2}\sigma^2+\mqty(\frac{t}{\sigma\sqrt x}))^2+\epsilon_n$, so $M_{Z_n}(t)=\mqty(1+\frac{t^2}{2n}+\epsilon_n)^n\to e^{\frac{t^2}{2}}$ hence $Z_n\sim N(0,1)$.

	\section{Definitions}
	\begin{itemize}
		\item Population: a collection of all the subjects that have something in common.
		\item[$\to$] Parameter: a characteristic/summary of the population, represented by $\theta$. Can be mean ($\mu$), std. dev ($\sigma$), etc.
		\item Sample: a subset of the population. We use the sample to make an inference about the unknown parameters of our population.
		\item[$\to$] Statistic: any summary of the sample; since statistics/estimators are a function of sample observations, we use $T$ to represent them. Examples: sample total ($\sum X_i$), sample mean ($\bar X$), etc.
	\end{itemize}
	\begin{center}
	\begin{tabular}{|c|c|c|}
		\hline
		parameter & estimator & estimate \\\hline
		$\mu$ & $\bar X=\frac{\sum X}{n}$ & $\bar x=\frac{\sum x}{n}$ \\
		$\sigma$ & $S$ & $s$\\\hline
	\end{tabular}
	\end{center}

	\section{Method of Moments}
	$X_1,\cdots,X_n$ iid RVs. Define the k-th population moment to be $\mu_k=E(X^k)$ and the k-th sample moment to be $\hat\mu_k=\frac{1}{n}\sum_{i=1}^nX_i^k$. We use $\hat\mu_k$ as an estimator of $\mu_k$ using 3 steps:
	\begin{enumerate}
		\item express lower order population moments in terms of the parameters
		\item invert the expressions to express the parameters in terms of the population moments
		\item replace the population moments using the sample moments
	\end{enumerate}
	\section{Likelihood}
	$X_1,\cdots,X_n$ RVs with joint density/mass function $f(x_1,\cdots,x_n|\theta)$. Given a sample $(x_1,\cdots,x_n)$, the likelihood function of $\theta$ is defined as
	\[L(\theta):=L(\theta|x_1,\cdots,x_n)=f(x_1,\cdots,x_n|\theta)\]
	where the likelihood is intuitively the probabilility of the parameter being some value given the sample data. If $X_1,\cdots,X_n$ are iid, then we can express the joint as the product of the marginal densities, i.e.
	\[L(\theta)=\prod_{i=1}^nf_\theta(x_i)\]
	Suppose we have $\theta$ with likelihood function $L(\theta)$. The best point estimate can be found by picking a $\hat\theta$ that maximizes $L(\theta)$, i.e. $\hat\theta$ satisfies $L(\hat\theta)\geq L(\theta)\quad \forall\theta\IN\Omega$.

	Usually, we compute the MLE by optimizing the log-likelihood $\ell(\theta)$ ($\ln x$ is one-to-one and increasing). Solve $\pdv{\ell(\theta)}{\theta}=0$ for $\theta$ and check that $\left.\pdv[2]{\ell(\theta)}{\theta}\right|_{\theta=\hat\theta}<0$.

	Invariance property: suppose $\hat\theta$ is the MLE of $\theta$ and let $\psi(\theta)$ be any 1-1 function of $\theta$ defined on $\Omega$, then $\psi(\hat\theta)$ is the MLE of $\psi(\theta)$.

	Fisher Information
	\begin{align*}
		I(\theta)&=E\mqty[\displaystyle\pdv{\theta}\ln f(X|\theta)]^2
		\shortintertext{also, if $f$ is sufficiently smooth (in order to bring operation in integration when finding expectation),}
		&=-E\mqty[\displaystyle\pdv[2]{\theta}\ln f(X|\theta)]
	\end{align*}

	The large sample distribution of a MLE is approximately normal with mean $\theta_0$ and variance $\frac{1}{nI(\theta_0)}$. Moreover, the asymptotic variance is given by
    \[\underbrace{Var(\hat\theta)\geq\frac{1}{nI(\theta_0)}}_\text{Cram\'er-Rao Bound}=-\frac{1}{E\ell''(\theta_0)}\]

    Proof: consider the correlation coefficient $\rho$ between two variables $Y,Z$, which is bounded between $-1$ and $1$.
    Then
    \begin{align*}
        \rho^2(T,S()\theta))&\leq 1 \\
        \frac{(\text{cov}(T,S(\theta)))^2}{\text{var}(T)\text{var}(S(\theta))}&\leq 1 \\
        \IMP \text{var(T)}&\geq\frac{(\text{cov}(T,S(\theta)))^2}{\text{var}(S(\theta))}
    \end{align*}

	\section{Mean Squared Error \& Bias}
	Let $\theta$ be a parameter, $\psi(\theta)$ be a real-valued function, and $T$ be an estimator of $\psi(\theta)$. The Mean Squared Error is defined as
	\begin{align*}
		MSE_\theta(T)&=E_\theta[(T-\psi(\theta))^2\\
		&=Var_\theta(T)+(E_\theta(T)-\psi(\theta))^2 \tag{*}\\
		&=Var_\theta(T)+(Bias(T))^2
	\end{align*}
	Proof (*): Add $-E(T)+E(T)$ to inner term in definition of MSE, expand using squares.
	\[\text{Bias}:=E_\theta(T)-\psi(\theta)\]
	When the bias of an estimator is 0, it is unbiased.

	\section{Quiz 1 Problems}
	\begin{enumerate}[label=\alph*), wide, labelwidth=0pt, labelindent=0pt]
		\item (Rice E8Q4) Suppose $X$ is a discrete random variable with $P(X=0,1,2,3)=\frac{2}{3}\theta,\frac{1}{3}\theta,\frac{2}{3}(1-\theta),\frac{1}{3}(1-\theta)$ respectively where $\theta\IN[0,1]$ and 10 observations were taken: $(3,0,2,1,3,2,1,0,2,1)$.

		Method of moments estimate of $\theta$: $E(X)=\sum_{k=0}^3kP(X=k)=\frac{\theta}{3}+\frac{4}{3}(1-\theta)+(1-\theta)=\frac{7}{3}-2\theta$. We rearrange for $\theta$ and write the sample mean $\bar X$ in place of $E(X)$: $\hat\theta=\frac{7}{6}-\frac{1}{2}\bar X$ which yields $\hat\theta=0.417$.

		Standard error: we need to calculate the variance of $X$ ($Var(X)=E(X^2)-(E(X))^2$). The process yields $E(X^2)=\frac{17-16\theta}{3}$ so $Var(X)=-4\theta^2+4\theta+\frac{2}{9}$. $Var(\bar X)=Var(\frac{1}{n}\sum_{i=1}^nX_i)=\frac{1}{n^2}Var(X_i)=\frac{1}{n}Var(X_1)$.

		$Var(\hat\theta)=\frac{1}{4}Var(\bar X)=-\frac{1}{10}\theta^2+\frac{1}{10}\theta+\frac{1}{180}$. We replace $\theta$ with $\hat\theta=0.417$, yielding that $s_{\hat\theta}^2=0.0299$ and the standard deviation is simply the square of this.

		\item (Rice E8Q19) Suppose $X_1,\cdots,X_n$ are iid $N(\mu, \sigma^2)$. MLE of each of $\sigma,\mu$, with the other one known:

		$L(\theta)=\frac{1}{\sigma^n(2\pi)^\frac{n}{2}}e^{-\frac{1}{2}}\left(\sum_{i=1}^n\left(\frac{x_i-\mu}{\sigma}\right)^2\right)$. Log likelihood: $\ell(\theta)=-n\ln(\sigma)-\frac{n}{2}\ln(2\pi)-\frac{1}{2\sigma^2}\sum_{i=1}^n(x_i-\mu)^2$ and then maximize this function for each parameter. We get that $\hat\sigma=\sqrt{\frac{1}{n}\sum_{i=1}^n(x_i-\mu)^2}$ and $\hat\mu=\frac{\sum_{i=1}^nx_i}{n}$.

		\item (Rice E8Q7) Suppose $X\sim Geo(p)$ and we have an iid sample of size $n$. Method of moments estimate of $p$: we are looking to express $p$ in terms of the moments; we have that $E(X)=p$ so $p=\frac{1}{E(X)}$. Hence, $\hat p=\frac{1}{\bar X}$.

		MLE of $p$: $L(p)=p^n(1-p)^{\sum_{i=1}^n(x_i-1)}$, $\ell(p)=n\ln(p)+\sum_{i=1}^n(x_i-1)\ln(1-p)$ which we can use to maximize $p$: $p=\frac{n}{\sum_{i=1}^nx_i}=\frac{1}{\bar X}$, obtaining that $\bar p=\frac{1}{\bar X}$.

		Variance of our MLE: $Var(\hat p)=\frac{-1}{E(\ell''(p)}$ asymptotically and we have that $E(\ell''(p))=E\left(-\frac{n}{p^2}-\left[\sum_{i=1}^nX_i-n\right]\frac{1}{(1-p)^2}\right)=-\frac{n}{p^2}-\left(\sum_{i=1}^nE(X_i)-n\right)\frac{1}{(1-p)^2}=-\frac{n}{p^2(1-p)}$. Hence $Var(\hat p)\approx\frac{p^2(1-p)}{n}$.

		If $p$ has a uniform prior distribution on $[0,1]$, the posterior distribution of $p$ is $f_{P|X}(p|x)=\frac{f_{X|P}(x|p)f_p(p)}{f_X(x)}$. $f_{X|P}(x|p)$ is simply the likelihood function, and $f_X(x)$ can be computed: $f_X(x)=\int_\R f_{X|P}(x|p)f_P(p)\dd p=\int_0^1f_{X|P}(x|p)\dd p=\int_0^1p^n(1-p)^{\sum_{i=1}^n(x_i-1)}\dd p$. Relating this to a Beta distribution, we find a value for $f_X(x)$ so we plug it into $F_{P|X}(p|x)$.

		The expected value of our posterior distribution is given by $E(P|X)=\frac{n}{n+\sum_{i=1}^nx_i-n}$ (again, using the mean of a Beta distribution).
	\end{enumerate}

	\newpage
	\section{Types of Convergence}
	\begin{itemize}
		\item Convergence in distribution: $Z_n\overset{d}{\to}Z$ if $\displaystyle\lim_{n\to\infty}F_n(x)=F(x)$ everywhere $F$ is continuous
		\item Convergence in probability: $Z_n\overset{P}{\to}Z$ if $\displaystyle\lim_{n\to\infty}P(|Z_n-Z)|>\epsilon)=0$
		\item Almost-surely convergence: $Z_n\overset{a.s.}{\to}Z$ if $P(\displaystyle\lim_{n\to\infty}Z_n=Z)=1$
	\end{itemize}
	\section{Unbiased Estimator for $\sigma^2$}
	We have that the population variance is
	\[\sigma^2=\frac{1}{N}\sum_{i=1}^N(X_i-\mu)^2\]
	and we have may want to estimate it using $\frac{1}{n-1}\sum_{i=1}^n(X_i-\bar X)^2$ or $\frac{1}{n}\sum_{i=1}^n(X_i-\bar X)^2$. The first is unbiased, and the other one (given by both the method of moments \& MLE estimation) is biased. Proof:
	\begin{align*}
		\sum_i(X_i-\mu)^2&=\sum_i(X_i-\bar X+\bar X-\mu)^2\\
		&=\sum_i\left[(X_i-\bar X)^2+(\bar X-\mu)^2\right.\\
		&+\left.2(X_i-\bar X)(\bar X-\mu)\right]\\
		&=n\hat\sigma^2+n(\bar X-\mu)^2+0(\bar X-\mu)\\
		&=\sum_i(X_i-\bar X)^2+n(\bar X-\mu)^2\\
		\sum_i(X_i-\bar X)^2&=\sum_i(X_i-\mu)^2-n(\bar X-\mu)^2
		\shortintertext{Take expectation on both sides:}
		E[\cdots]&=\sum_iVar(X_i)-nVar(\bar X)\\
		&=\sum_i\sigma^2-n\frac{\sigma^2}{n}=n\sigma^2-\sigma^2\\
		&=(n-1)\sigma^2
	\end{align*}
	Another method for the normal distribution: it can be shown that $\bar X$ and $S^2$ are independent, and $\frac{(n-1)S^2}{\sigma^2}\sim\chi^2_{(n-1)}$. Starting with the equation before we took the expectation, we can divide it by $\sigma^2$ to obtain
	\[\sum_i\left(\frac{X_i-\mu}{\sigma}\right)^2=\frac{(n-1)S^2}{\sigma^2}+\left(\frac{\bar X-\mu}{\sigma/\sqrt n}\right)^2\]
	where $\sum_i\left(\frac{X_i-\mu}{\sigma}\right)^2\sim\chi^2_{(n)}$ and $\left(\frac{\bar X-\mu}{\sigma/\sqrt n}\right)^2\sim\chi^2_{(1)}$. So we can use MGFs and the independence of $\bar X$ and $S^2$ to find that $\frac{(n-1)S^2}{\sigma^2}\sim\chi^2_{(n-1)}$. Since the expectation of a Chi Square variable is just its degrees of freedom we have that $E(S^2)=\sigma^2$ so $S^2$ is an unbiased estimator of $\sigma^2$ under the normal distribution.

	\section{Sufficient Statistic}
	Roughly, a sufficient statistic for a parameter is a summary of a sample which yields the same information about the parameter as the entire sample (data reduction). Formally, a statistic $T(X_1,\cdots,X_n)$ is sufficient for $\theta$ if the conditional distribution of $X_1,\cdots,X_n$ given $T=t$ doesn't depend on $\theta$.

	\textbf{Factorization Theorem}: $T(X_1,\cdots,X_n)$ is sufficient for $\theta$ if the joint probability function factors in the form
	\begin{align*}
		&f(x_1,\cdots,x_n|\theta) \\
		=\ &g(T(x_1,\cdots,x_n),\theta)h(x_1,\cdots,x_n)
	\end{align*}
	where $h$ is a function of sample observations and $g$ involves $\theta$ and the sufficient statistic $T$.

	It is also useful to identify distributions in the exponential family of distributions. We can express the density or frequency functions in the form

	\[f(x|\theta)=\begin{cases}
	e^{c(\theta)T(x)+d(\theta)+S(x)}, & x\IN A\\
	0, & x\not\in A
	\end{cases}\]
	Such distributions include the  normal, exponential, log-normal, gamma, chi-squared, beta, Dirichlet, Bernoulli, categorical, Poisson, geometric, inverse Gaussian, von Mises and von Mises-Fisher distributions. Some distributions are exponential families only if some of their parameters are held fixed. {\tiny The family of Pareto distributions with a fixed minimum bound $x_m$ form an exponential family. The families of binomial and multinomial distributions with fixed number of trials n but unknown probability parameter(s) are exponential families. The family of negative binomial distributions with fixed number of failures (a.k.a. stopping-time parameter) r is an exponential family. However, when any of the above-mentioned fixed parameters are allowed to vary, the resulting family is not an exponential family.} As mentioned above, as a general rule, the support of an exponential family must remain the same across all parameter settings in the family.

	\section{Consistent Estimators}
	In this course, consider only estimators being consistent in probability.

	Immediate results: the LLN tells use that $\bar X=\frac{1}{n}\sum X_i\overset{P}{\to}E(X_i)$ for any distribution, so $\bar X$ is a consistent estimator of $\mu$ for $X_i\overset{iid}{\sim}N(\mu,\sigma^2)$, $\bar X$ is a consistent estimator of $\lambda$ for $X_i\overset{iid}{\sim}Poi(\lambda)$, etc.

	\textbf{Slutsky's lemma}: $X_n, Y_n$ are sequences.
	\begin{gather*}
		X_n\overset{P}{\to}X, Y_n\overset{P}{\to}Y\IMP X_n+Y_n\overset{P}{\to}X+Y \\
		X_n\overset{P}{\to}X, Y_n\overset{P}{\to}Y\IMP X_nY_n\overset{P}{\to}XY
	\end{gather*}
	\textbf{Continuous mapping theorem}: $X_n\overset{P}{\to}X$ and $g$ continuous. Then $g(X_n)\overset{P}{\to}g(X)$

	\textbf{MSE consistent}: an estimator $T_n$ is MSE consistent if $MSE(T_n)\overset{n\to\infty}{\longrightarrow}0$

	We have that the MLE is consistent. Let $\theta_0$ represent the true value of the parameter which produced the data (unknown, constant) let $X_i\overset{iid}{\sim} f(x|\theta_0)$, and let $\hat\theta$ be the MLE. Proof that $\hat\theta\overset{P}{\to}\theta_0$: start with the log likelihood $\ell(\theta)=\sum_{i=1}^n\log f(X_i|\theta)$. Divide both sides by the sample size $n$ and apply LLN.

	Since $\frac{1}{n}\ell(\theta)$ gets closer to $E(\log f(X_i|\theta))$, the $\theta$ that maximizes $\frac{1}{n}\ell(\theta)$ should be closed to the $\theta$ that maximizes $E(\log f(X_i|\theta))$. We can show that $E(\log f(X_i|\theta))$ is maximized at $\theta_0$.

	\section{Score and Fisher Information}
	The score function is the derivative of the log likelihood,
	\[S(\theta)=\pdv{\theta}\ell(\theta)=\ell'(\theta)\]
	and the solution to the score equation
	\[S(\theta)=0\]
	is the MLE. We say that $\left.S(\theta)\right|_{\theta=\hat\theta}=0$.

	The score as a random variable for iid $X_i$ has that
	\begin{align*}
		S(\theta|X_i)&=\pdv{\theta}\sum_i\log f(X_i|\theta)\\
		&=\sum_i\pdv{\theta}\log f(X_i|\theta)=\sum_iS(\theta|X_i)
	\end{align*}
	They key takeaway is that $S(\theta)$ is random; for a different set of observations, the likelihood function varies.

	The Fisher Information is defined by
	\begin{align*}
		I(\theta_0)&=Var\left(S(\theta|X)|_{\theta=\theta_0}\right)\\
		&=E\left(\pdv{\theta}\left.\log f(X|\theta)\right|_{\theta=\theta_0}\right)^2\\
		&=-E\left(\pdv[2]{\theta}\log f(X|\theta)|_{\theta=\theta_0}\right)
	\end{align*}
	and is the amount of information that each observable random variable $X$ contains about $\theta$.
	\section{Quiz 2 Problems}
	\begin{enumerate}[label=\alph*), wide, labelwidth=0pt, labelindent=0pt]
		\item (W4 Notes) Suppose $X_1,X_2,X_3\overset{iid}{\sim}Poi(\lambda)$. Verify that $T=\sum_{i=1}^3X_i$ is a sufficient statistic for $\lambda$.
		\begin{align*}
			&P(X_1=x_1,\cdots,X_3=x_3|\sum x_i=t)\\
			&=\frac{P(X_1=x_1,\cdots,X_3=x_3,\sum x_i=t)}{P(\sum x_i=t)}\\
			&=\frac{P(X_1=x_1,\cdots,X_3=t-(x_1+x_2))}{P(\sum x_i=t)}\\
			&=\frac{\frac{\cancel{e^{-\lambda}}\lambda^{x_1}}{x_1!}\frac{\cancel{e^{-\lambda}}\lambda^{x_2}}{x_2!}\frac{\cancel{e^{-\lambda}}\lambda^{t-(x_1+x_2)}}{(t-(x_1+x_2))!}}{\frac{\cancel{e^{-3\lambda}}(3\lambda)^t}{t!}}\\
			&=\frac{\cancel{\lambda^t}}{x_1!x_2!}\frac{t!}{(3\cancel{\lambda})^t}=\frac{t!}{x_1!x_2!3^t}
		\end{align*}
		which doesn't depend on $\lambda$.

		\item (W4 Notes) Factorization theorem for $Poi(\lambda)$:
		\begin{align*}
			L(\lambda)&=e^{n\lambda}\lambda^{\sum x_i}\frac{1}{\prod x_i!}\\
			&=g\left(\sum_{i=1}^nx_i,\lambda\right)h(x_1,\cdots,x_n)
		\end{align*}
		so $T=\sum x_i$ is a sufficient statistic for $\lambda$.

		\item (W4 Notes) Score \& Fisher Information using Poisson Distribution

		Let $X_1,\cdots,X_n\overset{iid}{\sim}Poi(\lambda)$ with $\lambda_0$ parameter.
		\begin{align*}
			L(\lambda)&=\prod f(X_i|\theta)\\
			&=\prod\frac{e^{-\lambda}\lambda^{\sum X_i}}{\prod X_i!}\\
			\ell(\lambda)&=-n\lambda +(\sum X_i)\ln\lambda-\sum\ln(X_i)!\\
			\pdv{\lambda}\ell(\lambda)&=-n+\frac{\sum X_i}{\lambda}\\
			I(\lambda_0)&=Var(S(\lambda|X)|_{\lambda=\lambda_0})\\
			&=Var\left(-1+\frac{X}{\lambda_0}\right)\\
			&=\frac{1}{\lambda^2_0}Var(X)=\frac{1}{\lambda_0}
		\end{align*}
    \end{enumerate}
    \newpage
    \section{Efficiency}
    For two estimators $T_1,T_2$ of a statistic $\theta$, the efficiency of $T_1$ relative to $T_2$ is
    \[\text{eff}(T_1,T_2)=\frac{\text{var}(T_2)}{\text{var}(T_1)}\]
    A more efficient estimator has a smaller variance, and the most efficient unbiased estimator achieves the Cram\`er-Rao Lower Bound.

    \section{Distribution of MLE}
    Under some conditions, as $n\to\infty$,
    \[\frac{\hat\theta-\theta_0}{\sqrt{\frac{1}{n}I(\theta_0)}}\overset{D}{\to}N(0,1)\]
    As a consequence, for large $n$, $E(\hat\theta)=\theta_0$ and $V(\hat\theta)=\frac{1}{nI(\theta_0)}$.

    Proof: we have that $\ell'(\hat\theta)=0, E(\ell'(\theta_0))=0), \ell'(\theta_0)\overset{D}{\to}N(0,nI(\theta_0))$ so $\frac{1}{n}\ell'(I(\theta_0))\overset{D}{\to}N(0,\frac{1}{n}I(\theta_0))$.

    Additionally, by LLN, $\frac{1}{n}\ell''(\theta_0)\overset{P}{\to}-I(\theta_0)$.

    We then use the Taylor series expansion of $\ell'(\hat\theta)$ around $\theta_0$ to find that
    \[\hat\theta-\theta_0\approx-\frac{\ell'(\theta_0)}{\ell''(\theta_0)}=\frac{\frac{1}{n}\ell'(\theta_0)}{-\frac{1}{n}\ell''(\theta_0)}\]
    And with this we obtain the result. Additionally, the MLE is: asymptotically unbiased, a function of sufficient statistics, consistent, and asymptotically efficient.

    \section{Confidence Intervals}
    Some sampling distributions:
    \begin{itemize}
        \item $X_1,\cdots,X_n\overset{iid}{\sim}N(\mu,\sigma^2)$:
        \begin{gather*}
            \frac{\bar X-\mu}{\sigma/\sqrt n}\sim N(0,1) \\
            \frac{\bar X-\mu}{S/\sqrt n}\sim t_{(n-1)} \\
            \frac{(n-1)S^2}{\sigma^2}\sim\chi^2_{(n-1)}
        \end{gather*}
        \item Distribution of MLE (above)
    \end{itemize}
    $\gamma$-Confidence interval: intuitively, some interval which will have at least $\gamma$ chance of containing the true parameter. $C(X_1,\cdots,X_n)=(l(X_1,\cdots,X_n),u(X_1,\cdots,X_n))$ is a $\gamma$ confidence interval for $\psi$ if $P(l()\leq\psi(\theta)\leq u)\geq\gamma$ for every $\theta\IN\Omega$.

    Pivotal Quantity: a random variable defined in terms of the sample; involves the unknown parameters in its expression, but the distribution of this quantity doesn't depend on the parameters.

    For each of the sampling distributions above, we can use the $z, t$, or $\chi^2$ distributions to calculate the necessary quantiles which correspond to $\gamma$. We use the standard normal for $\mu$ when $\sigma^2$ is known, the $t$ distribution for $\mu$ when $\sigma^2$ is unknown, and the $\chi^2$ distribution for $\sigma^2$.

    For two-sided confidence intervals, notice that the $Z,t$ distributions are symmetric about their means so the shortest interval is also symmetric about the mean. For the $chi^2$ distribution, we use $\frac{1\pm\gamma}{2}$ even though it may not yield the shortest interval (its shape is determined by the degrees of freedom).

    For MLE-based confidence intervals, the confidence interval is given by
    \[\hat\theta\pm z_{(\frac{1+\gamma}{2})}\sqrt{\frac{1}{nI(\theta_0)}}\]
    where $\hat\theta$ is the MLE and we use either a plug-in estimate of the Fisher Information (replace $\theta_0$ by $\hat\theta$) or the observed Fisher Information (replace $\theta_0$ with summary of observed data).

    For one-sided confidence intervals, we consider one side of each distribution.

    Interpretation:
    \begin{itemize}
        \item For $z,t$ intervals, the sample mean is the midpoint of the lower and upper bound. The width of the interval is given by $u-l$, and the margin of error is half of the width.
        \item The width of the interval increases as the confidence level increases or the standard deviation ($\sigma,s$) increases
        \item The width of the interval decreases as the sample size increases
        \item CIs are not fixed numbers but rather random variables; ``there is a 95\% chance that $\mu$ is between 4.442 and 5.318 is incorrect.'' Rather, we should say, ``if we keep taking samples and construct 0.95-CIs, 95\% of the confidence intervals will capture the true value of the parameter.''
	\end{itemize}

	\section{Hypothesis Tests}
	Null Hypothesis, $H_0$: the hypothesis we want to test with respect to the parameter. Usually will be a simple hypothesis (parameter takes a single value from the parameter space).

	Alternative Hypothesis, $H_A$ or $H_1$: other values the parameter of interest can take on. Usually will be a composite hypothesis.

	We use test statistics which, under the null hypothesis, will have a known distribution. Some of the pivotal quantities used to construct confidence intervals are useful for the critical region or $p$-value approach.

	Critical region, $R_\alpha(T)$ ($\alpha\IN[0,1]$): a region of the distribution of the test statistic under the null hypothesis such that we reject $H_0$ if $T(X)\IN R_\alpha(T)$.
	\[P[T(X)\IN R_\alpha(T)|H_0\text{ true}]=\alpha\]

	$p$-value: the smallest level of significance at which $H_0$ would be rejected based on the observed data, or the probability of observing the result as or more extreme than what was actually observed if $H_0$ is true. We reject $H_0$ if the $p$-value is less than a cutoff (conventionally, $0.01,0.05,0.1$).

	Some example $p$-values for two-sided tests:

	\begin{gather*}
		2\left(1-\Phi\left(\left|\frac{\bar x-\mu_0}{\sigma/\sqrt n}\right|\right)\right) \tag{z test} \\
		2\left(1-G\left(\left|\frac{\bar x-\mu_0}{s/\sqrt n}\right|\right)\right) \tag{t test}
	\end{gather*}

	\begin{center}
		\begin{tabular}{c|c|c}
			\hline
			& fail to reject $H_0$ & reject $H_0$ \\\hline
			$H_0$ true & correct & type 1 ($\alpha$) \\\hline
			$H_0$ false & type 2 ($\beta$) & correct \\\hline
		\end{tabular}
	\end{center}
	Notice that $\alpha,\beta$ are inversely related.

	Power of a test: $1-\beta$. We calculate this using the density under $H_1$; start with finding $R_a$ given $H_0$, and then calculate the probability of having data within the rejection region given $H_1$.

	\section{Tests of Two Populations}
	By constructing other test statistics, we can reduce a hypothesis test involving two population parameters to one of the previous tests.

	Consider two independent normal samples
	\begin{gather*}
		X_1,\cdots,X_n\sim N(\mu_x,\sigma^2_x) \\
		Y_1,\cdots,Y_m\sim N(\mu_y,\sigma^2_y)
	\end{gather*}
	Say we want to test $H_0:\sigma^2_x=\sigma^2_y$ vs $H_1:\sigma^2_x\neq\sigma^2_y$, then using an $F$ distribution, we can write
	\[\frac{S^2_x/\sigma^2_x}{S^2_y/\sigma^2_y}\sim F_{n-1,m-1}\]
	Under $H_0$, $\frac{S^2_x}{S^2_y}\sim F_{n-1,m-1}$ and the rejection region is $(-\infty, F_{\alpha/2,(n-1,m-1))})\cup (F_{1-\alpha/2,(n-1,m-1)}, \infty)$

	Say we want to test $H_0:\mu_x=\mu_y$ ($\mu_x-\mu_y$) vs $H_1:\mu_x\neq \mu_y$ with $\sigma_x,\sigma_y$ known. We can use $\bar X,\bar Y$ to estimate each parameter respectively, giving
	\begin{gather*}
		\bar X-\bar Y\sim N\left(\mu_x-\mu_y,\sigma^2_x/n+\sigma^2_y/m\right) \\
		\frac{(\bar X-\bar Y)-(\mu_x-\mu_y)}{\sqrt{\sigma^2_x/n+\sigma^2_y/m}}\sim N(0,1)
		\intertext{and under $H_0$}
		\frac{(\bar X-\bar Y)}{\sqrt{\sigma^2_x/n+\sigma^2_y/m}}\sim N(0,1)
	\end{gather*}
	Also if we know $\sigma_x=\sigma_y=\sigma$, we can factor out the population variance term in the denominator above.

	Say we want to test  $H_0:\mu_x=\mu_y$ ($\mu_x-\mu_y$) vs $H_1:\mu_x\neq \mu_y$ with $\sigma_x,\sigma_y$ unknown but equal. Then
	\begin{align*}
		\frac{(n-1)S^2_x}{\sigma^2}+\frac{(m-1)S^2_y}{\sigma^2}&\sim\chi^2_{(n+m-2)}\\
		\frac{1}{\sigma^2}((n-1)S^2_x+(m-1)S^2_y)&\sim\chi^2_{(n+m-2)}
		\intertext{and using the def'n of a $t$-distribution}
		\frac{\frac{\bar X-\bar Y}{\sigma\sqrt{1/n+1/m}}}{\sqrt{\frac{\frac{1}{\sigma^2}[(n-1)S^2_x+(m-1)S^2_y]}{n+m-2}}}&\sim t_{n+m-2}\\
		\frac{\bar X-\bar Y}{\sqrt{\frac{(n-1)S^2_x+(m-1)S^2_y}{n+m-2}}\sqrt{\frac{1}{n}+\frac{1}{m}}}&\sim t_{n+m-2}\\
		\frac{\bar X-\bar Y}{S_p\sqrt{\frac{1}{n}+\frac{1}{m}}}&\sim t_{n+m-2}
	\end{align*}
	we call $S^2_p=\sqrt{\frac{(n-1)S^2_x+(m-1)S^2_y}{n+m-2}}$ the pooled sample variance.

	In this case, we use the test statistic $\frac{\bar X-\bar Y}{\sqrt{\frac{S^2_x}{n}+\frac{S^2_y}{m}}}$ which is approximated using a $t$ distribution with a complicated form of the degrees of freedom (not in this course).

	For paired (dependent) data $X,Y$, we can define $D=X-Y$ and test $\mu_d=0$ using
	\[\frac{\bar D}{S_d/\sqrt n}\sim t_{n-1}\]
\end{multicols*}
\end{document}


As stated in the introduction, metasurfaces are 2D materials with some sub-wavelength structure. Their properties are determined by the geometry of this structure which is usually a simple shape, like a rectangle or oval, on a periodic grid. The shape is called metaatom and in the case of plasmonic metasurfaces it is made of metal.
With the $S$-matrix calculus and SASA we can fully describe stacks of homogeneous isotropic materials but we still have no understanding of what happens when we add a metasurface to a stack. To build some intuition for how a specific metasurface will affect the transmission spectrum of a stack, we will need a little more theory on optics in materials. As stated before, all optical properties of a material a captured by the $\vb D$ and $\vb H$ fields and in our context
\begin{equation} \label{eq:bg:D}
    \vb D =
    \epsilon_0 \, \vb E + \vb P =
    \epsilon_0\, \underbrace{\qty(1 + \chi)}_{
         := \epsilon
    }\, \vb E
\end{equation}
so the $\vb D$ field is determined by the $\vb E$ field and dielectric function $\epsilon$. In the following sections we will discuss which materials have which kind of dielectric functions and how we can use these to gain some understanding of the optical mechanisms in a metasurface.

\paragraph{Dielectric Function}~\\
In the simplest model we can describe electrons in a material as an ensemble of harmonic oscillators

\begin{equation} \label{eq:bg:lorentz}
    m \ddot{\vb x} + m \gamma \dot{\vb x} + m \omega_0^2 \vb x = -e \vb E,
\end{equation}

with the displacement $\vb x$, electron mass $m$, electron charge $e$, dampening factor $\gamma$ and resonance frequency $\omega_0$.
In this model the macroscopic polarization $\vb P$ is directly caused by this displacement $\vb x$ through
\begin{equation} \label{eq:bg:P}
    \vb P = - \rho e \vb x,
\end{equation}

where $\rho$ is the density of electrons.
If we assume a harmonic time dependency $\vb E(t) = \vb E_0 e^{i \omega t}$ equation \eqref{eq:bg:lorentz} is solved by
\begin{equation}
    \vb x(t) = \frac{e}{m(\omega^2 + i \gamma \omega - \omega_0^2)} \vb E(t)
\end{equation}

and using equation \eqref{eq:bg:D} and \eqref{eq:bg:P} this results in the $\vb D$ field
\begin{equation}
    \vb D =
    \epsilon_0 \underbrace{
    \qty(1 - \frac{f}{\omega^2 + i \gamma \omega - \omega_0^2})
    }_{
        =\epsilon
    }
    \vb E,
\end{equation}

where $f = \rho e^2 / \epsilon_0 m$ is the oscillator strength.
In a real material there are always multiple resonance frequencies $\omega_m$ but in good approximation these do not influence each other and the total dielectric function can be obtained simply by summing over all $m$ \cite{FOMO}
\begin{equation}
    \epsilon(\omega) :=
    \epsilon'(\omega) + i \epsilon''(\omega) =
    1 + \sum_m \frac{f_m}{\omega_m^2 - \omega_0^2 - i \gamma \omega}
\end{equation}

\begin{figure}[H]
    \floatbox[{
    \capbeside
    \thisfloatsetup{capbesideposition={right,top}}}]{figure}[\FBwidth]
    {\caption{
        Example plots for the real and imaginary part of the refractive index
        $n = \eta + i\kappa$
        as calculated by the multiple resonance Lorentz model.
        \cite{FOMO}
    }
    \label{fig:bg:lorentz}}
    {\includegraphics[width=0.5\textwidth]{bg_lorentz}}
\end{figure}

\begin{figure}[H]
    \centering
    \begin{subfigure}{.5\textwidth}
        \centering
        \includegraphics[width=.8\linewidth]{bg_dielectric}
        \caption{}
        \label{fig:bg:dielectric}
    \end{subfigure}%
    \begin{subfigure}{.5\textwidth}
        \centering
        \includegraphics[width=.8\linewidth]{bg_metal}
        \caption{}
        \label{fig:bg:metal}
    \end{subfigure}
    \caption{Imaginary and real part of the dielectric function
    $\epsilon = \epsilon' + i \epsilon''$
    for dielectrics (a) and metals (b) in the visible spectrum.
    \cite{FOMO}}
    \label{fig:bg:dm}
    \end{figure}

In section \ref{sec:s_mats} we have already discussed how the dielectric function is related to the complex refractive index by
\begin{equation}
    \epsilon = n^2 = (\eta + i \kappa)^2
\end{equation}

and this relationship is used to generate figure \ref{fig:bg:lorentz}. We observe high $\kappa$, so high absorption, at the resonance frequencies in the from of Lorentz peaks. Between resonance frequencies generally
$\partial \eta / \partial \omega > 0$.
This is called normal dispersion and explains, for example, why red light is diffracted stronger than blue light.
Figure \ref{fig:bg:lorentz} is just a general example. To understand metasurfaces we need to discuss how the resonance frequencies are distributed in real materials.
\\

\indent
Dielectrics in the visible spectrum are well described by two resonance frequencies. One in the IR and one in the UV range. That means in the visible spectrum we have a vanishing imaginary part $\epsilon''$ of the dielectric function and normal dispersion as seen in figure \ref{fig:bg:dielectric}.
Metals on the other hand are characterized by their high availability in free charges, thereby eliminating the restoring force ($\omega_0 = 0$) and reducing the dielectric function to
\begin{equation}
    \epsilon(\omega) = 1 - \frac{\omega_\s p^2}{\omega^2 + i \gamma \omega}\, ,
\end{equation}

with the plasma frequency
$\omega_\s p^2 = f = \rho e^2 / \epsilon_0 m$.
This results in a large negative $\epsilon'$ and a positive $\epsilon''$ as seen in figure \ref{fig:bg:metal}. The negative $\epsilon'$ is responsible for the reflection of visible light at metallic surfaces.

\paragraph{Surface Plasmon Polaritons}~\\
Finally, we can discuss the mechanism behind the optical properties of plasmonic metasurfaces. These work by allowing the excitation of a special electromagnetic wave at a metal dielectric interface called Surface Plasmon Polariton (SPP). This wave is confined to and travels along the interface until its energy is lost via absorption or scattering. That means it enables some photons to be absorbed by coupling into the interface. At which wavelengths this conversion occurs depends on the metasurface geometry and can thus be tailored for a specific optical target.

\begin{figure}[H]
    \centering
    \includegraphics[width=.6\linewidth]{bg_md_interface}
    \caption{Metal dielectric interface with light in a TM mode.}
    \label{fig:bg:md_inderface}
\end{figure}

Suppose the described wave exists as a TM mode, as can be seen in figure \ref{fig:bg:md_inderface}, and has the form

\begin{equation}
\begin{aligned}
    E_x &= E_0 e^{i k_x x - k_z z} \\
    E_z &= E_0 \frac{k_x}{k_z} e^{i k_x x - k_z z}\\
    H_y &= H_0 e^{i k_x x - k_z z}
\end{aligned}
\end{equation}

That is, propagating along the $x$ axis and evanescently decaying along the $z$ axis. This wave does indeed satisfy Maxwell's equation and the continuity conditions discussed in section \ref{sec:s_mats} if and only if \cite{Maier2007}

\begin{equation} \label{eq:bg:con1}
    \frac{\epsilon_1}{k_{z1}} = - \frac{\epsilon_2}{k_{z2}}
\end{equation}

and

\begin{equation} \label{eq:bg:con2}
    k_x^2 + k_{zn}^2 = \epsilon_n \frac{\omega^2}{c^2}
    \qq{for}
    n = 1,2.
\end{equation}

Equation \eqref{eq:bg:con1} explains why SPP's are only possible at metal dielectric interfaces because $\epsilon'_1$ and $\epsilon'_2$ need to have different signs and this is fulfilled precisely for metals and dielectrics as can be seen in figure \ref{fig:bg:dm}. If we solve equation \eqref{eq:bg:con1} and \eqref{eq:bg:con2}, we can obtain the dispersion relation for SPP's

\begin{equation}
    k_x = \frac{\omega}{c}
    \qty(\frac{\epsilon_1 \epsilon_2}{\epsilon_1 + \epsilon_2})^{1/2}.
\end{equation}

This dispersion relation is shown in figure \ref{fig:bg:dispersion}. For small wave vectors SPP's behave like light but then they start to have increasingly lower energy $E = \hbar \omega$ compared to a free photon at the same momentum $\vb p = \hbar \vb k$. However, for a conversion Photon $\rightarrow$ SPP both energy and momentum have to be conserved.
Thus excitation of SPP's is not possible at a simple smooth metallic surface, but rather the wave vector of an incident photon has to be matched to that of an SPP of the same energy by the surface geometry.
\\

\indent
To summarize, photons can couple into a plasmonic metasurface by exiting a special electromagnetic wave called Surface Plasmon Polariton confined to the interface. The exact wavelength at which this conversion is possible depends on the metaatom geometry and can thus be easily tuned to create different optical behaviors.

\begin{figure}[H]
    \floatbox[{
    \capbeside
    \thisfloatsetup{capbesideposition={right,top}}}]{figure}[\FBwidth]
    {\caption{
        Dispersion relation for light and Surface Plasmon Polaritons in air (grey) and silica (black). Frequency and wave vector are normalized to the plasma frequency $\omega_\s p$ \cite{Maier2007}.
    }
    \label{fig:bg:dispersion}}
    {\includegraphics[width=0.55\textwidth]{bg_dispersion}}
\end{figure}


\subsection{Bit-Blasting}

\begin{frame}
  \frametitle{Bit-Blasting}

Our goal is to devise an automatic decision procedure (\smtsolver)
to check the satisfiability of a given \bitvector formula
\vfill
\pause
State-of-the-art techniques are based on reduction to SAT. It is
called {\bf bit-blasting}
\vfill
\pause
\begin{itemize}
  \item the formula is seen as a circuit, in which
        variables and constants are inputs, while
        other terms are intermediate nodes. The outermost
        Boolean connective or predicate represents the output
\vfill
\pause

  \item each variable is assigned to a vector of Boolean variables
        ($n$ variables for a variable of sort \SBv{n})
\vfill
\pause

  \item each intermediate node is assigned to a vector of
	Boolean \formulae
        ($n$ \formulae for a term of sort \SBv{n})
\end{itemize}

\end{frame}

\begin{frame}
  \frametitle{Bit-Blasting}

  $$
  (\w{a}{2} \band \w{b}{4}[1:0]) = (\w{c}{2} + \w{d}{2})
  $$
  \vfill
  \begin{overlayarea}{\textwidth}{5cm}
  \begin{center}
    \only<1|handout:0>{\scalebox{.35}{\input{bb_example_0.pdf_t}}}
    \only<2|handout:0>{\scalebox{.35}{\input{bb_example_1.pdf_t}}}
    \only<3|handout:0>{\scalebox{.35}{\input{bb_example_2.pdf_t}}}
    \only<4|handout:0>{\scalebox{.35}{\input{bb_example_3.pdf_t}}}
    \only<5|handout:0>{\scalebox{.35}{\input{bb_example_4.pdf_t}}}
    \only<6|handout:0>{\scalebox{.35}{\input{bb_example_5.pdf_t}}}
    \only<7|handout:0>{\scalebox{.35}{\input{bb_example_6.pdf_t}}}
    \only<8|handout:0>{\scalebox{.35}{\input{bb_example_7.pdf_t}}}
    \only<9->{\scalebox{.35}{\input{bb_example_8.pdf_t}}}
  \end{center}
  \end{overlayarea}
  \vfill
  \onslide<10->{
    $((b^1 \wedge a^1) \leftrightarrow (c^1 \oplus d^1 \oplus (c^0 \wedge d^0))) \wedge ((b^0 \wedge a^0) \leftrightarrow (c^0 \oplus d^0))$
  }

\end{frame}

\begin{frame}[fragile]
  \frametitle{Bit-Blasing Algorithm (1)}

  \tiny

  \begin{tabbing}
    \= asdf \= asdfasdfasdfasdfasdf \= asdfasdfasdf \= asdf \kill
    \> BB := $\{ \}$, C := $\{ \}$ \\
    \> \\
    \> {\bf Procedure} Bit-Blast-Term( $t$ : \SBv{n} term ) \\
    \> \\
    \> {\bf if} ( $t \in $ C ) {\bf return}; \> \> // If already in cache, skip \\
    \> {\bf else} C := C $\cup\ t$     \> \> // Put in cache \\
    \> \\ \pause
    \> {\bf if} ( $t$ is a \SBv{n} variable ) \\
    \> \> // Let $x$ be the name of the variable \\
    \> \> BB := BB $\cup\ \{ x \mapsto [\bit{x}{{n-1}}, \ldots, \bit{x}{0}] \}$ \\
    \> \> // where $\bit{x}{i}$ are fresh Boolean variables \\
    \> \\ \pause
    \> {\bf else if} ( $t$ is a \SBv{n} constant ) \\
    \> \> // Let $c$ be the constant \\
    \> \> BB := BB $\cup\ \{ c \mapsto [\bit{c}{{n-1}}, \ldots, \bit{c}{0}] \} $ \\
    \> \> // where $\bit{c}{i}$ is $\bot$ if the i-th bit of $c$ is $0$, $\top$ otherwise \\
    \> \\ \pause
    \> {\bf else if} ( $t$ is ($t_1 \band t_2$), and $t_1, t_2$ are \SBv{n} terms ) \\
    \> \> Bit-Blast-Term( $t_1$ ) \\
    \> \> Bit-Blast-Term( $t_2$ ) \\
    \> \> BB := BB $\cup\ \{ t \mapsto [\mbox{BB}(t_1, n-1) \wedge \mbox{BB}(t_2, n-1), \ldots, \mbox{BB}(t_1, 0) \wedge \mbox{BB}(t_2, 0)] \} $ \\
    \ldots
  \end{tabbing}

  where $\mbox{BB}(t, i)$ means:
  \begin{enumerate}
    \item retrieve the correspondence $t \mapsto [\bit{t}{n-1}, \ldots, \bit{t}{0}]$, and
    \item return $\bit{t}{i}$
  \end{enumerate}

\end{frame}

\begin{frame}[fragile]
  \frametitle{Bit-Blasing Algorithm (2)}

  \scriptsize

  \begin{tabbing}
    \= asdf \= asdf \= asdf \= asdf \kill
    \> {\bf Procedure} Bit-Blast( $\varphi$ : \SBv{n} formula ) \\
    \> \\
    \> {\bf if} ( $\varphi$ is $(t_1 = t_2)$, and $t_1, t_2$ are \SBv{n} terms ) \\
    \> \> Bit-Blast-Term( $t_1$ ) \\
    \> \> Bit-Blast-Term( $t_2$ ) \\
    \> \> BB := BB $\cup\ \{ \varphi \mapsto ((\mbox{BB}(t_1, n-1) \leftrightarrow \mbox{BB}(t_2, n-1)) \wedge
	                                      \ldots \wedge
				              (\mbox{BB}(t_1, 0) \leftrightarrow \mbox{BB}(t_2, 0))) \} $ \\
    \> \\ \pause
    \> {\bf else if} ( $\varphi$ is $(t_1 <_u t_2)$, and $t_1, t_2$ are \SBv{n} terms ) \\
    \> \> Bit-Blast-Term( $t_1$ ) \\
    \> \> Bit-Blast-Term( $t_2$ ) \\
    \> \> BB := BB $\cup\ \{ \ldots \}$ \\
    \> \\ \pause
    \> {\bf else if} ( $\varphi$ is $\varphi_1 \wedge \varphi_2$ are \SBv{n} formula ) \\
    \> \> Bit-Blast( $\varphi_1$ ) \\
    \> \> Bit-Blast( $\varphi_2$ ) \\
    \> \> BB := BB $\cup\ \{ \varphi \mapsto (\mbox{BB}(\varphi_1) \wedge \mbox{BB}(\varphi_2)) \}$ \\
    \ldots
  \end{tabbing}

  where $BB(\varphi)$ means:
  \begin{enumerate}
    \item retrieve the correspondence $\varphi \mapsto \psi$, and
    \item return $\psi$
  \end{enumerate}

\end{frame}

\begin{frame}
  \frametitle{SMT via Bit-Blasing}

  \begin{center}
  \scalebox{.5}{\input{bitblasting.pdf_t}}
  \end{center}

\end{frame}

\begin{frame}
  \frametitle{Bit-Blasing pros and cons}

  \scriptsize

  Pros
  \begin{itemize}
    \item Very easy to write, if compared to write a native \bitvector solver \pause
    \vfill
    \item Boolean model from SAT can be mapped back to a model for each \bitvector variable.
	  If $\w{x}{n}$ was bit-blasted as $x^{n-1}, \ldots, x^0$
	  \begin{itemize}
	    \item retrieve SAT assignment for each $x^i$ (e.g., $x^0 = \top$, $x^1 = \bot$)
	    \item construct actual value for $\w{x}{n}$ by mapping $\top$ to $1$ and $\bot$ to $0$ (e.g., $\w{x}{2} = 01$)
	  \end{itemize}
  \end{itemize}
  \vfill
  \pause
  Cons
  \begin{itemize}
    \item Does not scale very well. Consider the formula $\neg(\w{x}{n} = \w{0}{32}) \wedge (\w{x}{n} \band \w{y}{n}) = (\w{x}{n} + \w{y}{n})$.
          It is unsat for {\bf every} $n$. \pause But to prove it for $n=32$ requires $64$ Boolean variables, to prove it with $n=1024$
	  requires $2048$ Boolean variables
    \vfill
    \pause
    \item It destroys the structure of the formula. In the encoding $\w{x}{32}$ is not seen as a ``single object'' but each
          $x^i$ is unrelated and independent
  \end{itemize}

\end{frame}


\chapter{Statistical Mechanics Problems}
\begin{enumerate}
	\item A system of $\mathrm{N}$ particles has only two allowed state $\mathrm{A}$ and $\mathrm{B}$. The probability for $\mathrm{A}$ is $\mathrm{P}$ and for $\mathrm{B}$ is 1-P? What is the probability for the system to be in macrostate defined by the distribution of $(r, N-r) ?$
	\begin{answer}
		 \begin{align*}
		 	\text{The probability of finding }&\mathrm{r}\text{ particle in state } \mathrm{A}=\mathrm{P}^{r}\\
		 	\text{ The probability of finding }&N-r\text{ particle in state } B=(1-P)^{N-r}\\
		 \text{	The Total no. of-ways in which}&\text{ r particle can be choosen from }N \text{- particle is }{ }^{N} C_{r}=N ! / r !(N-r) !\\
		 \text{ The probability in which r particle }&\text{are in state $A$ and $N-r$ particle in state $B$ is }=\frac{N !}{r !(N-r) !} P^{r}(1-P)^{N-r}
		 \end{align*}
	\end{answer}
	\item A one dimensiional random walker takes step to left or right with equal probability. The probability that the random walker starting from orign is back to orign after $N$ even number of step,is
	 \begin{tasks}(2)
		\task[\textbf{a.}]$\frac{N !}{\left(\frac{N}{2}\right) !\left(\frac{N}{2}\right) !}\left(\frac{1}{2}\right)^{N}$
		\task[\textbf{b.}]$\frac{N!}{(\frac{N}{2})!(\frac{N}{2})!}$
		\task[\textbf{c.}]$2N!(\frac{1}{2})^{2N}$
		\task[\textbf{d.}] $N!(\frac{1}{2})^{N}$
	\end{tasks}
	\begin{answer}
		\begin{align*}
		\text{Probability} \quad P&=\frac{N!}{r~(N-r)}P(1-P)^{N-r}\\
		&=\frac{N !}{\left(\frac{N}{2}\right) !\left(\frac{N}{2}\right) !}\left(\frac{1}{2}\right)^{\frac{N}{2}}\left(1-\frac{1}{2}\right)^{N-\frac{N}{2}}=\frac{N!}{(\frac{N}{2})!(\frac{N}{2})!}\left( \frac{1}{2}\right) ^N
		\end{align*}
		Option \textbf{(a)} is correct
	\end{answer}
	\item Calculate the no. of microstates for a configuration of a system of $N$ distinguishable particles in which there are $n_1$ particles in a particle state $1 \& n_2$ particle in state $2,n_3$ particle .....$n_1$ particle in the $i$ th state.
	\begin{answer}
		\begin{align*}
		\text{Total No. of particle }&=N\\
		\text{No: of microstate for state}-1&={{N_C}_{n1}}\\
	\text{	No. of microstate for state }-2&=\mathrm{N}-\mathrm{n}_{1}{ }_{\mathrm{C}_{\mathrm{n}} 2}\\
\text{	No. of microstate for state }i^{\text {th }}&=N-n_{1}-n_{2} \ldots . n_{i}-1_{c_{n_{i}}}
\intertext{So\quad total number of microstate is}
\mathrm{N}_{\mathrm{C}_{\mathrm{n}_{1}}} \times \mathrm{N}-\mathrm{n}_{1} \mathrm{C}_{\mathrm{n}_{2}} &\times \mathrm{N}-\mathrm{n}_{1}-\mathrm{n}_{2} \mathrm{C}_{\mathrm{n}_{3}} \times \ldots \ldots \ldots \mathrm{N}-\mathrm{n}_{1}-\mathrm{n}_{2}-\mathrm{n}_{3}-\mathrm{ni}-1_{\mathrm{n}_{\mathrm{i}}}\\
=\frac{N !}{n_{1} !\left(N-n_{1}\right) !} &\times \frac{(N-n) !}{n_{2} !\left(N-n_{1}-n_{2}\right) !} \times \ldots \ldots \cdot \frac{\left(N-n_{1}-n_{2} \ldots n_{i}\right) !}{n_{i} !\left(N-n_{1}-n_{2} \ldots n_{i}\right) !}\\
=\frac{N !}{n_{i} !\left(N-n_{1}-n_{2} \ldots . n_{i}\right) !}&
-\text{ For distinguishable particle}\\
=\frac{1}{n_{i} !\left(N-n_{1}-n_{2} \ldots n_{i} !\right) !}& \rightarrow
\text{For indistinguishable particle}
		\end{align*}
	\end{answer}
	\item Four distinguishable coins are tossed a large no. of time write down the different microstate which may be observed \& the macrostate into which they would fall. Give the probability of the most probable macrostate.\\
	\begin{center}
	\begin{tabular}{|p{2.5cm}|p{2.7cm}|p{2.5cm}|p{2.7cm}|p{2.5cm}|}
		\hline Macrostate & Microstate coins having head up & Microstate coins having tail up & No.of microstate & Probability \\
		\hline $\mathrm{n}_{1}=4, \mathrm{n}_{2}=0$ & $\mathrm{a} \mathrm{b} \mathrm{c} \mathrm{d}$ & $-$ & 1 & $\frac{1}{16}$ \\
		\hline & $\mathrm{abc}$ & $\mathrm{d}$ & & \\
		$\mathrm{n}_{1}=3, \mathrm{n}_{2}=1$ & $\mathrm{bcd}$ & $\mathrm{a}$ & 4 & $\frac{4}{16}$ \\
		& $\mathrm{cda}$ & $\mathrm{b}$ & & \\
		& $\mathrm{dab}$ & $\mathrm{c}$ & & \\
		\hline
		 &$\mathrm{ab}$&$\mathrm{cd}$ & &\\
		 &$\mathrm{ac}$&$\mathrm{bd}$ & &\\
		 $n_1=2,n_2=3$&$\mathrm{ad}$&$\mathrm{bc}$ &6&$\frac{6}{16}$\\
		 &$\mathrm{bc}$&$\mathrm{ad}$ & &\\
		 &$\mathrm{bd}$&$\mathrm{ac}$ & &\\
		 &$\mathrm{cd}$&$\mathrm{ab}$ & &\\
		 \hline
		  &$\mathrm{a}$&$\mathrm{bcd}$ & &\\
		$n_1=1,n_2=3$&$\mathrm{b}$&$\mathrm{acd}$ &4 &$\frac{4}{16}$\\
		  &$\mathrm{c}$&$\mathrm{abd}$ & &\\
		 &$\mathrm{d}$&$\mathrm{abc}$ & &\\
		  \hline
		  	$n_1=0,n_2=1$&$-$&$\mathrm{abcd}$ &1 &$\frac{1}{16}$\\
		  	 \hline
	\end{tabular}
\end{center}
\begin{answer}
	\begin{align*}
	\text{Total no. of microstate }&=6\\
	\text{The probability of most probable state }&=6/16
	\end{align*}
\end{answer}
	\item An isolated system consist of two non-interacting spin $-1/2$ particles a \& b fixed in space \& kept in magnetic field B. Find out the total number of microstates allowed in the system.

	\begin{answer}
		$\left. \right. $\\
		\begin{table}[H]
	\begin{tabular}{|p{2.5cm}|p{2.5cm}|p{2.5cm}|p{2.5cm}|p{2.5cm}|}
		\hline
		Systemstate or macrostate  &Particlestate or Microstate & Magnetic moment &Energy  &No.of microstate  \\ \hline
		1& U \quad U&$2\mu_0$ & $-2\mu_0 B$& 1   \\ \hline
	 \multirow{ 2}{*}{1} & U \quad D & 0 & 0 & \multirow{ 2}{*}{2}\\
		 & U \quad D & 0 & 0 &  \\ \hline
		 3&D\quad D&$-2\mu_0$& $+-2\mu_0B$&1\\
		 \hline
	\end{tabular}
\end{table}
\begin{align*}
\intertext{Total no. of microstate $=4$ for $\operatorname{Spin}-\frac{1}{2}$ two particle system no. of accessible microstate corresponding to energy.}
E=0\text{ is }2&
\intertext{The no. of microstate for $\mathrm{N}$ no. of Spin S particle}
(2 S+1)^{N}&
\intertext{The probability of getting a macrostate in which there are r particle out of N Spin $1 / 2$ particle in spin up state}
\mathrm{N}_{\mathrm{C}_{\mathrm{r}}} \times \frac{1}{2^{\mathrm{N}}}
\end{align*}
	\end{answer}
\item We have equal amount of two identical ideal gases at the same temperature $T$ but at different pressure $P_1$ and $P_2$ in two containers of volume $V_1$ and $V_2$ respectively. The containers are connected. Find the change in entropy (The temperature after mixing also ramains same)
\begin{answer}
	\begin{align*}
	S&=Nk_B \ \ell n\left( \frac{V}{N}\right)+\frac{3}{2}Nk_B \left[\frac{5}{3}+\ell n \left(\frac{2\pi mk_BT}{h^2} \right) \right] \\
	\sum\limits_{i=1}^{2}Si&=N_1k_B\ \ell n\frac{V_i}{N}+\frac{3}{2}N_1k_B \left[\frac{5}{3}+\ell n \left(\frac{2\pi mk_BT}{h^2} \right) \right] \\
	&=Nk_B\ \ell n\frac{V_1}{N}+\frac{3}{2}Nk_B \left[\frac{5}{3}+\ell n \left(\frac{2\pi mk_BT}{h^2} \right) \right]+\\
		&=Nk_B\ \ell n\frac{V_2}{N}+\frac{3}{2}Nk_B \left[\frac{5}{3}+\ell n \left(\frac{2\pi mk_BT}{h^2} \right) \right]+\\
		&\left\{\begin{array}{l}P_{1} V_{1}=N k_{B} T \Rightarrow \frac{V_1}{N}=\frac{k_B T}{P_1}\\ P_{2} V_{2}=N k_{B} T \Rightarrow \frac{V_2}{N}=\frac{k_B T}{P_2} \end{array}\right.\\
		\sum\limits_{i=1}^{2}Si&=Nk_B\ \ell n\frac{k_B T}{P_1}+\frac{3}{2}Nk_B \left[\frac{5}{3}+\ell n \left(\frac{2\pi mk_BT}{h^2} \right) \right] +\\
		&=Nk_B\ \ell n\frac{k_B T}{P_2}+\frac{3}{2}Nk_B \left[\frac{5}{3}+\ell n \left(\frac{2\pi mk_BT}{h^2} \right) \right]
		\intertext{\textbf{Total entropy:}}
		S_T&=2Nk_B\ \ell n\frac{V_1+V_2}{2N}+\frac{3}{2}\times 2Nk_B \left[\frac{5}{3}+\ell n \left(\frac{2\pi mk_BT}{h^2} \right) \right]
		\intertext{Change in entropy}
		\Delta S&=S_T-\sum\limits_{i=1}^{2}Si=2Nk_B\ \ell n\frac{V_1+V_2}{2N}-Nk_B \ \ell n\frac{k_B T}{P_1}-NK \ \ell n\frac{k_B T}{P_2}
		\intertext{Let after mixing pressure $=P$ and after mixing total No of particle $=N+N=2 N$}
		\end{align*}
		\begin{align*}
		&\mathrm{P}\left(\mathrm{V}_{1}+\mathrm{V}_{2}\right)=2 \mathrm{Nk}_{\mathrm{B}} \mathrm{T}\hspace{6cm}\mathrm{P}\left(\mathrm{V}_{1}+\mathrm{V}_{2}\right)=2 \mathrm{Nk}_{\mathrm{B}} \mathrm{T}\\
		&\frac{\left(\mathrm{V}_{1}+\mathrm{V}_{2}\right)}{2 \mathrm{~N}}=\frac{\mathrm{k}_{\mathrm{B}} \mathrm{T}}{\mathrm{P}}\hspace{6.5cm}\frac{1}{\mathrm{P}}=\frac{\mathrm{V}_{1}+\mathrm{V}_{2}}{2 \mathrm{Nk}_{\mathrm{B}} \mathrm{T}}=\frac{\mathrm{V}_{1}}{2 \mathrm{Nk}_{\mathrm{B}} \mathrm{T}}+\frac{\mathrm{V}_{2}}{2 \mathrm{Nk}_{\mathrm{B}} \mathrm{T}}\\
		&\Delta \mathrm{S}=2 \mathrm{Nk}_{\mathrm{B}} \ \ell n \frac{\mathrm{k}_{\mathrm{B}} \mathrm{T}}{\mathrm{P}}-\mathrm{Nk}_{\mathrm{B}} \ell \mathrm{n} \frac{\mathrm{k}_{\mathrm{B}} \mathrm{T}}{\mathrm{P}_{1}}-\mathrm{Nk}_{\mathrm{B}}  \ \ell n \frac{\mathrm{k}_{\mathrm{B}} \mathrm{T}}{\mathrm{P}_{2}}\hspace{2cm}\frac{1}{\mathrm{P}}=\frac{1}{2}\left(\frac{1}{\mathrm{P}_{1}}+\frac{1}{\mathrm{P}_{2}}\right)\\
		&=N k_{\mathrm{B}}  \ \ell n \left(\frac{\mathrm{k}_{\mathrm{B}} \mathrm{T}}{\mathrm{P}}\right)^{2}-\mathrm{Nk}_{\mathrm{B}}  \ \ell n \frac{\mathrm{k}_{\mathrm{B}} \mathrm{T}}{\mathrm{P}_{1}}-\mathrm{Nk}_{\mathrm{B}}  \ \ell n \frac{\mathrm{k}_{\mathrm{B}} \mathrm{T}}{\mathrm{P}_{2}}\hspace{2cm}P=\frac{2 P_{1} P_{2}}{P_{1}+P_{2}}\\
		&=N k_{B}  \ \ell n \frac{\left(\frac{k_{B} T}{P}\right)^{2}}{\left(\frac{k_{B} T}{P_{1}}\right)\left(\frac{k_{B} T}{P_{2}}\right)}\\
		&=N k_{B}  \ \ell n \left[\frac{\left(k_{B} T\right)^{2}\left(P_{1}+P_{2}\right)^{2}}{\left(2 P_{1} P_{2}\right)^{2}} \times \frac{P_{1} P_{2}}{\left(k_{B} T\right)^{2}}\right]\\
		\Delta \mathrm{S}&=\mathrm{Nk}_{\mathrm{B}} \ell \mathrm{n} \frac{\left(\mathrm{P}_{1}+\mathrm{P}_{2}\right)^{2}}{4 \mathrm{P}_{1} \mathrm{P}_{2}}\\
		\Delta \mathrm{S}&=\mathrm{Nk}_{\mathrm{B}}  \ \ell n \frac{\left(\mathrm{P}_{1}+\mathrm{P}_{2}\right)^{2}}{4 \mathrm{P}_{1} \mathrm{P}_{2}}\quad\text{ Here we get }\Delta S>0\\
		\intertext{(We are considering identical particle. So it is a reversible case only when the particle density is same otherwise for identical gas also we will get $\Delta S>0$)}
	\end{align*}
\end{answer}
	\item Calculate the number of microstate for a free particle in 3-dimension that have momentum $p$.
	\begin{answer}
		\begin{align*}
		\mathrm{d} \tau&=\mathrm{dx} d y d z d p_{x} d p_{y} d p_{z}\\
	\textbf{	Allowed Phase Space Volume}=&\int \mathrm{d} \tau=\int \mathrm{dxdydz} \int \mathrm{dp}_{\mathrm{x}} \mathrm{dp}_{\mathrm{y}} \mathrm{dp}_{\mathrm{z}}\\
	&=V \int p^{2} d p \int_{0}^{\pi} \sin \theta d q \int_{0}^{2 \pi} d \phi=V \frac{4}{3} \pi p^{3}\\
\text{	No. of microstate }&=\frac{\mathrm{V}}{\mathrm{h}^{3}} \times \frac{4}{3} \pi \mathrm{p}^{3}
\intertext{Note : for 2. dimension.}
\int \mathrm{dx}&=\int \mathrm{dx} \int \mathrm{dy} \int \mathrm{dp}_{\mathrm{x}} \int \mathrm{dp}_{\mathrm{x}}\\
&=\int \mathrm{d}^{2} \mathrm{q} \cdot \mathrm{d}^{2} \mathrm{p} \quad=\mathrm{A} \cdot \pi \mathrm{p}^{2} \quad\{\text{ where }\mathrm{A}= \text{area} \}
\intertext{Since wave polarize in 2 dimension}
\int \mathrm{dr}&=2 \mathrm{~A} \pi \mathrm{p}^{2}
\intertext{If momentum lies between $p$ and $p+d p$}
\therefore\text{ No. of microstate }&=\frac{2 \mathrm{~A}}{\mathrm{~h}^{2}} 2 \pi \mathrm{pdp}=\frac{4 \mathrm{~A} \pi}{\mathrm{h}^{2}} \mathrm{pdp}
\intertext{If momentum lies between $\mathrm{p}$ and $\mathrm{p}+\mathrm{dp}$ then no. of microstate $=\frac{\mathrm{V}}{\mathrm{h}^{3}} 4 \pi \mathrm{p}^{2} \mathrm{dp}$}
\text{Density of state }&=\frac{\text { no. of state }}{\text { Volume }}\text{ or} \frac{\text { no. of state }}{\text { energy int erval }}
		\end{align*}
	\end{answer}
	\item Calculate the number of microstates accessible to the photon having frequency between $\nu$ and $\nu+d\nu$ confined to a 3 dimentional cavity of volume $V$
	 \begin{answer}
	 	\begin{align*}
	 	\intertext{No. of microstate in frequency range 0 to $\nu$}
	 	\Omega&=\frac{V}{h^{3}} \frac{4}{3} \pi(2 m E)^{3 / 2} \hspace{3cm}
	 	E=\frac{P^{2}}{2 m} \Rightarrow P=\sqrt{2 m} E\\
	 	&=\frac{\mathrm{V}}{\mathrm{h}^{3}} \frac{4}{3} \pi\left(\mathrm{P}^{2}\right)^{3 / 2}\hspace{3cm} \mathrm{P}=\frac{\mathrm{E}}{\mathrm{C}}=\frac{\mathrm{h\nu}}{\mathrm{C}}\\
	 	\Omega&=\frac{\mathrm{V}}{\mathrm{h}^{3}} \frac{4}{3} \pi \mathrm{P}^{3}=\frac{\mathrm{V}}{\mathrm{h}^{3}} \frac{4}{3} \pi\left(\frac{\mathrm{h\nu}}{\mathrm{c}}\right)^{3}=\frac{4}{3} \frac{\pi \mathrm{V\nu}^{3}}{\mathrm{c}^{3}}
	 	\intertext{No. of microstates in the frequency range $\nu$ and $v+d \nu$ is}
	 	\mathrm{d} \Omega&=\frac{4}{3}\  \frac{\pi \mathrm{V}}{\mathrm{c}^{3}} 3 \mathrm{\nu}^{2} \mathrm{~d} \mathrm{v}=\frac{4 \pi \mathrm{V}}{\mathrm{c}^{3}} \mathrm{\nu}^{2} \mathrm{~d} \mathrm{\nu}
	 	\intertext{Density of state}
	 	g(E)&=\text{ no. of states per unit energy range}\\
	 \text{	we have }\quad
	 	\Omega&=\frac{V}{h^{3}} \ \frac{4}{3} \ \pi(2 m E)^{3 / 2}\\
	 	\mathrm{d} \Omega&=\frac{\mathrm{V}}{\mathrm{h}^{3}} \ \frac{4}{3}\  \cdot \frac{3}{2} \pi(2 \mathrm{mE})^{1 / 2} 2 \mathrm{~m} \mathrm{dE}\\
	 	&=\frac{V}{h^{3}} \cdot 2 \pi(2 m)^{3 / 2} E^{1 / 2} d E\\
	 	&\left[\mathrm{E}=\frac{\mathrm{P}^{2}}{2 \mathrm{~m}} \Rightarrow 2 \mathrm{~m}\frac{P^2}{E}-\frac{E^2}{c^2 E}=\frac{E}{c^2}\right]\\
	 	&=\frac{V}{h^{3}} 2 \pi \left(\frac{E}{c^2} \right) ^{\frac{3}{2}}E^{\frac{1}{2}}dE\\
	 	&=\frac{V}{h^3}\ \frac{2\pi}{c^3}E^2dE\\
	 	g(E)&=\frac{d\Omega}{dE}=\frac{2\pi VE^2}{h^3 c^3}
	 	\end{align*}
	 \end{answer}
 \section{Canonical Ensemble}
	\item Show that the partition fuction of two independent (non-interacting)
	system $i$ and $j$ is given by
	$$Z_{ij}=Z_i\times Z_j$$
	\begin{answer}
		\begin{align*}
		\intertext{We know that}
		P_{i}&=\frac{e^{-\beta E_{i}}}{Z_{i}}, P_{j}=\frac{e^{-\beta E_{j}}}{Z_{j}}\\
		E&=E_{i}+E_{j}, P_{i j}=\frac{e^{-\beta\left(E_{i}+E_{j}\right)}}{Z_{i j}}\\
		P_{i j}&=\frac{e^{-\beta E}}{Z_{i i}}=\frac{e^{-\beta\left(E_{i}+E_{j}\right)}}{Z_{i i}}=\frac{e^{-\beta E_{i}} \times e^{-\beta E_{j}}}{\dot{Z}_{i i}}\\
		\mathbf{P}_{\mathrm{ij}}&=\mathrm{P}_{\mathrm{i}} \times \mathrm{P}_{\mathrm{j}}\\
		\frac{e^{-\beta E_{i}} \times e^{-\beta E_{j}}}{Z_{i j}}&=\frac{e^{-\beta E_{i}}}{Z_{i}} \times \frac{e^{-\beta E_{j}}}{Z_{i}}\\
		\text{So  }\quad Z_{\mathrm{ij}}&=Z_{\mathrm{i}} \times Z_{\mathrm{j}}\\
	\text{	In general }Z_{i j k} \cdots \cdots&=Z_{i} \times Z_{j} \times Z_{k} \times \cdots \\
	\text{Total partition function }Z&=Z_{\text {Rotational motion }} \times Z_{\text {Translational motion }} \times Z_{\text {Vibrational motion }} \times \ldots \ldots \ldots \ldots \ldots
		\end{align*}
	\end{answer}
	\item A system consist of three independent particles localised in space. Each particle have two states of energy $O$ and $E$. When the system is in thermal equilibrium with a heat bath at temperature $T$. Calculate its partition function?
 	\begin{answer}
 		Method :-1
 		\begin{align*}
 		\mathrm{Q}_{\mathrm{N}}(\mathrm{V}, \mathrm{T})&=\sum_{\mathrm{r}} \mathrm{g}_{\mathrm{r}} \mathrm{e}^{-\beta \mathrm{E}_{\mathrm{r}}}\\
 		Q_1 (V,T)=\sum e^{\beta E_r}=1+e^{\beta E}\colorbox{red}{Not completed}
 		\end{align*}
 	\end{answer}
	\item The partition function for two Bose particle each of which can occupy any of the enetgy level $0$ and $E$
	 \begin{tasks}(2)
		\task[\textbf{a.}]$1+e^{-2 E / K T}+2 e^{-E / K T}$
		\task[\textbf{b.}] $1+e^{-2 E / K T}+e^{-E / K T}$
		\task[\textbf{c.}]$2 \mathrm{e}^{-2 \mathrm{E} / \mathrm{KT}}+\mathrm{e}^{-\mathrm{E} / \mathrm{KT}}$
		\task[\textbf{d.}] $e^{-2 E / K T}+e^{-E / K T}$
	\end{tasks}
	\begin{answer}$\left. \right. $\\
		\renewcommand*{\arraystretch}{2}
		\begin{tabular}{llllll}
			& $\mathbf{0}$ & $\mathbf{E}$ & Total energy & \multicolumn{2}{c}{ degeneracy } \\
			1 & aa & 0 & 0 & 1 & $\left(g_{1}\right)$ \\
			2 & a & a & E & 1 & $\left(g_{2}\right)$ \\
			3 & 0 & a & 2 E & 1 & $\left(g_{3}\right)$
		\end{tabular}
	\begin{align*}
	\mathrm{Q}_{\mathrm{N}}(\mathrm{V}, \mathrm{T})&=\sum_{\mathrm{r}} \mathrm{g}_{\mathrm{r}} \mathrm{e}^{-\beta \mathrm{E}_{\mathrm{r}}}=\mathrm{g}_{1} \mathrm{e}^{-\beta \mathrm{E}_{1}}+\mathrm{g}_{2} \mathrm{e}^{-\beta \mathrm{E}_{2}}+\mathrm{g}_{3} \mathrm{e}^{-\beta \mathrm{E}_{3}}\\
	&=1+\mathrm{e}^{-\beta E}+\mathrm{e}^{-2 \beta E}
	\end{align*}
	Correct answer is option \textbf{(b)}
	\end{answer}
	\item The partition function of single gas molecule is $Z\alpha$. The partition fuction of $N$ such non-interacting gas molecule is given by
	 \begin{tasks}(2)
		\task[\textbf{a.}]$\frac{(Z \alpha)^{N}}{N !}$
		\task[\textbf{b.}]$(Z \alpha)^{N}$
		\task[\textbf{c.}] $\mathrm{NZ} \alpha$
		\task[\textbf{d.}] $(Z \alpha)^{N} / N$
	\end{tasks}
	\begin{answer}
		\begin{align*}
		\text{For indistinguishable particle }&\frac{(Z \alpha)^{N}}{N !}\\
		\text{for distinguishable particle }&(Z \alpha)^{N}
		\end{align*}
	\end{answer}
	\item A system has energy level $E_0,2E_0,3E_0....$ where the excited state are triply degenerate. Four non-interacting Bosons are placed in this system. If the total energy of these Bosons is $5E_0$. The number of microstate is
	 \begin{tasks}(2)
		\task[\textbf{a.}]2
		\task[\textbf{b.}]3
		\task[\textbf{c.}]4
		\task[\textbf{d.}]5
	\end{tasks}
	\begin{answer}
		\begin{align*}
		\text{Total energy }&=5 \mathrm{E}_{0}
		\intertext{For this 3 bosons must be in $E_0$ state and $1$ in $2E_0$ state.}
		\end{align*}
		\begin{figure}[H]
			\centering
			\includegraphics[height=4cm,width=4cm]{SM-problem-01}
		\end{figure}
		Correct answer is option \textbf{(b)}
	\end{answer}
	\item An ensemble of quantum harmonic oscillator is kept at a finite temperature $T$
	$$\mathrm{T}=\frac{1}{\mathrm{k}_{\mathrm{B}} \beta} \quad
 k_B	\text{-Boltzmann constant}$$
 The partition function of a single oscillator with energy $\left( n+1/2\right) \hbar\omega$ is given by
  \begin{tasks}(2)
 	\task[\textbf{a.}] $Z=\frac{e^{-\beta \hbar \omega / 2}}{1-e^{-\beta \hbar \omega}}$
 	\task[\textbf{b.}]$Z=\frac{e^{-\beta \hbar \omega / 2}}{1+e^{-\beta \hbar \omega}}$
 	\task[\textbf{c.}]$Z=\frac{1}{1-e^{-\beta \hbar \omega}}$
 	\task[\textbf{d.}] $Z=\frac{1}{1+e^{-\beta \hbar \omega}}$
 \end{tasks}
	\begin{answer}
		\begin{align*}
		\text{(i) }Q_{N}\left(V_{1} T\right)&=\sum_{r} e^{-\beta E}=\sum_{n} e^{-\beta(n+1 / 2) \hbar w}\\
		&=e^{-\beta \hbar \omega / 2}+e^{-3 / 2 \beta \hbar \omega}+e^{-5 / 2^{\beta \hbar \omega}}+\ldots \ldots\\
		&=\mathrm{e}^{-\beta \hbar \omega / 2}\left(1+\mathrm{e}^{-\beta \hbar \omega}+\mathrm{e}^{-\beta \hbar \omega}+\ldots \ldots\right.\\
		&=\mathrm{e}^{-\beta \hbar \omega / 2}\left(\frac{1}{1-\mathrm{e}^{-\beta \hbar \omega}}\right)\text{ use G.P, formula}\hspace{0.5cm}\left\{\begin{array}{lll}R=1+r+\pi^{2} \ldots \ldots \ldots \ldots \ldots \infty & \text { G.P. } \\ \sum_{0}^{\infty} R=\frac{1}{1-r} & r<1 &  \end{array}\right\}
		\end{align*}
	\end{answer}
	\item The average number of energy quanta of the oscillator is given by
	 \begin{tasks}(2)
		\task[\textbf{a.}] $\langle\mathrm{n}\rangle=\frac{1}{\mathrm{e}^{\beta \hbar \omega}-1}$
		\task[\textbf{b.}]$\langle\mathrm{n}\rangle=\frac{\mathrm{e}^{-\beta \hbar \omega}}{\mathrm{e}^{\beta \hbar \omega}-1}$
		\task[\textbf{c.}]$\langle\mathrm{n}\rangle=\frac{1}{\mathrm{e}^{\beta \hbar \omega}+1}$
		\task[\textbf{d.}] $\langle n\rangle=\frac{e^{-\beta \hbar \omega}}{e^{\beta \hbar \omega}+1}$
	\end{tasks}
	\begin{answer}
		\begin{align*}
		\intertext{(i) The average energy of a quantum oscillator is given by}
		\mathrm{U}&=\mathrm{N}\left[1 / 2 \hbar \omega+\frac{\hbar \omega}{\mathrm{e}^{\beta \hbar \omega-1}}\right]
		\intertext{If we neglect the zero point energy the average energy bocome}
	\mathrm{U}&=\frac{\mathrm{N} \hbar \omega}{\mathrm{e}^{\beta \hbar \omega}-1}\\
	\text{Avarege number of energy quanta}&=\frac{U}{N\hbar \omega}\\\colorbox{red}{Not completed}
		\end{align*}
	\end{answer}
	\item In a particular salt among $n$ atoms each atom has a spin $1/2$ and is associated with a magnetic dipolemoment $\mu_B$. The distance between the magnetic atoms is large enough to make the interaction between them negligible. In otherwords our system is an idealised spin system. The salt is placed in an external magnetic field $B$. Find the partition function of the individual atom and that for the salt
	\begin{answer}
		\begin{align*}
		\mathrm{Q}_{1}(\mathrm{~V}, \mathrm{~T})&=\sum_{\mathrm{r}} \mathrm{e}^{-\beta \mathrm{E}_{\mathrm{r}}}\qquad E=\mu_B\ B =\text{for} S=-\frac{1}{2}\qquad \left\lbrace\text{ where }\mu_B=\text{ Bohr magneton }\right\rbrace \\
		&=e^{-\beta\mu_B\ B}+e^{\beta\mu_B\ B}
		\intertext{Since the salt consist of $N$ number of particles}
		Q_N(V,T)&=[Q_1(V,T)]^N=[e^{-\beta\mu_B\ B}+e^{\beta\mu_B\ B}]^N \rightarrow \text{distinguishable}\\
		\colorbox{red}{Not completed}
		\end{align*}
	\end{answer}
	\item Consider a system of two identical particles which may occupy any of the three levels. The lowest energy state $\varepsilon_0=0$ is double degenerates. The system is in thermal equilibrium at temperature T. Determine the partition function and everage energy of the system if particles obey
	(i) M-B statistics\\
	(ii) B-E statistics\\
	(iii) F-D statistics.
	\begin{answer}
		\begin{align*}
		\text{(i) For $M-B$ }&\text{statistics, $g_{i}=16$}\\
		\mathrm{Q}_{\mathrm{N}}(\mathrm{V}, \mathrm{T})&=\Sigma g_{r} e^{-\beta E_{r}}=4+4 e^{-\beta \epsilon}+5 e^{-2 \beta \epsilon}+2 e^{-3 \beta \epsilon}+e^{-4 \beta \epsilon}\\
		\langle\mathrm{E}\rangle&=-\frac{\partial}{\partial \beta} \ln \mathrm{Q}_{\mathrm{N}}(\mathrm{V}, \mathrm{T})=\frac{\in\left[4 e^{-\beta \epsilon}+10 e^{-2 \beta \epsilon}+6 e^{-3 \beta \epsilon}+4 e^{-4 \beta \epsilon}\right]}{Q_{N}(V, T)}\\
		\langle E\rangle&=\frac{\in\left[2 e^{-\beta \epsilon}+6 e^{-2 \beta \epsilon}+3 e^{-3 \beta \epsilon}+4 e^{-4 \beta \epsilon}\right]}{Q_{N}(V, T)}
		\intertext{(iii) For F-D statistics:}
		Q_{N}(V, T)&=1+2 e^{-\beta \epsilon}+2 e^{-\beta \epsilon}+e^{-3 \beta \epsilon}\\
		\langle E\rangle&=\frac{\in\left(2 e^{-\beta \epsilon}+4 e^{-2 \beta \epsilon}+3 e^{-3 \beta \epsilon}\right)}{Q_{N}(V, T)}
		\end{align*}
	\end{answer}
\end{enumerate}
\section{Thermodynamics of Ensemble}
\begin{enumerate}
	\item Consider a system of an extreme relativistic gas consisting of $3 \mathrm{~N}$ particles moving in 1 dimension, Show that the partition function in this case is given by $\frac{1}{3 \mathrm{~N} !}\left[2 \mathrm{~L}\left(\frac{\mathrm{k}_{\mathrm{B}} \mathrm{T}}{\mathrm{hc}}\right)\right]^{3 \mathrm{~N}} . \mathbf{L}$ being the length of the space available. Study the thermodynamics and check that weather $\mathrm{PV}=\frac{1}{3} \mathrm{U} \cdot \frac{\mathrm{U}}{\mathrm{N}}=3 \mathrm{k}_{\mathrm{B}} \mathrm{T}, \gamma=\frac{4}{3}$ or not.
	\begin{answer}
		\begin{align*}
		\mathrm{Q}_{\mathrm{N}}(\mathrm{V}, \mathrm{T})&=\left[\mathrm{Q}_{1}(\mathrm{~V}, \mathrm{~T})\right]^{\mathrm{N}}=\frac{1}{\mathrm{~N} !}\left[\frac{1}{\mathrm{~h}^{3}} \int \mathrm{e}^{-\beta \mathrm{H}} \mathrm{d} \omega\right]^{\mathrm{N}}\\
		&=\frac{1}{N ! h^{3 N}} \int e^{-\beta P c} d^{3 N} p d^{3 N} q\\
		\text{For extreme relativistic case }\mathrm{H}&=\mathrm{pc}\text{ and } \mathrm{d} \omega=\mathrm{d}^{3 \mathrm{~N}} \mathrm{p} \mathrm{d}^{3 \mathrm{~N}} \mathrm{q}\\
		\mathrm{Q}_{\mathrm{N}}(\mathrm{V}, \mathrm{T})&=\frac{\mathrm{V}^{\mathrm{N}}}{\mathrm{N} ! \mathrm{h}^{3 \mathrm{~N}}}\left[\int \mathrm{e}^{\frac{-\mathrm{pc}}{\mathrm{kT}}} \mathrm{d}^{3 \mathrm{~N}} \mathrm{p}\right]^{\mathrm{N}}\left(\int d^{3 \mathrm{~N}} \mathrm{q}=\int \mathrm{d}^{3} \mathrm{q}_{1} \mathrm{~d}^{3} \mathrm{q}_{\mathrm{2}} .....\mathrm{d}^{3} \mathrm{q}_{N}\right)\\
		&=\frac{\mathrm{V}^{\mathrm{N}}}{\mathrm{N} ! \mathrm{h}^{3 \mathrm{~N}}}\left[\int\limits_{0}^{\infty} \mathrm{e}^{\frac{-\mathrm{pc}}{\mathrm{kT}}}{ 4\pi p }^2\ pd \right]^N\\
		&=\frac{(4 \pi V)^{N}}{N ! h^{3 N}}\left[\int\limits_{0}^{\infty} \mathrm{e}^{\frac{-\mathrm{pc}}{\mathrm{kT}}}{  p }^2\ pd \right]^N\\
		\text{Let }\frac{\mathrm{pc}}{\mathrm{k}_{\mathrm{B}} \mathrm{T}}&=\mathrm{x} \Rightarrow \frac{c}{k_B T} dp=dx\\
		&\frac{(4 \pi \mathrm{V})^{\mathrm{N}}}{\mathrm{N} ! \mathrm{h}^{3 \mathrm{~N}}}\left[\int_{0}^{\infty} \mathrm{e}^{-\mathrm{x}}\left(\frac{k_B Tx}{c}\right)\ \frac{k_B T}{c}dx    \right]=\frac{(4\pi V)}{N!h^{3N}}\left[ \left(\frac{k_B T}{c} \right) \int e^{-x}x^2\ dx\right] ^N\\
		&\frac{(4 \pi \mathrm{V})^{\mathrm{N}}}{\mathrm{N} ! \mathrm{h}^{3 \mathrm{~N}}}\left[ \left( \frac{k_B T}{c}\right)^3 2!\right] ^N\\
		\mathrm{Q}_{\mathrm{N}}(\mathrm{V}, \mathrm{T})&=\frac{1}{\mathrm{~N} !}\left[8 \pi \mathrm{V}\left(\frac{\mathrm{k}_{\mathrm{B}} \mathrm{T}}{\mathrm{hc}}\right)^{3}\right]^{\mathrm{N}}\\
		\ell n \ \mathrm{Q}_{\mathrm{N}}(\mathrm{V}, \mathrm{T})&=\mathrm{N} \ell n 8 \pi \mathrm{V}\left(\frac{\mathrm{k}_{\mathrm{B}} \mathrm{T}}{\mathrm{hc}}\right)^{3}-\log N !=N \ell n 8 \pi V\left(\frac{k_{B} T}{h c}\right)^{3}-N \ell n N+N\\
		&=\mathrm{N} \ell \mathrm{n} \frac{8 \pi \mathrm{V}}{\mathrm{N}}\left(\frac{\mathrm{k}_{\mathrm{B}} \mathrm{T}}{\mathrm{hc}}\right)^{3}+\mathrm{N}\\
		A&=-k_{B} T \ell n Q_{N}(V, T)=-N k_{B} T \ell n \frac{8 \pi V}{N}\left(\frac{k_{B} T}{h c}\right)^{3}-N k_{B} T\\
		P&=-\left(\frac{\partial A}{\partial V}\right)=N k_{B} T \frac{\frac{8 \pi}{N}\left(\frac{k_{B} T}{h c}\right)^{3}}{\frac{8 \pi V}{N}\left(\frac{k_{B} T}{h c}\right)^{3}}=\frac{N k_{B} T}{V}\\
		\Rightarrow \quad U&=-T^{2} \frac{\partial}{\partial T}\left(\frac{A}{T}\right)\\
	\text{	Now, }U&=T^{2} \frac{\partial}{\partial T}\left[N k_{B} \ln \frac{8 \pi V}{N}\left(\frac{k_{B} T}{h c}\right)^{3}+N k_{B}\right]\\
	&=\mathrm{T}^{2} \mathrm{Nk} \times \frac{\frac{8 \pi \mathrm{V}}{\mathrm{N}}\left(\frac{\mathrm{k}_{\mathrm{B}}}{\mathrm{hc}}\right)^{3}, 3 \mathrm{~T}^{2}}{\frac{8 \pi \mathrm{V}}{\mathrm{N}}\left(\frac{\mathrm{k}_{\mathrm{B}} \mathrm{T}}{\mathrm{hc}}\right)^{3}}=\frac{3 \mathrm{k}_{\mathrm{B}} \mathrm{NT}^{4}}{\mathrm{~T}^{3}}=3 \mathrm{Nk}_{\mathrm{B}} \mathrm{T}\\
	\mathrm{U}&=3 \mathrm{Nk}_{\mathrm{B}} \mathrm{T}\\
\text{	Now, }\quad \mathrm{P}&=\left(\frac{\partial \mathrm{A}}{\partial \mathrm{V}}\right)_{\mathrm{T}, \mathrm{M}}=\mathrm{PV}=\frac{Nk_B T}{V}\times V=N k_B T\\
\text{and }\frac{1}{3} U&=\frac{3 U k_{B} T}{3}=N k_{B} T\\
\text{So we get }\mathrm{PV}&=\frac{1}{3} \mathrm{U} \quad \text{or}\quad P=\frac{1}{3}\ \frac{U}{V}\\
\text{Now }\mathrm{dQ}&=\mathrm{dU}+\mathrm{PdV}\\
\text{For adiabic process }&\mathrm{dQ}=0\\
\mathrm{dU}+\mathrm{PdV}&=0 \Rightarrow \mathrm{d}(3PV)+PdV=0\\
3 \mathrm{PdV}&+3 \mathrm{VdP}+\mathrm{PdV}=0 \quad \text{or} \quad 4PdV=3VdP\\
\frac{\mathrm{dP}}{\mathrm{P}}&=-\frac{4}{3} \frac{\mathrm{dV}}{\mathrm{V}}\\
\text{Integrating }\ell nP&=-\frac{4}{3} \ell n V+c-\ell n V^{4 / 3}+c\\
\ell n\mathrm{P}+\ell n \mathrm{V}^{4 / 3}&=\text{ constant,}\quad \mathrm{PV}^{4 / 3}= \text{ constant}\\
\text{For this we know }\gamma&=\frac{4}{3}
		\end{align*}
		\begin{align*}
		\text{(2) }\mathrm{Q}_{\mathrm{N}}(\mathrm{V}, \mathrm{T})&=\left[\mathrm{Q}_{1}(\mathrm{~V}, \mathrm{~T})\right]^{3 \mathrm{~N}}=\frac{1}{3 \mathrm{~N} !}\left[\frac{1}{\mathrm{~h}} \int_{\infty}^{\infty} \mathrm{e}^{-\beta \mathrm{Pc}} \mathrm{dp} \mathrm{dq}\right]^{3 \mathrm{~N}}\\
		&=\frac{1}{3 N ! h^{3 N}} L^{3 N}\left|\int^{\infty} e^{-\frac{P_{c}}{k T}} d p\right|^{3 N} \quad\{L \rightarrow\text{ Length }\}\\
		\text{Let }\frac{\mathrm{pc}}{\mathrm{k}_{\mathrm{B}} \mathrm{T}}&=\mathrm{x} \Rightarrow \mathrm{dp}=\frac{\mathrm{k}_{\mathrm{B}} \mathrm{T}}{\mathrm{c}} \mathrm{dx}\\
		 \mathrm{Q}_{\mathrm{N}}(\mathrm{V}, \mathrm{T}) &=\frac{1}{3 \mathrm{~N} ! \mathrm{h}^{3 \mathrm{~N}}} \mathrm{~L}^{3 \mathrm{~N}}\left[2 \int_{0}^{\infty} \mathrm{e}^{-\mathrm{x}} \frac{\mathrm{k}_{\mathrm{B}} \mathrm{T}}{\mathrm{c}} \mathrm{dx}\right]^{3 \mathrm{~N}} \\
		  &=\frac{1}{3 \mathrm{~N} ! \mathrm{h}^{3 \mathrm{~N}}} \mathrm{~L}^{3 \mathrm{~N}}\left(\frac{\mathrm{k}_{\mathrm{B}} \mathrm{T}}{\mathrm{c}}\right)^{3 \mathrm{~N}}\left[2 \int_{0}^{\infty} \mathrm{e}^{-\mathrm{x}} \mathrm{dx}\right]^{3 \mathrm{~N}} \\
		  &=\frac{1}{3 \mathrm{~N} ! \mathrm{h}^{3 \mathrm{~N}}} \mathrm{~L}^{3 \mathrm{~N}}\left(\frac{\mathrm{k}_{\mathrm{B}} \mathrm{T}}{\mathrm{c}}\right)^{3 \mathrm{~N}}\left[\left[-2 \mathrm{e}^{-\mathrm{x}}\right]_{0}^{\infty}\right]^{3 \mathrm{~N}}\\
		  &=\frac{1}{3 N ! h^{3 N}} \mathrm{~L}^{3 N}\left(\frac{\mathrm{k}_{B} T}{c}\right)^{3 N}2^{3 N}\\
		  \mathrm{Q}_{\mathrm{N}}(\mathrm{V}, \mathrm{T})&=\frac{1}{3N!}\left[ 2L \left( \frac{k_B T}{hc}\right) \right] ^{3N}
		\end{align*}
	\end{answer}
\end{enumerate}
\section{Grand canonical emsemble}
\begin{enumerate}
	\item Consider a system may be either unoccupied or occoupied by one particle with energy $0$ and $E$. Find out \\
	1) partition function of the system \\
	2) Thermal average energy of the system. Thermal average occupancy of the system
	\begin{answer}
		\begin{align*}
			\begin{array}{llll}\mathbf{0} & \mathbf{E} & \mathbf{N_{r}} &E_s\\ 0 & 0 & 0 &0\\ 1 & 0 & 1 &0\\ 0 & 1 & 1&E\end{array}\\
			\mathrm{Z}(\mu, \mathrm{V}, \mathrm{T})&=\sum_{\mathrm{rs}}e^{-\alpha N_1-\beta E_s}\\
			&=e^{-\alpha\times0-\beta\times0}+e^{-\alpha\times1-\beta\times0}+e^{-\alpha\times1-\beta\times1}\\
			1+\mathrm{e}^{-\alpha}+\mathrm{e}^{-\alpha-\beta \epsilon}=&=1+e^{+\frac{\mu}{k_{B} T}}+e^{\left(\frac{\mu}{k_{B} T}-\frac{E}{k_{B} T}\right)}\\
			U&=\left\langle E_{S}\right\rangle=\frac{\sum_{r s} \in_{S} e^{-\alpha N_{r}-\beta E_{S}}}{\sum_{r s} e^{-\alpha N_{r}-\beta E_{S}}}=\sum_{r s} E_{S} P_{r s}\\
			\bar{N}&=\left\langle N_{r}\right\rangle=\frac{\sum_{r s} N_{r} e^{-\alpha N_{r}-\beta E S}}{\sum_{r s} e^{-\alpha N_{r}-\beta E_{S}}}=\sum_{r s} N_{r} P_{r S}\\
			\overline{\mathrm{N}}&=-\frac{\partial}{\partial N} \ln \mathrm{Z}(\mu, \mathrm{V}, \mathrm{T})_{\beta, \mathrm{V}}=\mathrm{e}^{-\alpha}-\mathrm{e}^{-\alpha-\beta \epsilon} / 1+\mathrm{e}^{-\alpha}+\mathrm{e}^{-\alpha-\beta \epsilon}\\
			\mathrm{E}&=-\frac{\partial}{\partial \beta} \ln \mathrm{Z}(\mu, \mathrm{V}, \mathrm{T})_{\alpha, \mathrm{N}}=\frac{\epsilon \mathrm{e}^{(\mu-\epsilon) \beta}}{1+\mathrm{e}^{\mu \beta}+\mathrm{e}^{(\mu-\epsilon) \beta}}
		\end{align*}
	\end{answer}
 \item Repeat the above problem if each state may be occupied by one particle of the same time
 \begin{answer}
 	\begin{align*}
 	\begin{array}{llll} & \mathbf{E} & \mathbf{N}_{\mathrm{r}} & \mathbf{E}_{\mathrm{s}} \\ 0 & 0 & 0 & 0 \\ 1 & 0 & 1 & 0 \\ 0 & 1 & 1 & \mathrm{E} \\ 0 & 1 & 2 & \mathrm{E}\end{array}\\
 	\mathrm{Z}_{\mathrm{N}}(\mu, \mathrm{V}, \mathrm{T})&=1+\mathrm{e}^{-\alpha}+\mathrm{e}^{-\alpha-\beta \epsilon}+\mathrm{e}^{-2 \alpha-\beta \epsilon}
 	\end{align*}
 \end{answer}
	\item In a system in thermal equilibrium at absolute temperature T, two states with energy difference $4.83 \times 10^{-21} \mathrm{~J}$ occour with relative probability $\mathrm{e}^{2}$. Deduce the temperature $\left(\mathrm{k}_{\mathrm{B}}=1.38 \times 10^{-23} \mathrm{~J} / \mathrm{K}\right)$
	\begin{answer}
		\begin{align*}
		\Delta \mathrm{E}&=4.83 \times 10^{-23}\\
		\frac{\mathrm{P}_{1}}{\mathrm{P}_{2}}&=\mathrm{e}^{2}\\
		\mathrm{P}_{\mathrm{i}}&=\mathrm{Ce}^{-\beta \mathrm{E}_{\mathrm{i}}}\\
		\mathrm{P}_{1}&=\mathrm{Ce}^{-\beta \mathrm{E}_{1}}\qquad \mathrm{P}_{2}=\mathrm{Ce}^{-\beta \mathrm{E}_{2}}\\
		\frac{\mathrm{P}_{1}}{\mathrm{P}_{2}}&=\frac{\mathrm{Ce}^{-\beta \mathrm{E}_{1}}}{\mathrm{Ce}^{-\beta \mathrm{E}_{2}}}=\mathrm{e}^{-\beta\left(\mathrm{E}_{1}-\mathrm{E}_{2}\right)}=e^{-\beta (E_2-E_1)}\\
		e^{2}&=e^{\left(E_{2}-E_{1}\right)}\\
		2&=\beta\left(\mathrm{E}_{2}-\mathrm{E}_{1}\right)\\
		2&=\frac{1}{\mathrm{k}_{\mathrm{B}} \mathrm{T}}\left(\mathrm{E}_{2}-\mathrm{E}_{1}\right)\\
		2 \mathrm{k}_{\mathrm{B}} \mathrm{T}&=\mathrm{E}_{2}-\mathrm{E}_{1}\Rightarrow T=\frac{E_2-E_1}{2k_B}\\
		&=\frac{4.83 \times 10^{-23J}}{2 \times 1.38 \times 10^{-23}J/K}=1.75 K
		\end{align*}
	\end{answer}
	\item A diatomic gas in thermal equilibrium have temperature $500K$. Its rotational constant $2.0 cm^{-1}$. Calculate the relative populations in the rotational states.
	\begin{answer}
		\begin{align*}
		\text{Population}\quad E&=\frac{h^2}{8\pi^2 I}J(J+I)\qquad B=\frac{h}{8\pi^2IC}\\
		\color{red}{???}\\
		\mathrm{N}_{\mathrm{J}}&=\frac{\mathrm{N}(2 \mathrm{~J}+1) \mathrm{e}^{-\beta \mathrm{E}_{\mathrm{J}}}}{\sum_{\mathrm{J}} \mathrm{e}^{-\beta \mathrm{E}_{\mathrm{J}}}}\\
	\text{	But }
		\mathrm{BhC}&=3.96 \times 10^{-16} \mathrm{erg}\\
		\frac{\mathrm{N}_{10}}{\mathrm{~N}_{0}}&=91.28 \text{Ans.}\\
		\frac{\mathrm{N}_{20}}{\mathrm{~N}_{0}}&=3.371\text{ Ans}
		\end{align*}
	\end{answer}

\end{enumerate}


% !Mode:: "TeX:UTF-8"
% !TEX program  = xelatex
\title{Assignment 7}

\section{Question 1}
\begin{statebox}{Timescale Invariance}{question-1}
    \begin{align*}
        d_1 &= \frac{\log(S/E)+(r+\sigma^2/2)(T-t)}{\sigma\sqrt{T-t}} \\
        d_1 &= \frac{\log(S/E)+(r-\sigma^2/2)(T-t)}{\sigma\sqrt{T-t}}
    \end{align*}
    Prove the following identity:
    \[
    	d_2 = d_1 - \sigma\sqrt{T-t}
    \]
\end{statebox}

\Python{}{code/7-a.py}

\section{Question 2}
\begin{statebox}{Put-Call Parity}{question-2}
    With $t=0$, $S_0=5$, $E=4$, $T=1$, $\sigma=0.3$ and $r=0.05$, find the option values and verify the put-call parity.
\end{statebox}

\Python{}{code/7-b.py}

\section{Question 3}
\begin{statebox}{Study Note}{question-3}
    \begin{enumerate}
    	\item Write a study note of Black-Scholes' 73 paper.
    	\item Find a sequence of works following this paper and sort out hot topics nowadays.
    \end{enumerate}
\end{statebox}

To be continued.


\subsection{Norms}\label{subsec:norms}

\begin{remark}\label{rem:normed_fields}
  Norms generalize distances of points in a plane, while absolute values generalize the absolute value over either \( \BbbR \) or \( \BbbC \). The axioms themselves differ minimally. Absolute values in a field are multiplicative norms over the field, however we cannot define absolute values in terms of norms since absolute values are needed for defining norms. Still, we will refer to fields with absolute values as \term{normed fields}.
\end{remark}

\begin{definition}\label{def:absolute_value}\mcite{nLab:absolute_value}
  Let \( R \) be a \hyperref[def:semiring]{semiring}. We say that the function \( \abs{\cdot}: V \to \BbbR_{>0} \) is an \term{absolute value} or a \term{semiring norm} if
  \begin{thmenum}
    \thmitem[def:absolute_value/RN1]{RN1}(identity) \( x = 0_R \) if and only if \( \abs{x} = 0 \)
    \thmitem[def:absolute_value/RN2]{RN2}(multiplicativity) For any \( x, y \in V \),
    \begin{equation*}
      \abs{xy} = \abs{x} \cdot \abs{y}
    \end{equation*}

    \thmitem[def:absolute_value/RN3]{RN3}(subadditivity) For any \( x, y \in V \),
    \begin{equation*}
      \abs{x + y} \leq \abs{x} + \abs{y}
    \end{equation*}
  \end{thmenum}
\end{definition}

\begin{definition}\label{def:norm}
  Let \( M \) be an \( R \)-module with absolute value \( \abs{\cdot} \). We say that the function \( \norm{\cdot}: M \to \BbbR_{\geq 0} \) is a \term{norm} if
  \begin{thmenum}
    \thmitem[def:norm/N1]{N1}(identity) \( x = 0_M \) if and only if \( \norm x = 0_{\BbbR} \)

    \thmitem[def:norm/N2]{N2}(absolute homogeneity)
    \begin{equation*}
      \norm{t x} = \abs{t} \norm{x} \text{ for all } t \in R \text{ and } x \in M
    \end{equation*}

    \thmitem[def:norm/N3]{N3}(subadditivity)
    \begin{equation*}
      \norm{x + y} \leq \norm{x} + \norm{y} \text{ for all } x, y \in M
    \end{equation*}
  \end{thmenum}

  If we remove \fullref{def:norm/N1}, then \( \norm{\cdot} \) is called a \term{seminorm}.

  If instead \( V \) is an \hyperref[def:algebra_over_ring]{associative} and \( \norm{\cdot} \) satisfies the additional axiom
  \begin{thmenum}
    \thmitem{def:norm/multiplicativity}(multiplicativity)
    \begin{equation*}
      \norm{xy} = \norm{x} \cdot \norm{y} \text{ for all } x, y \in M,
    \end{equation*}
  \end{thmenum}
  we say that it is a \term{multiplicative norm}.
\end{definition}

\begin{definition}\label{def:norm_induced_metric}
  A norm \( \norm \cdot \) on a real or complex vector space \( V \) induces the \hyperref[def:vector_space]{metric}
  \begin{balign*}
     & \rho: V \times V \to \BbbR_{\geq 0}  \\
     & \rho(x, y) \coloneqq \norm{x - y}.
  \end{balign*}
\end{definition}
\begin{proof}
  The function is positive definite since \( \norm \cdot \) is positive definite; we will show that the function is a metric.

  \SubProofOf{def:metric_space/M1} Follows from \fullref{def:norm/N1}.

  \SubProofOf{def:metric_space/M2} By \fullref{def:norm/N2},
  \begin{equation*}
    \rho(x, y) = \norm{ x - y } = \norm{ (-1) (y - x) } = \abs{-1} \norm{y - x} = \rho(y, x).
  \end{equation*}

  \SubProofOf{def:metric_space/M3}
  \begin{equation*}
    \rho(x, y) + \rho(y, z) = \norm{x - y} + \norm{y - z} \geq \norm{x - z} = \rho(x, z).
  \end{equation*}
\end{proof}

\begin{definition}\label{def:duality_mapping}\mcite[exmpl. 2.26]{Phelps1993}
  We define the \term{duality mapping}
  \begin{balign*}
     & D: E \multto X^*,                                                                                \\
     & D(x) \coloneqq \{ x^* \in X^* \colon \norm x = \norm {x^*} \text{ and } \inprod{x^*} x = \norm {x^*} \norm x \}.
  \end{balign*}

  We will usually use this mapping for unit vectors, so we may as well consider its restriction to the unit spheres, where
  \begin{balign*}
     & D': S_X \multto S_{X^*},                                       \\
     & D'(x) \coloneqq \{ x^* \in S_{X^*} \colon \inprod{x^*} x = 1 \}.
  \end{balign*}
\end{definition}

\begin{definition}\label{def:smooth_norm}\mcite[def. 2.36]{Phelps1993}
  The norm \( \norm \cdot \) on \( X \) is called \term{smooth} if any of  if for each \( x \in S_X \) the duality mapping is single-valued.
\end{definition}

\begin{definition}\label{def:rotund_norm}\mcite[def. 2.36]{Phelps1993}
  The norm \( \norm \cdot \) on \( X \) is called \term{rotund} or \term{strictly convex} if any of the following equivalent conditions hold:
  \begin{thmenum}
    \thmitem{def:rotund_norm/no_sphere_segments} There are no line segments in the unit sphere \( S_X \).
    \thmitem{def:rotund_norm/least_norm} Every convex subset of \( X \) has at most one point of least norm.
    \thmitem{def:rotund_norm/linearly_dependent}
    \begin{balign}\label{def:rotund_norm/linearly_dependent/equation}
      \norm{x + y} = \norm x + \norm y \implies x \text{ and } y \text{ are linearly dependent}.
    \end{balign}
  \end{thmenum}
\end{definition}
\begin{proof}
  \ImplicationSubProof{def:rotund_norm/no_sphere_segments}{def:rotund_norm/least_norm} Let the norm in \( E \) be rotund and let \( C \subseteq E \) be a (potentially empty) convex set. We will prove that \( C \) contains at most one point of least norm.

  If \( C \) is empty or otherwise contains no element of least norm, trivially contains at most one point of least norm.

  Now let \( C \) contain at least one element \( x \in C \) of least norm. Assume that \( y \in C \) is another element of least norm. Necessarily \( \norm x = \norm y \).

  Fix \( t \in (0, 1) \) and define \( z \coloneqq tx + (1-t)y \). Since \( C \) is convex, it contains \( z \). Since \( x \) and \( y \) are elements of least norm, we have \( \norm z \geq \norm x \). By the triangle inequality,
  \begin{balign*}
    \norm{z}
    =
    \norm{tx + (1-t)y}
    \leq
    t \norm x + (1-t) \norm y
    =
    \norm{x},
  \end{balign*}
  thus \( \norm z = \norm x \).

  This implies that the entire segment \( [x, y] \) are elements of least norm in \( C \). Hence, the segment \( [x, y] \) is contained in the sphere \( \norm x S_E \), which contradicts the rotundity of the norm \( \norm{\cdot} \).

  Hence, \( C \) contains at most one element of least norm.

  \ImplicationSubProof{def:rotund_norm/least_norm}{def:rotund_norm/no_sphere_segments} Let every convex set \( C \subseteq E \) have at most one element of least norm.

  Assume that the norm \( \norm{\cdot} \) is not rotund. Then the unit sphere \( S_E \) contains a line segment \( [x, y], x \neq y \). The set \( [x, y] \) is compact and, by the Weierstrass extreme value theorem, the norm attains its minimum on the segment in a point \( z \in [x, y] \). Since the segment is also convex and we assumed that convex sets have at most one element of least norm, it follows that this element \( z \) is unique.

  Then for any point \( s \in [x, y], s \neq z \), we have \( \norm s > \norm z = 1 \), thus \( s \) cannot be an element of the unit sphere. The obtained contradiction shows that the norm \( \norm{\cdot} \) is rotund.

  \ImplicationSubProof{def:rotund_norm/no_sphere_segments}{def:rotund_norm/linearly_dependent} Let \( E \) be rotund let \( x, y \in E \) be distinct vectors such that
  \begin{balign}\label{def:rotund_norm/linearly_dependent/assumption}
    \norm{x + y} = \norm x + \norm y.
  \end{balign}

  If either of them is the zero vector, then they are trivially linearly dependent.

  Assume that both \( x \) and \( y \) are nonzero and define
  \begin{balign*}
    \xi \coloneqq \frac x {\norm x}
     &  &
    \eta \coloneqq \frac y {\norm y}
     &  &
    t \coloneqq \frac {\norm x} {\norm{x + y}}
  \end{balign*}

  \Fullref{def:rotund_norm/linearly_dependent/assumption} implies that
  \begin{equation*}
    1 - t = 1 - \frac {\norm x} {\norm{x + y}} = \frac {\norm{x + y} - \norm x} {\norm{x + y}} = \frac {\norm y} {\norm{x+y}}.
  \end{equation*}

  Since both \( \xi \) and \( \eta \) are in \( S_E \), by rotundity, their convex combination
  \begin{equation*}
    \nu \coloneqq t \xi + (1-t)\eta
  \end{equation*}
  should not be contained in \( S_E \) unless \( \xi = \eta \).

  Calculating the norm, we obtain
  \begin{balign*}
    \norm{\nu}
     & =
    \norm{t \xi + (1-t)\eta}
    =    \\ &=
    \norm{\frac {\norm x \xi} {\norm{x + y}} + \frac {\norm y \eta} {\norm{x + y}}}
    =    \\ &=
    \norm{\frac {x + y} {\norm{x + y}}}
    = 1,
  \end{balign*}
  hence \( \nu \in S_E \). Thus, \( \xi = \eta \) and \( x = \frac {\norm x} {\norm y} y \), so \( x \) and \( y \) are linearly dependent.

  \ImplicationSubProof{def:rotund_norm/linearly_dependent}{def:rotund_norm/no_sphere_segments} Let \fullref{def:rotund_norm/linearly_dependent/equation} hold and fix \( x, y \in S_E, t \in (0, 1) \). Define \( z \coloneqq tx + (1-t)y \).
  First, assume that the vectors \( tx \) and \( (1-t)y \) satisfy the left part of \fullref{def:rotund_norm/linearly_dependent/equation}, i.e.
  \begin{equation*}
    \norm z = \norm{tx + (1-t)y} = t \norm x + (1-t) \norm y = 1.
  \end{equation*}

  This does not refute rotundity since \( x \) and \( y \) are not necessarily distinct. It follows from \fullref{def:rotund_norm/linearly_dependent/equation} that \( tx \) and \( (1-t)y \) are linearly dependent, hence \( x \) and \( y \) are also linearly dependent. Since \( x \) and \( y \) both have unit norm, either \( y = x \) or \( y = -x \).

  If we assume that \( y = -x \), then
  \begin{balign*}
    \norm z
    =
    \norm{tx + (1-t)y}
    =
    (2t - 1) \norm x
    =
    2t - 1,
  \end{balign*}
  which is only possible if \( t = 1 \) since \( \norm z = 1 \). But \( t \) is strictly less than 1.

  Hence, \( y \neq -x \) and the only remaining possibility is that \( y = x \).

  Now assume that the vectors \( tx \) and \( (1-t)y \) do not satisfy the left part of \fullref{def:rotund_norm/linearly_dependent/equation}. This implies \( \norm z < 1 \). Thus, \( x \) and \( y \) are necessarily distinct, but \( z \) is not contained in the unit sphere and the segment \( [x, y] \) is not contained in \( S_E \).

  We have shown that \( x, y \in S_E \) implies that either \( y = x \) or that the segment \( [x, y] \) is not contained in \( S_E \), thus the norm in \( E \) is rotund.
\end{proof}

\begin{theorem}\label{thm:smooth_rotund_norm_duality}\mcite[exer. 2.37(a)]{Phelps1993}
  If the norm in a Banach space \( X \) is such that its dual norm in \( X^* \) is rotund (resp. smooth), then it is itself smooth (resp. rotund).
\end{theorem}
\begin{proof}
  \begin{enumerate}
    \item First, let the dual norm \( \norm{\cdot}^* \) be rotund and assume that \( \norm{\cdot} \) is not smooth.

          Fix \( x \in S_X \). Since \( D(x) \) is nonempty (by \fullref{thm:hahn_banach_implies_duality_mapping_nonempty}) and since \( \norm{\cdot} \) is not smooth, then there exist two different functionals \( x^*, y^* \in D(x) \), such that
          \begin{balign*}
            \inprod {x^*} x
            =
            \inprod {y^*} x
            =
            1.
          \end{balign*}

          We will show that the segment \( [x^*, y^*] \) is contained in \( S_{X^*} \), i.e. that the dual norm is not rotund.

          Fix any \( t \in (0, 1) \) and define \( z^* \coloneqq t x^* + (1-t) y^* \). We only need to show that \( \norm{z^*} = 1 \).

          By the triangle inequality, we have
          \begin{balign*}
            \norm{z^*}
            =
            \norm{t x^* + (1-t) y^*}
            \leq
            t \norm{x^*} + (1-t) \norm{y^*}
            =
            t + (1-t)
            =
            1.
          \end{balign*}

          For the reverse inequality, note that
          \begin{balign*}
            \norm{z^*}
            \geq
            \inprod {z^*} x
            =
            t \inprod {x^*} x + (1-t) \inprod {y^*} x
            =
            t + (1-t)
            =
            1,
          \end{balign*}
          thus \( \norm{z^*} = 1 \). Hence, \( [x^*, y^*] \) is contained in \( S_{X^*} \) and the dual space is not smooth. The obtained contradiction proves that the norm in \( X \) is rotund.

    \item Now let the dual norm \( \norm{\cdot}^* \) be smooth and assume that \( \norm{\cdot} \) is not rotund. Then there exist points \( x, y \in S_X \) such that the while segment \( [x, y] \) is contained in \( S_X \).

          Fix \( t \in (0, 1) \) and define \( z \coloneqq tx + (1-t)y \in S_X \). Denote by \( J: X \to X^{**} \) the canonical embedding into the double-dual. By \fullref{thm:hahn_banach_implies_duality_mapping_nonempty}, there exists a functional \( z^* \in X^* \), such that
          \begin{balign*}
            \inprod {J(z)} {z^*}
            =
            \inprod{z^*} z
            =
            1.
          \end{balign*}

          Because the dual norm \( \norm{\cdot}^* \) is smooth, we cannot have \( \inprod{J(x)} {z^*} =  \inprod{z^*} x = 1 \) or \( \inprod{J(y)} {z^*} = \inprod{z^*} y = 1 \) and since \( \norm{z^*} = 1 \), necessarily
          \begin{equation*}
            \inprod{z^*} x < 1 \text{ and } \inprod{z^*} y < 1.
          \end{equation*}

          If follows that
          \begin{balign*}
            1
            =
            \inprod{z^*} z
            =
            t \inprod{z^*} x + (1-t) \inprod{z^*} y
            <
            t + (1-t)
            =
            1,
          \end{balign*}
          which is a contradiction. Hence, \( \norm{\cdot} \) is rotund.
  \end{enumerate}
\end{proof}

\begin{proposition}\label{thm:hilbert_space_smooth_rotund}\mcite[exer. 2.37(c)]{Phelps1993}
  Norms in Hilbert spaces are both smooth and rotund.
\end{proposition}
\begin{proof}
  Let \( X \) be a Hilbert space, i.e. the norm is generated by an inner product and, due to Riesz's theorem, we identify the space \( X \) with its continuous dual \( X^* \).

  To prove that \( X \) is rotund, choose \( x, y \in S_X, x \neq y \). We will show that the segment \( [x, y] \) is not contained in \( S_X \).

  If \( x \) and \( y \) are linearly dependent, necessarily \( y = -x \) and all non-trivial convex combinations of \( x \) and \( y \) are contained in the open unit ball, hence \( [x, y] \not\subseteq S_X \).

  Not let \( x \) and \( y \) be linearly independent. By the Cauchy-Bunyakovsky-Schwarz inequality, we have
  \begin{balign}\label{eq:hilbert_cauchy_inequality}
    \inprod x y \leq \abs{\inprod x y} < \norm x \norm y = 1.
  \end{balign}

  Fix \( t \in (0, 1) \) and let \( z \coloneqq tx + (1-t)y \). We will show that \( z \not\in S_X \). Indeed,
  \begin{balign*}
    \norm{z}^2
    =
    \inprod z z
     & =
    t^2 \norm x^2 + t(1-t) \inprod x y + (1-t) t \inprod y x + (1-t)^2 \norm y^2
    =    \\ &=
    t^2 + (1-t)^2 + 2 t(1-t) \inprod x y
    <    \\ &\reloset {(\ref{eq:hilbert_cauchy_inequality})} <
    t^2 + (1-t)^2 + 2 t(1-t)
    =    \\ &=
    t^2 + 1 - 2t + t^2 + 2t - t^2
    =
    1.
  \end{balign*}

  Thus, \( \norm{z}^2 < 1 \) and \( \norm z < 1 \) and \( z \not\in S_X \).

  In both cases, no interior point of the segment \( [x, y] \) is contained in \( S_X \), hence the norm in \( X \) is rotund.

  Since we identify \( X \) with its dual, the norm in \( X^* \) is also rotund and by \fullref{thm:smooth_rotund_norm_duality}, the norm in \( X \) is also smooth.
\end{proof}

\begin{example}\label{thm:c0_l1_not_smooth_rotund}\mcite[exer. 2.37(c)]{Phelps1993}
  The norms in \( c_0 \) and \( l^1 \) are neither smooth nor rotund.
\end{example}
\begin{proof}
  Consider the space \( c_0 \) of all real sequences that converge to zero equipped with the uniform norm
  \begin{equation*}
    \norm{x}_{c_0} \coloneqq \sup_i \abs{x_i}.
  \end{equation*}

  Note that the dual space of \( c_0 \) is (isometrically isomorphic to) the space \( l^1 \) of absolutely summable sequences with norm
  \begin{equation*}
    \norm{x}_{l^1} \coloneqq \sum_i \abs{x_i}.
  \end{equation*}

  Let \( \{ e_n \}_{n=1}^\infty \) be the canonical basis of \( c_0 \), i.e. the coordinates \( e^{(i)}_n \) of \( e_n \) are given by the Dirac delta function, \( e^{(i)}_n \coloneqq \delta_{i,n} \).

  For every natural \( n \geq 1 \), define \( x_n \) to be the same as \( e_n \) except that the first coordinate of \( x_n \) is always \( 1 \).

  The corresponding norms of \( e_n \) are all equal to 1 and the norms of \( x_n \) are
  \begin{balign*}
    \norm{x_n}_{c_0} = 1
     &  &
    \norm{x_n}_{l^1} = 2.
  \end{balign*}

  For every \( n \) we have
  \begin{equation*}
    \inprod {e_1} {x_n} = \inprod {e_n} {x_n} = 1,
  \end{equation*}
  hence \( J_{c_0}(x_n) \) has at least two elements \( e_1 \) and \( e_n \) and the norm in \( c_0 \) is not smooth.

  Given that \( \{ x_1, x_2, \ldots \} \subseteq S_{c_0} \), consider the convex combinations of \( x_2 \) and \( x_3 \):
  \begin{balign*}
    tx_2 + (1-t)x_3
    =
    (1, t, (1-t), 0, 0, \ldots).
  \end{balign*}

  Evidently \( tx_2 + (1-t)x_3 \in S_{c_0} \) for every \( t \in (0, 1) \), hence the norm in \( c_0 \) is not rotund.

  The contrapositions to the statements in \fullref{thm:smooth_rotund_norm_duality} say that if \( X \) is not rotund (resp. smooth), then the dual space \( X^* \) is not smooth (resp. rotund). Thus, \( l^1 \) is neither smooth or rotund as the dual of \( c_0 \).
\end{proof}