\chapter{Small oscillations}
\section{Potential energy and equilibrium}
In order to understand the general theory of oscillations, it is essential to know about the potential energl at the equilibrium configuration. Let us consider a conservative system in which the potential energy is: function of position only. Let the system be specified by $n$ generalized coordinates $q_{1}, q_{2}, \ldots, q_{n}$, not involve, time explicitly. For such a system, the potential energy is given by
$$
V=V\left(q_{1}, q_{2}, \ldots, q_{n}\right)
$$
and the generalized forces are given by
$G_{k}=-\frac{\partial V}{\partial q_{k}}$ where $k=1,2, \ldots ., n$\\
The system is said to be in equilibrium, if the generalized forces acting on the system are equal to zero: i.e.,
$$
G_{k}=-\left[\frac{\partial V}{\partial q_{k}}\right]_{0}=0
$$
\textbf{For small oscillations}\\
\textbf{Force constant} $k=\left.\frac{\partial^{2} V}{\partial q_k^{2}}\right|_{q=q_{0}} \text { where } q_{0} \text { is stable equilibrium point. }$\\
\textbf{Angular frequency} $\omega=\sqrt{\frac{k}{m}}$
\subsection{Stable,Unstable and Neutral equilibrium}
\subsubsection{Stable equilibrium}
A system is said to be in stable equilibrium, if a small displacement of the system from the rest position (by giving a little energy to it) results in a small bounded motion about the equilibrium position.
\subsubsection{Unstable equilibrium}
Small displacement of the system from the equilibrium position results in an unbounded motion, it is in an unstable equilibrium.
\subsubsection{Neutral equilibrium}
 Further, if the system on displacement has no tendency to move about or away the equilibrium position, it is said to be in neutral equilibrium.\\
 \begin{minipage}{0.5\textwidth}
 \begin{figure}[H]
 	\centering
 	\includegraphics[height=4cm,width=5cm]{stable}
 	\caption{}
 	\label{fig1}
 \end{figure}
 \end{minipage}
\begin{minipage}{0.5\textwidth}
\begin{figure}[H]
	\centering
	\includegraphics[height=3cm,width=5cm]{unstable}
	\caption{}
	\label{fig2}
\end{figure}
\end{minipage}
A graph drawn between the potential energy of the system and a particular coordinate $q_{k}$ is called potential energy curve and  The positions $A$ and $B$, where the generalized force $F=-\partial V / \partial q$ vanishes, are the positions of equilibrium; potential energy $V$ is minimum (say $V_{0}$ ) at $A$ [fig.\ref{fig1}] and maximum at $B$ [fig.\ref{fig2} ]. Position $A$ corresponds to the stable equilibrium, because if the system is displaced from $A$ to $Q$ by giving energy $\left(E-V_{0}\right)$ and left to itself, the system tries to come in the position of minimum potential energy. Consequently the potential energy will change to kinetic energy and at $A$ the energy $\left(E-V_{0}\right)$ will be purely in the kinetic form because of the conservation law. This will change again to potential form, when the system moves towards the position $P$ and hence a bounded motion ensues about the equilibrium position $A$. Obviously the position $B$ of the maximum potential energy represents the unstable equilibrium because any energy given to the system at this position will result more and more kinetic energy when the system moves either left or right to it. In this case, the system moves away from the equilibrium position. In case of neutral equilibrium, the potential energy is independent of the coordinate and equilibrium. occurs at any arbitrary value of that coordinate.
\section{Small oscillations}
In small oscillation we generalize the harmonic oscillator problem of one degree of freedom in the lagrangian formulation to the case of small amplitude oscillations of a system of seversl degrees of freedom near the position of equilibrium.When we go from a single oscillator to the problem of two coupled oscillators the analysis results in some interesting and surprising new features.We shall see that the motion of the two coupled oscillators in general is much complicated and none of the oscillators in general executes simple harmonic motion.However for small amplitude oscillations ,we may express the general motion as a superposition of two independant simple harmonic motions ,both going on simultaneously.We call thsese two simple harmonic motions as normal modes or simply modes.Further we shall see that a system of N coupled oscillators with N degrees of freedom ,has exactly N independant modes of vibration and general motion can be expressed as the superposition of N normal modes.Each mode has its own frquency and wavelength.
\subsection{Matrix method to solve small oscillations}
We shall interested in the motion of the system with in the immediate neighbourhood of configuration of stable equilibrium .Since the departure fro the equilibrium is very small ,all functions may be expanded in a Taylor series about the equlibrium ,retaining only the lowest order terms .The deviation of the generalized coordinates from equilibrium will be denoted by $\eta_i$:\\
$$q_i=q_{oi}+\eta_i$$
and these may be taken as the new generalized coordinates of the motion
\begin{figure}[H]
	\centering
	\includegraphics[height=3cm,width=5cm]{potential}
	\caption{}
	\label{}
\end{figure}
One can expand potential energy by Taylor series expansion
$$V\left(q_{i} \ldots \ldots q_{n}\right)=V\left(q_{00} \ldots \ldots q_{0 n}\right)+\left.\frac{\partial V}{\partial q_{i}}\right|_{q_{i 0}}\left(q_{i}-q_{0 i}\right)+\frac{1}{2} \frac{\partial^{2} V}{\partial q_{i} \partial q_{j}}\left(q_{i}-q_{0 i}\right)\left(q_{j}-q_{0 j}\right)+\ldots .$$
The 0 in subscript means $q_{i}=q_{0 i}$\\
So,
\begin{equation}
\quad V(q)=V_{0}+0+\frac{1}{2}\left(\frac{\partial^{2} V}{\partial q_{i} \partial q_{j}}\right)_{0} \eta_{i} \eta_{j}+\ldots \ldots \label{ref1}
\end{equation}
because at equilibrium,
$$
\left(\frac{\partial V}{\partial q_{i}}\right)_{q_{i}=q_{0 i}} \equiv\left(\frac{\partial V}{\partial q_{i}}\right)_{0}=-Q_{i}=0
$$
where $Q_{i}$ is the generalized force. Now,
\begin{equation}
V_{0} \equiv V\left(q_{01}, q_{02}, \ldots \ldots, q_{0 n}\right) \label{ref2}
\end{equation}
 is the potential energy of eqilibrium configuration whis is constant.So we set $V_0$ is equal to zero because in equations of motions only derivative of V occur.\\
 Neglecting higher order terms (because $\eta_{i}^{\prime} s$ are very small)
 \begin{equation}
 V=\frac{1}{2}\left(\frac{\partial^{2} V}{\partial q_{i} \partial q_{j}}\right)_{0} \eta_{i} \eta_{j}=\frac{1}{2} V_{i j} \eta_{i} \eta_{j} \label{ref3}
 \end{equation}
 We see that $V_{i j}=V_{j i}$
 We can write $V$ in matrix form as
\begin{align}
 V=\frac{1}{2}\left(\begin{array}{llll}
\eta_{1} & \eta_{2} & \cdots & \eta_{n}
\end{array}\right)\left[\begin{array}{cccc}
V_{11} & V_{12} & \cdots & V_{1 n} \\
V_{21} & V_{22} & \ldots & V_{2 n} \\
\vdots & \vdots & \ldots & \vdots \\
V_{n 1} & V_{n 2} & \ldots & V_{n n}
\end{array}\right]\left[\begin{array}{l}
\eta_{1} \\
\eta_{2} \\
\vdots \\
\eta_{n}
\end{array}\right]\label{ref4}
\end{align}
Since the constraints are time independent, hence kinetic energy can be written as
\begin{align}
T=\frac{1}{2} m_{i j} \dot{q}_{i} \dot{q}_{j}=\frac{1}{2} m_{i j} \dot{\eta}_{i} \dot{\eta}_{j}\label{ref5}
\end{align}
Since, $q_{i}=q_{0 i}+\eta_{i}$, so $\dot{q}_{i}=\dot{\eta}_{i}$\\
$m_{i j}$ can also be expanded similar to $V$
$$m_{i j}=m_{i j}\left(q_{01}, q_{02}, \ldots \ldots, q_{0 n}\right)+\left(\frac{\partial m_{i j}}{\partial q_{k}}\right)_{0} \dot{\eta}_{k}+\ldots \ldots \ldots$$
$\text { here we take first term only, because in equation $\ref{ref5}$ we already has } \dot{\eta} \dot{\eta}_{j} $.\\
so
\begin{equation}
T=\frac{1}{2} T_{i j} \dot{\eta}_{i} \dot{\eta}_{j}\label{ref6}
\end{equation}
$\text { where, } \quad T_{i j}=m_{i j}\left(q_{01}, q_{02}, \ldots \ldots q_{0 n}\right)$\\
\text { In matrix form, }
\begin{align}
 T=\frac{1}{2}\left(\begin{array}{llll}
\dot{\eta}_{1} & \dot{\eta}_{2} & \ldots & \dot{\eta}_{n}
\end{array}\right)\left[\begin{array}{cccc}
T_{11} & T_{12} & \ldots & T_{1 n} \\
T_{21} & T_{22} & \ldots & T_{2 n} \\
\vdots & \vdots & \ldots & \vdots \\
T_{n 1} & T_{n 2} & \ldots & T_{n n}
\end{array}\right]\left[\begin{array}{l}
\dot{\eta}_{1} \\
\dot{\eta}_{2} \\
\vdots \\
\dot{\eta}_{n}
\end{array}\right]\label{ref7}
\end{align}
Like $\mathbf{V}, \mathbf{T}$ is also symmetric, i.e. $T_{i j}=T_{j i}$
The Lagrangian is,
\begin{align}
L=T-V=\frac{1}{2}\left(T_{i j} \dot{\eta}_{i} \dot{\eta}_{j}-V_{i j} \eta_{i} \eta_{j}\right)\label{ref8}
\end{align}
The equation of motion for $\eta_{i}$
$$
\frac{d}{d t}\left(\frac{\partial L}{\partial \dot{\eta}_{i}}\right)-\frac{\partial L}{\partial \eta_{i}}=0
$$
\begin{align}
&\frac{d}{d t}\left(\frac{\partial}{\partial \dot{\eta}_{i}}\left(T_{i j} \dot{\eta}_{i} \dot{\eta}_{j}-V_{i j} \eta_{i} \eta_{j}\right)\right)-\frac{\partial}{\partial \eta_{i}}\left(T_{i j} \dot{\eta}_{i} \dot{\eta}_{j}-V_{i j} \eta_{i} \eta_{j}\right)=0 \notag \\
&\frac{d}{d t}\left(T_{i j} \dot{\eta}_{j}\right)-V_{i j} \eta_{j}=0 \notag \\
&T_{i j} \ddot{\eta}_{j}+V_{i j} \eta_{j}=0 \label{ref9}
\end{align}
Note that $T_{i j}$ and $\mathrm{V}_{i j}$ are constants and $\dot{\eta}^{\prime} s$ and $\eta^{\prime} s$ appear only as multiplication with each other. For example the equation for $\eta_{1}$ is
\begin{align*}
&\frac{d}{d t}\left(\frac{\partial L}{\partial \dot{\eta}_{1}}\right)-\frac{\partial L}{\partial \eta_{1}}=0 \\
&\frac{d}{d t}\left[\frac{\partial}{\partial \dot{\eta}_{1}}\left(T_{1 j} \dot{\eta}_{1} \dot{\eta}_{j}\right)+\frac{\partial}{\partial \eta_{1}}\left(V_{1 j} \eta_{1} \eta_{j}\right)\right]=0
\end{align*}
[Since $V$ is independent of $\dot{\eta}^{\prime} s$ and $T$ is independent of $\eta^{\prime} s$ ]. So,
\begin{align*}
&\frac{d}{d t}\left(\frac{\partial}{\partial \dot{\eta}_{1}}\left(T_{11} \dot{\eta}_{1} \dot{\eta}_{1}+T_{12} \dot{\eta}_{1} \dot{\eta}_{2}+\ldots \ldots \ldots .+T_{1 n} \dot{\eta}_{1} \dot{\eta}_{n}+\ldots \ldots . .\right)\right)\\
&+\frac{\partial}{\partial \eta_{1}}\left(V_{11} \eta_{1} \eta_{1}+V_{12} \eta_{1} \eta_{2}+\ldots \ldots . . V_{1 n} \eta_{1} \eta_{n}+\ldots \ldots\right)=0 \\
&\frac{d}{d t}\left(T_{11} \dot{\eta}_{1}+T_{12} \dot{\eta}_{2}+\ldots \ldots T_{1 n} \dot{\eta}_{n}\right)+\left(V_{11} \eta_{1}+V_{12} \eta_{2}+\ldots \ldots+V_{1 n} \eta_{n}\right)=0 \\
&T_{11} \ddot{\eta}_{1}+T_{12} \ddot{\eta}_{2}+\ldots . .+T_{1 n} \ddot{\eta}_{n}+\left(V_{11} \eta_{1}+V_{12} \eta_{2}+\ldots . .+V_{1 n} \eta_{n}\right)=0
\end{align*}
In summation convention the above equation is
\begin{align}
T_{1 j} \ddot{\eta}_{j}+V_{1 j} \eta_{j}=0\label{ref10}
\end{align}
The point is that you should know what any expression means. So, we get $\eta$ equations in total.
To sovle the equation of motion $\eta$, we put a trial solution.

\begin{equation}
\eta_{j}=C a_{j} e^{-i o t}\label{ref11}
\end{equation}
Note that in the exponential $i=\sqrt{-1}$
We get,
\begin{align}
&\dot{\eta}_{j}=-C a_{j}(i \omega) e^{-i \omega t} \notag \\
&\ddot{\eta}_{j}=+C a_{j}(i \omega)^{2} e^{-i \omega t}=-\omega^{2} \eta_{j}\label{ref12}
\end{align}
$\text { putting } \ddot{\eta}_{j} \text { in equation ($\ref{ref9}$) }$
\begin{align}
&T_{i j} \ddot{\eta}_{j}+V_{i j} \eta_{j}=0 \notag\\
&T_{i j}\left(-\omega^{2} \eta_{j}\right)+V_{i j} \eta_{j}=0 \notag\\
&\left(V_{i j}-\omega^{2} T_{i j}\right) \eta_{j}=0\label{ref13} \\
&V_{i j} a_{j}=\omega^{2} T_{i j} a_{j}\label{ref14}
\end{align}
 in the matrix form equation ($\ref{ref13}$), is (equation  $\ref{ref14}$  also can be written in similar form)\\
 $\left[\begin{array}{cccc}
 	V_{11} & V_{12} & \ldots & V_{1 n} \\
 	V_{21} & V_{22} & \ldots & V_{2 n} \\
 	\vdots & \vdots & & \vdots \\
 	V_{n 1} & V_{n 2} & \ldots & V_{n n}
 \end{array}\right]\left[\begin{array}{l}
 	\eta_{1} \\
 	\eta_{2} \\
 	\vdots \\
 	\eta_{n}
 \end{array}\right]-\omega^{2}\left[\begin{array}{cccc}
 	T_{11} & T_{12} & \ldots & T_{1 n} \\
 	T_{21} & T_{22} & \ldots & T_{2 n} \\
 	\vdots & \vdots & & \vdots \\
 	T_{n 1} & T_{n 2} & \ldots & T_{n n}
 \end{array}\right]\left[\begin{array}{l}
 	\eta_{1} \\
 	\eta_{2} \\
 	\vdots \\
 	\eta_{n}
 \end{array}\right]=0$
 \begin{align}
 \left[\begin{array}{cccc}
 V_{11}-\omega^{2} T_{11} & V_{12}-\omega^{2} T_{12} & \ldots & V_{1 n}-\omega^{2} T_{1 n} \\
 V_{21}-\omega^{2} T_{21} & V_{22}-\omega_{2} T_{22} & \ldots & V_{2 n}-\omega^{2} T_{2 n} \\
 \vdots & \vdots & & \vdots \\
 V_{n 1}-\omega^{2} T_{n 1} & V_{n 2}-\omega^{2} T_{n 2} & & V_{n n}-\omega^{2} T_{n n}
 \end{array}\right]\left[\begin{array}{l}
 \eta_{1} \\
 \eta_{2} \\
 \vdots \\
 \eta_{n}
 \end{array}\right]=0\label{ref15}
 \end{align}
 From properties of matrices we know that for equation ($\ref{ref15}$) to be satisfied for all $\eta^{\prime} s$. The determinant of matrix $\mathbf{V}-\omega^{2} \mathbf{T}$ must be zero i.e.
 $$
 \left|\mathbf{V}-\omega^{2} \mathbf{T}\right|=0
 $$
 \begin{align}
 \left|\begin{array}{cccc}
 V_{11}-\omega^{2} T_{11} & V_{12}-\omega^{2} T_{12} & \cdots & V_{1 n}-\omega^{2} T_{1 n} \\
 V_{21}-\omega^{2} T_{21} & V_{22}-\omega_{2} T_{22} & \cdots & V_{2 n}-\omega^{2} T_{2 n} \\
 \vdots & \vdots & & \vdots \\
 V_{n 1}-\omega^{2} T_{n 1} & V_{n 2}-\omega^{2} T_{n 2} & & V_{n n}-\omega^{2} T_{n n}
 \end{array}\right|=0\label{ref16}
 \end{align}
  This equation ($\ref*{ref16}$) is called the secular equation.
  By solving the determinant ($\ref{ref16}$) we get $n$ values of $\omega^{2}$. Each value of $\omega$ represents the frequency of normal mode. The equation ($\ref{ref14}$) is a type of eigenvalues. $\mathbf{V}$ acting on eigenvector a gives $\omega^{2} \mathbf{T a}$. There are $n$ such eigenvectors. Hence, there are $n$ normal modes. It can be shown that the eigen vector matrix of which is denoted by $\mathbf{A}$ diagonalizes both $\mathbf{T}$ and $\mathbf{V}$ (for detail see section $6.2$ of Goldstein, $3^{\text {rd }}$ eddition, but it is sufficient for us to rememher the result). A diagonalizes $\mathbf{V}$ to a matrix whose diagonal elements are the eigen-$\text { values i.e. } \omega^{2 \prime} s \text { (say } \lambda^{\prime} s)$\\
  (Note that in ordinary eigen alue problems, matrix acting on eigenvector produces eigenvalue times the eigenvector i.e. $\mathbf{M a}=\lambda \mathbf{a}$ or $(\mathbf{M}-\lambda \mathbf{1}) \mathbf{a}=0$, but here it is $(\mathbf{V}-\lambda \mathbf{T}) \mathbf{a}=0 .)$\\
  ie
  \begin{align}
  \tilde{\mathbf{A}} \mathbf{V} \mathbf{A}=\lambda=\left[\begin{array}{cccc}
  \lambda_{1} & 0 & \cdots & 0 \\
  0 & \lambda_{2} & \cdots & 0 \\
  \vdots & \vdots & & \vdots \\
  0 & 1, & \cdots & \lambda_{n}
  \end{array}\right]\label{ref17}
  \end{align}
  $\text { where } \lambda_{1}, \lambda_{2} \ldots . . \text { are eigen values of (i.e. } \omega^{21} s \text { ) }$\\
  And $\mathbf{T}$ is diagonalized to identity i.e.
  \begin{align}
  \tilde{\mathbf{A}} \mathbf{T} \mathbf{A}=\mathbf{1}\label{ref18}
  \end{align}
  To solve a problem, the main thing we need to do is\\
   (1) Solve the determinant (9.16) to find the frequencies of normal modes\\
  (2) Find the eigenvectors a correspoinding to each $\omega^{2}$ (the eigenvalue), in the equation.
  $$
  \left(\mathbf{V}-\omega^{2} \mathbf{T}\right) \mathbf{a}=0
  $$
  where the $k^{\text {th }}$ eigenvector (corrersponding to $k^{\text {th }} \omega^{2}$ )

  \begin{align}
  \mathbf{a}_{k}=\left[\begin{array}{c}
  a_{1 k} \\
  a_{2 k} \\
  \vdots \\
  a_{n k}
  \end{array}\right]\label{ref19}
  \end{align}
  (3) The normal mode coordinates are
  \begin{align}
  Q_{k}=f_{k} \cos \left(\omega_{k} t+\delta_{k}\right)\label{ref20}
  \end{align}
  where, $f_{k}$ and $\delta_{k}$ are amplitude and phase factor respectively. Note that in a normal mode, the hole system oscillates with same frequency.
  (4) The general solution for
  \begin{align}
  \eta_{i}=a_{i k} Q_{k}\label{ref21}
  \end{align}
   The matrix $\mathbf{A}$ is
   \begin{align}
   \left[\begin{array}{llll}a_{11} & a_{12} & \cdots & a_{1 n} \\ a_{21} & a_{22} & \cdots & a_{2 n} \\ \vdots & \vdots & & \vdots \\ a_{n 1} & a_{n 2} & \cdots & a_{n n}\end{array}\right]\label{22}
   \end{align}
  So, the solution of our problem (the equation ($\ref{ref21}$) is:
 \begin{align}
  \left[\begin{array}{l}
 \eta_{1} \\
 \eta_{2} \\
 \vdots \\
 \eta_{n}
 \end{array}\right]=\left[\begin{array}{llll}
 a_{11} & a_{12} & \cdots & a_{1 n} \\
 a_{21} & a_{22} & \cdots & a_{2 n} \\
 \vdots & \vdots & & \vdots \\
 a_{n 1} & a_{n 2} & \cdots & a_{n n}
 \end{array}\right]\left[\begin{array}{l}
 Q_{1} \\
 Q_{2} \\
 \vdots \\
 Q_{n}
 \end{array}\right]
 \end{align}
 One complication may arise when eigenvalues are degenerate. In this case we first choose an eigenvector (corresponding to degenerate eigenvalue) satisfying the eigenvalue equation and remaining eigenvectors (if there is $k$-fold degeneracy, then there are $k$-eigenvectors corresponding to single eigenvalue) are determined such that they satisfy the eigenvalue equation and are orthogonal to each other.
 \newpage
 \begin{abox}
 	Practice set 1
 	\end{abox}
 \begin{enumerate}
 		\item  A particle of unit mass moves in a potential $V(x)=a x^{2}+\frac{b}{x^{2}}$, where $a$ and $b$ are positive constants. The angular frequency of small oscillations about the minimum of the potential is
 		{\exyear{NET JUNE 2011}}
 	\begin{tasks}(2)
 		\task[\textbf{A.}] $\sqrt{8 b}$
 		\task[\textbf{B.}]$\sqrt{8 a}$
 		\task[\textbf{C.}] $\sqrt{8 a / b}$
 		\task[\textbf{D.}]$\sqrt{8 b / a}$
 	\end{tasks}
 	\item Consider the motion of a classical particle in a one dimensional double-well potential $V(x)=\frac{1}{4}\left(x^{2}-2\right)^{2} .$ If the particle is displaced infinitesimally from the minimum on the $x$-axis (and friction is neglected), then
 	{\exyear{NET JUNE 2012}}
 \begin{tasks}(1)
 	\task[\textbf{A.}] the particle will execute simple harmonic motion in the right well with an angular frequency $\omega=\sqrt{2}$
 	\task[\textbf{B.}]the particle will execute simple harmonic motion in the right well with an angular frequency $\omega=2$
 	\task[\textbf{C.}]the particle will switch between the right and left wells
 	\task[\textbf{D.}]the particle will approach the bottom of the right well and settle there
 \end{tasks}
	\item Three particles of equal mass $(\mathrm{m})$ are connected by two identical massless springs of stiffness constant $(K)$ as shown in the figure\\
	\begin{figure}[H]
		\centering
		\includegraphics[height=1cm,width=5cm]{problem1}
	\end{figure}
	If $x_{1}, x_{2}$ and $x_{3}$ denote the horizontal displacement of the masses from their respective equilibrium positions the potential energy of the system is
	{\exyear{NET DEC 2012}}
\begin{tasks}(2)
	\task[\textbf{A.}] $\frac{1}{2} K\left[x_{1}^{2}+x_{2}^{2}+x_{3}^{2}\right]$
	\task[\textbf{B.}]$\frac{1}{2} K\left[x_{1}^{2}+x_{2}^{2}+x_{3}^{2}-x_{2}\left(x_{1}+x_{3}\right)\right]$
	\task[\textbf{C.}]$\frac{1}{2} K\left[x_{1}^{2}+2 x_{2}^{2}+x_{3}^{2}-2 x_{2}\left(x_{1}+x_{3}\right)\right]$
	\task[\textbf{D.}]$\frac{1}{2} K\left[x_{1}^{2}+2 x_{2}^{2}-2 x_{2}\left(x_{1}+x_{3}\right)\right]$
\end{tasks}
	\item The time period of a simple pendulum under the influence of the acceleration due to gravity $g$ is $T$. The bob is subjected to an additional acceleration of magnitude $\sqrt{3} g$ in the horizontal direction. Assuming small oscillations, the mean position and time period of oscillation, respectively, of the bob will be
	{\exyear{NET JUNE 2014}}
\begin{tasks}(2)
	\task[\textbf{A.}] $0^{\circ}$ to the vertical and $\sqrt{3} T$
	\task[\textbf{B.}]$30^{\circ}$ to the vertical and $T / 2$
	\task[\textbf{C.}]$60^{\circ}$ to the vertical and $T / \sqrt{2}$
	\task[\textbf{D.}]$0^{\circ}$ to the vertical and $T / \sqrt{3}$
\end{tasks}
	\item A particle of mass $m$ is moving in the potential $V(x)=-\frac{1}{2} a x^{2}+\frac{1}{4} b x^{4}$ where $a, b$ are positive constants. The frequency of small oscillations about a point of stable equilibrium is
	{\exyear{NET DEC 2014}}
\begin{tasks}(2)
	\task[\textbf{A.}] $\sqrt{a / m}$
	\task[\textbf{B.}]$\sqrt{2 a / m}$
	\task[\textbf{C.}]$\sqrt{3 a / m}$
	\task[\textbf{D.}]$\sqrt{6 a / m}$
\end{tasks}
	\item A particle of mass $m$, kept in potential $V(x)=-\frac{1}{2} k x^{2}+\frac{1}{4} \lambda x^{4}$ (where $k$ and $\lambda$ are positive constants), undergoes small oscillations about an equilibrium point. The frequency of oscillations is
	{\exyear{NET JUNE 2018}}
\begin{tasks}(2)
	\task[\textbf{A.}] $\frac{1}{2 \pi} \sqrt{\frac{2 \lambda}{m}}$
	\task[\textbf{B.}]$\frac{1}{2 \pi} \sqrt{\frac{k}{m}}$
	\task[\textbf{C.}]$\frac{1}{2 \pi} \sqrt{\frac{2 k}{m}}$
	\task[\textbf{D.}]$\frac{1}{2 \pi} \sqrt{\frac{\lambda}{m}}$
\end{tasks}
 \end{enumerate}
\colorlet{ocre1}{ocre!70!}
\colorlet{ocrel}{ocre!30!}
\setlength\arrayrulewidth{1pt}
\begin{table}[H]
	\centering
	\arrayrulecolor{ocre}

	\begin{tabular}{|p{1.5cm}|p{1.5cm}||p{1.5cm}|p{1.5cm}|}
		\hline
		\multicolumn{4}{|c|}{\textbf{Answer key}}\\\hline\hline
		\rowcolor{ocrel}Q.No.&Answer&Q.No.&Answer\\\hline
		1&\textbf{b}&2&\textbf{b}\\\hline
		3&\textbf{c}&4&\textbf{c}\\\hline
		5&\textbf{b}&6&\textbf{c}\\\hline
	\end{tabular}
\end{table}
\newpage
\begin{abox}
	Practice set 2
	\end{abox}
\begin{enumerate}

	\item A particle is placed in a region with the potential $V(x)=\frac{1}{2} k x^{2}-\frac{\lambda}{3} x^{3}$, where $k, \lambda>0$.
	Then,
	{\exyear{GATE 2010}}
\begin{tasks}(1)
	\task[\textbf{A.}] $x=0$ and $x=\frac{k}{\lambda}$ are points of stable equilibrium
	\task[\textbf{B.}]$x=0$ is a point of stable equilibrium and $x=\frac{k}{\lambda}$ is a point of unstable equilibrium
	\task[\textbf{C.}]$x=0$ and $x=\frac{k}{\lambda}$ are points of unstable equilibrium
	\task[\textbf{D.}]There are no points of stable or unstable equilibrium
\end{tasks}

	\item Two bodies of mass $m$ and $2 m$ are connected by a spring constant $k$. The frequency of the normal mode is
	{\exyear{GATE 2011}}
\begin{tasks}(2)
	\task[\textbf{A.}] $\sqrt{3 k / 2 m}$
	\task[\textbf{B.}]$\sqrt{k / m}$
	\task[\textbf{C.}] $\sqrt{2 k / 3 m}$
	\task[\textbf{D.}]$\sqrt{k / 2 m}$
\end{tasks}
	\item A particle of unit mass moves along the $x$-axis under the influence of a potential, $V(x)=x(x-2)^{2}$. The particle is found to be in stable equilibrium at the point $x=2$. The time period of oscillation of the particle is
	{\exyear{GATE 2012}}
\begin{tasks}(2)
	\task[\textbf{A.}] $\frac{\pi}{2}$
	\task[\textbf{B.}]$\pi$
	\task[\textbf{C.}]$\frac{3 \pi}{2}$
	\task[\textbf{D.}]$2 \pi$
\end{tasks}

	\item Consider two small blocks, each of mass $M$, attached to two identical springs. One of the springs is attached to the wall, as shown in the figure. The spring constant of each spring is $k$. The masses slide along the surface and the friction is negligible. The frequency of one of the normal modes of the system is,
{	\exyear{GATE 2013}}
	\begin{figure}[H]
		\centering
		\includegraphics[height=3cm,width=5cm]{GATE1}
	\end{figure}
\begin{tasks}(2)
	\task[\textbf{A.}] $\sqrt{\frac{3+\sqrt{2}}{2}} \sqrt{\frac{k}{M}}$
	\task[\textbf{B.}]$\sqrt{\frac{3+\sqrt{3}}{2} \sqrt{\frac{k}{M}}}$
	\task[\textbf{C.}]$\sqrt{\frac{3+\sqrt{5}}{2}} \sqrt{\frac{k}{M}}$
	\task[\textbf{D.}]$\sqrt{\frac{3+\sqrt{6}}{2}} \sqrt{\frac{k}{M}}$
\end{tasks}

	\item Two masses $m$ and $3 m$ are attached to the two ends of a massless spring with force constant $K$. If $m=100 \mathrm{~g}$ and $K=0.3 \mathrm{~N} / \mathrm{m}$, then the natural angular frequency of oscillation is $H z$.
{	\exyear{GATE 2014}}

	\item A particle of mass $m$ is in a potential given by
	$$
	V(r)=-\frac{a}{r}+\frac{a r_{0}^{2}}{3 r^{3}}
	$$
	where $a$ and $r_{0}$ are positive constants. When disturbed slightly from its stable equilibrium position it undergoes a simple harmonic oscillation. The time period of oscillation is
	{\exyear{GATE 2014}}
\begin{tasks}(2)
	\task[\textbf{A.}] $2 \pi \sqrt{\frac{m r_{0}^{3}}{2 a}}$
	\task[\textbf{B.}]$2 \pi \sqrt{\frac{m r_{0}{ }^{3}}{a}}$
	\task[\textbf{C.}]$2 \pi \sqrt{\frac{2 m r_{0}^{3}}{a}}$
	\task[\textbf{D.}]$4 \pi \sqrt{\frac{m r_{0}^{3}}{a}}$
\end{tasks}

	\item Two identical masses of $10 \mathrm{gm}$ each are connected by a massless spring of spring constant $1 \mathrm{~N} / \mathrm{m}$. The non-zero angular eigenfrequency of the system is. $. \mathrm{rad} / \mathrm{s} .$ (up to two decimal places)
{	\exyear{GATE 2017}}
	\item In the context of small oscillations, which one of the following does NOT apply to the normal coordinates?
	{\exyear{GATE 2018}}
\begin{tasks}(1)
	\task[\textbf{A.}] Each normal coordinate has an eigen-frequency associated with it
	\task[\textbf{B.}]The normal coordinates are orthogonal to one another
	\task[\textbf{C.}]The normal coordinates are all independent
	\task[\textbf{D.}]The potential energy of the system is a sum of squares of the normal coordinates with constant coefficients
\end{tasks}
\end{enumerate}
\colorlet{ocre1}{ocre!70!}
\colorlet{ocrel}{ocre!30!}
\setlength\arrayrulewidth{1pt}
\begin{table}[H]
	\centering
	\arrayrulecolor{ocre}

	\begin{tabular}{|p{1.5cm}|p{1.5cm}||p{1.5cm}|p{1.5cm}|}
		\hline
		\multicolumn{4}{|c|}{\textbf{Answer key}}\\\hline\hline
		\rowcolor{ocrel}Q.No.&Answer&Q.No.&Answer\\\hline
		1&\textbf{b}&2&\textbf{a}\\\hline
		3&\textbf{b}&4&\textbf{c}\\\hline
		5&\textbf{0.318}&6&\textbf{a}\\\hline
		7&\textbf{14.14}&8&\textbf{b}\\\hline
	\end{tabular}
\end{table}
\newpage
\begin{abox}
	Practice set 3
	\end{abox}
\begin{enumerate}
		\item  A particle of mass $m$ moves in one dimension under the influence of a potential energy
	$$
	V(x)=-a\left(\frac{x}{\ell}\right)^{2}+b\left(\frac{x}{\ell}\right)^{4}
	$$
	where $a$ and $b$ are positive constants and $\ell$ is a characteristic length. The frequency of small oscillations about a point of stable equilibrium is:
	\begin{tasks}(2)
		\task[\textbf{a.}] $\frac{1}{2 \pi \ell} \sqrt{\frac{b}{m}}$
		\task[\textbf{b.}]$\frac{2 b}{\pi \ell} \sqrt{\frac{1}{m a}}$
		\task[\textbf{c.}]$\frac{1}{\pi \ell} \sqrt{\frac{a^{2}}{m b}}$
		\task[\textbf{d.}] $\frac{1}{\pi \ell} \sqrt{\frac{a}{m}}$
	\end{tasks}
	\begin{answer}
		\begin{align*}
		\text{	We have,}
		V(x)&=-a\left(\frac{x}{\ell}\right)^{2}+b\left(\frac{x}{\ell}\right)^{4}
		\intertext{Here first we need to find the stable equilibrium. At equilibrium}
		\frac{\partial V(x)}{\partial x}&=0 \quad \Rightarrow \frac{-2 a x}{\ell^{2}}+\frac{4 b x^{3}}{\ell^{4}}=0 \quad \Rightarrow x\left(\frac{2 b x^{2}}{\ell^{2}}-a\right)=0\\
		\Rightarrow \quad x&=0, x=\pm \ell \sqrt{\frac{a}{2 b}}\\
		\text{Now, }\quad \frac{\partial^{2} V}{\partial x^{2}}&=\frac{-2 a}{\ell^{2}}+\frac{12 b x^{2}}{\ell^{4}}\\
		\text{We see that for }x&=0, \frac{\partial^{2} V}{\partial x^{2}}<0
		\text{hence, here there is unstable equilibrium}\\
		\text{For}\qquad x&=\pm \ell \sqrt{\frac{a}{2 b}},\left(\frac{\partial^{2} V}{\partial x^{2}}\right)_{x=\pm \ell \sqrt{\frac{a}{2 b}}}=-\frac{2 a}{\ell^{2}}+\frac{12 b}{\ell^{4}} \ell^{2} \times \frac{a}{2 b}=\frac{4 a}{\ell^{2}}>0
		\intertext{hence, $x=\pm \ell \sqrt{\frac{a}{2 b}}$ corresponds to stable equilibrium.. Now to find the frequeny, we see that the problemis one dimensional, so matrices $\mathbf{V}$ and $\mathbf{T}$ both have one element each, i.e. $V_{11}$ and $T_{11}$ respectively.}
		V_{11}&=\left(\frac{\partial^{2} V}{\partial x^{2}}\right)_{x=\pm f \sqrt{\frac{a}{2 b}}}=\frac{4 a}{\ell^{2}}\\
		\text{Now, the kinetic energy }&=\frac{1}{2} m \dot{x}^{2},\text{ so }T_{11}=m\\
		\text{	Now, we have, }V_{11}-\omega^{2} T_{11}&=0 \qquad\Rightarrow \omega^{2}=\frac{V_{11}}{T_{11}}=\frac{4 a}{m \ell^{2}} \qquad\Rightarrow \omega=\frac{2}{\ell} \sqrt{\frac{a}{m}}\\
		\text{So, the frequency }v&=\frac{\omega}{2 \pi}=\frac{1}{\pi \ell} \sqrt{\frac{a}{m}}
		\intertext{Note: As we have seen in this problem, first we should find the equilibrium configuration of the system then expand potential energy about this configuration in Taylor series.}
		\end{align*}
	\end{answer}
	\item  A particle of mass $m$ is moving in a potential of the form $V(x, y, z)=\frac{1}{2} m \omega^{2}\left(3 x^{2}+3 y^{2}+2 z^{2}+2 x\right)$. The oscillation frequencies of the three normal modes of the particles are given by
\begin{answer}
	\begin{align*}
	\text{The potential is, }V(x, y, z)&=\frac{1}{2} m \omega^{2}\left(3 x^{2}+3 y^{2}+2 z^{2}+2 x y\right)\\
	\text{	Now, }\quad \frac{\partial V}{\partial x}&=0 \quad \Rightarrow 6 x+2 y=0 \quad \Rightarrow y=-3 x\\
	\frac{\partial V}{\partial y}&=0 \quad \Rightarrow 6 y+2 x=0 \quad \Rightarrow y=\frac{-x}{3}\\
	\frac{\partial V}{\partial z}&=0 \quad \Rightarrow z=0\\
	\text{Now, }\quad \frac{\partial^{2} V}{\partial x^{2}}&=3 m \omega^{2}>0 \text{for all $x$}\\
	\frac{\partial^{2} V}{\partial y^{2}}&=3 m \omega^{2}>0\text{ for all $y$}\\
	\text{and }\frac{\partial^{2} V}{\partial z^{2}}&=4>0\text{ for all $z$}
	\intertext{All these conditions tell us that equilibrium point is $(0,0,0)$, because $y=-3 x=-\frac{x}{3}$ satisfies only $x=y=0$ So, the given potential is in the form of expansion about $(0,0,0)$ and the matrix $V_{i j}$ can be written just by inspection.}
	V &=\frac{1}{2} m \omega^{2}\left(3 x^{2}+3 y^{2}+2 z^{2}+2 x y\right) \\ &=\frac{1}{2} m \omega^{2}\left[\begin{array}{lll}x & y & z\end{array}\right]\left[\begin{array}{lll}3 & 1 & 0 \\ 1 & 3 & 0 \\ 0 & 0 & 2\end{array}\right]\left[\begin{array}{l}x \\ y \\ z\end{array}\right]\\
	\text{		because}\quad
	&V=\frac{1}{2}\left(3 m \omega^{2} x^{2}+3 m \omega^{2} y^{2}+2 m \omega^{2} z^{2}+m \omega^{2} x y+m \omega^{2} y x\right) \\
	\text{or,}\quad&V=\frac{1}{2}\left(V_{11} x^{2}+V_{22} y^{2}+V_{33} z^{2}+V_{12} x y+V_{21} y x\right)\\
	\text{	Kinetic energy }T&=\frac{1}{2} m\left(\dot{x}^{2}+\dot{y}^{2}+\dot{z}^{2}\right)=\frac{1}{2}\left[\begin{array}{lll}\dot{x} & \dot{y} & \dot{z}\end{array}\right]\left[\begin{array}{lll}m & 0 & 0 \\ 0 & m & 0 \\ 0 & 0 & m\end{array}\right]\left[\begin{array}{l}\dot{x} \\ \dot{y} \\ \dot{z}\end{array}\right]\\
	\text{Now,}
	\left|\mathbf{V}-\Omega^{2} \mathbf{T}\right|&=0\quad \text{where $\Omega$ is normal mode freuency.}\\
	\Rightarrow \quad&\left|\begin{array}{ccc}3 m \omega^{2}-\Omega^{2} m & m \omega^{2} & 0 \\ m \omega^{2} & 3 m \omega^{2}-\Omega^{2} m & 0 \\ 0 & 0 & 2 m \omega^{2}-\Omega^{2} m\end{array}\right|=0\\
	\Rightarrow \quad\left(2 \omega^{2}-\Omega^{2}\right)&\left[\left(3 \omega^{2}-\Omega^{2}\right)^{2}-\omega^{4}\right]=0 \quad \Rightarrow \Omega_{1}^{2}=2 \omega^{2}\\
	\text{	and }\quad \Omega^{2}&=3 \omega^{2} \pm \omega^{2} \quad \Rightarrow \Omega_{2}^{2}=2 \omega^{2}\text{ and }\Omega_{3}^{2}=4 \omega^{2}
	\intertext{So, the frequencies are $\omega \sqrt{2}, \omega \sqrt{2}$ and $2 \omega$}
	\intertext{	Note that frequencies are always positive, hence we shouldn't write $\Omega_{1}=\pm \omega \sqrt{2}$ etc.}
	\end{align*}
\end{answer}
\item  The Lagrangian of a system is given by $L=\frac{1}{2} m \dot{q}_{1}^{2}+2 m \dot{q}_{2}^{2}-k\left(\frac{5}{4} q_{1}^{2}+2 q_{2}^{2}-2 q_{1} q_{2}\right)$ where $m$ and $k$ are positive constants. The frequencies of its normal modes are
\begin{tasks}(2)
	\task[\textbf{a.}]$\sqrt{\frac{k}{2 m}}, \sqrt{\frac{3 k}{m}}$
	\task[\textbf{b.}]$\sqrt{\frac{k}{2 m}}(13 \pm \sqrt{73})$
	\task[\textbf{c.}]$\sqrt{\frac{5 k}{2 m}}, \sqrt{\frac{k}{m}}$
	\task[\textbf{d.}]  $\sqrt{\frac{k}{2 m}}, \sqrt{\frac{6 k}{m}}$
\end{tasks}
\begin{answer}
	\begin{align*}
	L &=\frac{1}{2} m \dot{q}_{1}^{2}+2 m \dot{q}_{2}^{2}-k\left(\frac{5}{4} q_{1}^{2}+2 q_{2}^{2}-2 q_{1} q_{2}\right) \\ &=\frac{1}{2} m \dot{q}_{1}^{2}+\frac{1}{2} 4 m \dot{q}_{2}^{2}-\frac{1}{2} k\left(\frac{5}{2} q_{1}^{2}+4 q_{2}^{2}-4 q_{1} q_{2}\right) \\ \hat{T} &=\left(\begin{array}{cc}m & 0 \\ 0 & 4 m\end{array}\right), \hat{V}=\left(\begin{array}{cc}\frac{5}{2} k & -2 k \\ -2 k & 4 k\end{array}\right)
	\intertext{For frequencies of normal modes:}
	\operatorname{det}\left|\omega^{2} \hat{T}-\hat{V}\right|&=0\\
	\left|\begin{array}{cc}\left(m \omega^{2}-\frac{5}{2} k\right) & 2 k \\ 2 k & \left(4 m \omega^{2}-4 k\right)\end{array}\right|&=0 \Rightarrow 4\left(m \omega^{2}-k\right) \frac{\left(2 m \omega^{2}-5 k\right)}{2}-4 k^{2}=0\\
	\Rightarrow 2 m^{2} \omega^{4}+5 k^{2}-7 k m \omega^{2}-2 k^{2}&=0\\
	\Rightarrow 2\left(m \omega^{2}\right)^{2}-7 k\left(m \omega^{2}\right)+3 k^{2}&=0\\
	\Rightarrow m \omega^{2}&=\frac{7 k \pm \sqrt{49 k^{2}-24 k^{2}}}{4}=\frac{7 k \pm \sqrt{49 k^{2}-24 k^{2}}}{4}\\&=\frac{7 k \pm 5 k}{4}=3 k, \frac{k}{2}\\
	\therefore \omega&=\sqrt{\frac{3 k}{m}}, \sqrt{\frac{k}{2 m}}
	\end{align*}
	Correct answer is option \textbf{(a)}
\end{answer}
\item Consider two masses m connected to each other and two walls by two springs as shown in figure.The three springs have the same sping constant k.If $x_1$ ,$x_2$ are generalized coordinates and displacement from mean position.\\
\begin{figure}[H]
	\centering
	\includegraphics[height=3cm,width=5cm]{problem2}
\end{figure}
(a)Write down lagrangian of the system\\
(b)Write down equation of motion\\
(c)Write down secular equation and solve it for normal frequency.
\begin{answer}
	\begin{align*}
	&\text { (a) } L=\frac{1}{2} m \dot{x}_{1}^{2}+\frac{1}{2} m \dot{x}_{2}^{2}-\frac{1}{2} k x_{1}^{2}-\frac{1}{2} k\left(x_{2}-x_{1}\right)^{2}-\frac{1}{2} k x_{2}^{2}\\
	&\text { (b) } \frac{d}{d t}\left(\frac{\partial L}{\partial \dot{x}_{1}}\right)-\left(\frac{\partial L}{\partial x_{1}}\right)=0 \Rightarrow m \ddot{x}_{1}+k x_{1}-k\left(x_{2}-x_{1}\right)=0\\
	&\frac{d}{d t}\left(\frac{\partial L^{*}}{\partial \dot{x}_{2}}\right)-\left(\frac{\partial L}{\partial x_{2}}\right)=0 \Rightarrow m \ddot{x}_{2}+k x_{2}+k\left(x_{2}-x_{1}\right)=0 \Rightarrow m \ddot{x}_{2}+k x_{2}+k\left(x_{2}-x_{1}\right)\\
	&\text { (c) } L=\frac{1}{2} m \dot{x}_{1}^{2}+\frac{1}{2} m \dot{x}_{2}^{2}-\frac{1}{2} k x_{1}^{2}-\frac{1}{2} k\left(x_{2}-x_{1}\right)^{2}-\frac{1}{2} k x_{2}^{2}\\
	&T=\frac{1}{2} m \dot{x}_{1}^{2}+\frac{1}{2} m \dot{x}_{2}^{2}\\
	&T=\left(\begin{array}{ll}
	m & 0 \\
	0 & m
	\end{array}\right)\\
	&V=\frac{1}{2} k x_{1}^{2}+\frac{1}{2} k\left(x_{2}-x_{1}\right)^{2}+\frac{1}{2} k x_{2}^{2}\\
	&V=\frac{1}{2} k x_{1}^{2}+\frac{1}{2} k\left(x_{2}^{2}+x_{1}^{2}-2 x_{1} x_{2}\right)+\frac{1}{2} k x_{2}^{2}\\
	&V=\frac{1}{2} k x_{1}^{2}+\frac{1}{2} k\left(x_{2}^{2}+x_{1}^{2}-x_{1} x_{2}-x_{2} x_{1}\right)+\frac{1}{2} k x_{2}^{2}\\
	&=k x_{1}^{2}+k x_{2}^{2}+\frac{1}{2} k\left(-x_{1} x_{2}-x_{2} x_{1}\right)=\left(\begin{array}{cc}
	2 k & -k \\
	-k & 2 k
	\end{array}\right)\\
	&\text { The secular equation is given by }\\
	&\left[V-\omega^{2} T\right]=0, \quad\left(\begin{array}{cc}
	2 k-\omega^{2} m & -k \\
	-k & 2 k-\omega^{2} m
	\end{array}\right)=0\\
	&\left(2 k-\omega^{2} m\right)^{2}-k^{2}=0, \omega_{1}=\sqrt{\frac{k}{m}},\text{ which is normal frequency for oscillation and another value of}\\ &\omega_{2}=\sqrt{\frac{3 k}{m}} \text{which is first over-tone.}
	\end{align*}
\end{answer}
\item Two identical particle of masses m are constrained to move on a horizontal loop .Two identical spring with constant k connected the mass and wrap around the loop.If $x_1$ and $x_2$ are displacements of first mass and second mass from equilibrium point.\\
\begin{figure}[H]
	\centering
	\includegraphics[height=4cm,width=5cm]{problem 3}
\end{figure}
(a)Write down lagrangian of the system \\
(b)Write down equation of motion\\
(c)Write down secular equation and solve it for normal frquency
\begin{answer}
	\begin{align*}
	&\text {(a) } l=\frac{1}{2} m x_{1}^{2}+\frac{1}{2} m \dot{x}_{2}^{2}-\left(\frac{1}{2} k\left(x_{2}-x_{1}\right)^{2}+\frac{1}{2} k\left(x_{1}-x_{2}\right)^{2}\right)\\
	&\text { (b) } \frac{d}{d t}\left(\frac{\partial L}{\partial \dot{x}_{1}}\right)-\left(\frac{\partial L}{\partial x_{1}}\right)=0 \Rightarrow m \ddot{x}_{1}+2 \dot{k}\left(x_{1}-x_{2}\right)=0\\
	&\frac{d}{d t}\left(\frac{\partial L}{\partial x_{2}}\right)-\left(\frac{\partial L}{\partial x_{2}}\right)=0 \Rightarrow m \ddot{x}_{2}+2 k\left(x_{2}-x_{1}\right)=0\\
	&\text { (c) } L=\frac{1}{2} m \dot{x}_{1}^{2}+\frac{1}{2} m \dot{x}_{2}^{2}-\left(\frac{1}{2} k\left(x_{2}-x_{1}\right)^{2}+\frac{1}{2} k\left(x_{1}-x_{2}\right)^{2}\right)\\
	&T=\frac{1}{2} m \dot{x}_{1}^{2}+\frac{1}{2} m \dot{x}_{2}^{2} \Rightarrow T=\left(\begin{array}{cc}
	m & 0 \\
	0 & m
	\end{array}\right)\\
	&I(x)=\left(\frac{1}{2} k\left(x_{2}-x_{1}\right)^{2}+\frac{1}{2} k\left(x_{1}-x_{2}\right)^{2}\right)=\frac{1}{2} k\left(2 x_{1}^{2}+2 x_{2}^{2}-4 x_{1} x_{2}\right)\\
	&V=\left(\begin{array}{cc}
	2 k & -2 k \\
	-2 k & 2 k
	\end{array}\right)\\
	&\left[V-\omega^{2} T\right]=0\\
	&\left(\begin{array}{cc}
	2 k-\omega^{2} m & -2 k \\
	-2 k & 2 k-\omega^{2} m
	\end{array}\right)=0\\
	&\left(2 k-\omega^{2} m\right)^{2}-(2 k)^{2}=0\\
	&\left(\left(2 k-\omega^{2} m\right)+2 k\right)\left(\left(2 k-\omega^{2} m\right)-2 k\right)=0\\
	&\omega=\sqrt{\frac{4 k}{m l}} \text{is normal frequency corresponding to oscillation and} \omega=0 \text{corresponding
		to translation motion.}
	\end{align*}
\end{answer}
\end{enumerate}

Classical Mechanics  -CSIR/chapter/small oscillations.tex


\section{Developing Libraries with HOL4}\label{sec:libraries}

In the previous section we have looked at a first, self-contained, example of a
HOL4 proof.
To prove the closed form of the gaussian sum, we only needed to define a function
and perform a straight-forward proof by induction.
However, in larger developments it is common to split proofs into smaller
lemmas that are used as part of a central, final theorem\footnote{This is similar to how one would never write larger programs within the \texttt{main} function. It is desirable to split up functionality into programs instead}.

In this section we describe how larger developments are performed with HOL4 by
showing the theorem that there is an infinite number of prime numbers, called
euclid's theorem.

\subsection{Preamble}
Before starting a development in HOL4, it is recommended to declare dependencies
and load theorems that come with the HOL4 theorem prover.
We do so by running

\begin{lstlisting}
open BasicProvers Defn HolKernel Parse Conv SatisfySimps Tactic monadsyntax
     boolTheory bossLib arithmeticTheory;

open LassieLib arithTacticsLib;

val _ = new_theory "euclid";
\end{lstlisting}

The first \lstinline{open} loads a bunch of theories and tactics from the HOL4
git repository, whereas the second loads Lassie and the natural language
descriptions required for the proofs that we will perform.
The third line, tells HOL4 that we start a new theory, called ``euclid''.
In HOL4 speak, this is the analogous to defining an interface in Java, or a
header file in C.
All definitions and theorems are explicitly part of the interface of a theory.
To prevent errors, the file in which we store the theory has to be called
\lstinline{euclidScript.sml}.
If this correspondance between the file name and theory name is ignored,
HOL4 will fail to build the theory later.
As in the previous section, we recommend implementing file \lstinline{euclidScript.sml}
in the directory \texttt{\$LASSIEDIR/examples}.
We load the jargon with \lstinline{val _ = LassieLib.loadJargon "Arithmetic";}.

\subsection{Basic Definitions}
Our overall goal is to prove the HOL4 equivalent of the informal statement that
``there is an infinite number of prime numbers''.
The first concept that we need to define is thus what it means for a (natural)
number to be a prime number.

A number $n$ is called a prime number if it is only divisible by $1$ and $n$
itself. Thus, we first define a predicate \lstinline{divides} where
\lstinline{a divides b} if and only if \lstinline{b} can be expressed as a
multiple of \lstinline{a}:

\begin{lstlisting}
set_fixity "divides" (Infix(NONASSOC, 450));

Definition divides_def:
  (a divides b) = (? x. b = a * x)
End
\end{lstlisting}
The first line declares \lstinline{divides} as a new infix operator, like $+,-, \ldots$
Next, the \lstinline{Definition}, \lstinline{End} block defines \lstinline{divides} as a
binary infix relation where \lstinline{a divides b} is true, if and only if
there is an \lstinline{x} such that \lstinline{b} is the result of multiplying \lstinline{a} with \lstinline{x}.

Alternatively, we could have defined \lstinline{divides} as a function instead
of an infix operation, as we did in \autoref{sec:hol_ex1}.
Using it as an infix operation however makes it more obvious which number is
divided by which.

Having defined \lstinline{divides} we use it to define a predicate
\lstinline{prime} which is true, if its argument is a prime number.
\begin{lstlisting}
Definition prime_def:
  prime p = (p<>1 /\ !x . x divides p ==> (x=1) \/ (x=p))
End
\end{lstlisting}

The left-hand side of the conjunction (\lstinline{p <> 1}) explicitly excludes
number 1 from being a prime number, and the right-hand side states the HOL4
version of \lstinline{p} being prime if it can only be divided by $1$ and itself.

\subsection{Proving Infrastructural Lemmas}

Before proving euclid's theorem itself, we start by proving some infrastructural
lemmas that will come in handy later.
\begin{lstlisting}

Theorem DIVIDES_0:
  ! x . x divides 0
Proof
  nltac `[divides_def, MULT_CLAUSES] solves the goal.`
QED

Theorem DIVIDES_ZERO:
  ! x . (0 divides x) = (x = 0)
Proof
  nltac `[divides_def, MULT_CLAUSES] solves the goal.`
QED

Theorem DIVIDES_ONE:
  ! x . (x divides 1) = (x = 1)
Proof
  nltac `[divides_def, MULT_CLAUSES, MULT_EQ_1] solves the goal.`
QED

Theorem DIVIDES_REFL:
  ! x . x divides x
Proof
  nltac `[divides_def, MULT_CLAUSES] solves the goal.`
QED

Theorem DIVIDES_TRANS:
  ! a b c . a divides b /\ b divides c ==> a divides c
Proof
  nltac `[divides_def, MULT_ASSOC] solves the goal.`
QED
\end{lstlisting}

Theorems \lstinline{DIVIDES_0, DIVIDES_ZERO}, and \lstinline{DIVIDES_ONE} show
simple base cases for predicate \lstinline{divides}.
As these follow straight-forwardly from the definition, the Lassie proof is just
\lstinline{nltac `[divides_def, MULT_CLAUSES] solves the goal.`}, resp.
\lstinline{nltac `[divides_def, MULT_CLAUSES, MULT_EQ_-1] solves the goal.`}.

Similarly, one proves theorems about the relation between $+, *$ and $\leq$ and
\lstinline{divides}:
\begin{lstlisting}

Theorem DIVIDES_ADD:
  ! d a b . d divides a /\ d divides b ==> d divides (a + b)
Proof
  nltac `[divides_def, LEFT_ADD_DISTRIB] solves the goal.`
QED

Theorem DIVIDES_SUB:
  !d a b . d divides a /\ d divides b ==> d divides (a - b)
Proof
  nltac `[divides_def, LEFT_SUB_DISTRIB] solves the goal.`
QED

Theorem DIVIDES_ADDL:
  !d a b . d divides a /\ d divides (a + b) ==> d divides b
Proof
  nltac `[ADD_SUB, ADD_SYM, DIVIDES_SUB] solves the goal.`
QED

Theorem DIVIDES_LMUL:
  !d a x . d divides a ==> d divides (x * a)
Proof
  nltac `[divides_def, MULT_ASSOC, MULT_SYM] solves the goal.`
QED

Theorem DIVIDES_RMUL:
  !d a x . d divides a ==> d divides (a * x)
Proof
  nltac `[MULT_SYM,DIVIDES_LMUL] solves the goal.`
QED

Theorem DIVIDES_LE:
  !m n . m divides n ==> m <= n \/ (n = 0)
Proof
  nltac `rewrite [divides_def]. [] solves the goal.`
QED
\end{lstlisting}

\subsection{Euclid's Theorem}
Having defined prime numbers, and after proving simple properties of
\lstinline{divides}, we next state euclid's theorem and start
exploring its proof.

\begin{lstlisting}
Theorem euclid:
  !n . ?p . n < p /\ prime p
Proof

QED
\end{lstlisting}

After starting the interactive proof with \ekey{M-h g}, we can start exploring
it with Lassie.
The textbook version of the proof is done by contradiction, so we perform the
same step in HOL4: \lstinline{nltac `suppose not.`}.
After running the tactic with \ekey{M-h e} the REPL shows the following goal state:
%
\begin{lstlisting}[frame=single, mathescape=true]
> OK..
1 subgoal:
val it =

    0.  $\exists$ n. $\forall$ p. n < p $\rightarrow$ $\neg$prime p
   ------------------------------------
        F

   : proof
\end{lstlisting}

The first assumption starts with an existential quantifier, from which we can
obtain the witness. Therefore we next call into the simplifier to automatically
take care of this with \lstinline{nltac `simplify.`} leaving us with
%
\begin{lstlisting}[frame=single, mathescape=true]
> > > > > # # OK..
1 subgoal:
val it =

    0.  $\forall$ p. n < p $\rightarrow$ $\neg$prime p
   ------------------------------------
        F

   : proof
\end{lstlisting}

The assumption now tells us that any natural number $p$ which is greater than
$n$ cannot be prime.
On a high level, the goal is to derive a contradiction from this assumption by
finding a prime number that is bigger than $n$.
An integral part of this step is that every natural number greater than $1$ has
a prime factorization\footnote{We have to exclude $1$ here because our definition of prime numbers explicitly ruled out $1$.}.
Before continuing the proof, we prove a theorem that for an arbitrary natural
number $n$, there is a prime factor of that number.
To this end we first drop the current goal with \ekey{M-h d} and start proving:
%
\begin{lstlisting}
Theorem PRIME_FACTOR:
  !n . n <> 1 ==> ?p . prime p /\ p divides n
Proof
  LassieLib.nltac `
    Complete Induction on 'n'.
    rewrite [].
    perform a case split for 'prime n'.
    Goal 1. follows from [DIVIDES_REFL]. End.
    Goal 1.
      show '? x. x divides n and x <> 1 and x <> n' using (follows from [prime_def]).
      follows from [LESS_OR_EQ, PRIME_2, DIVIDES_LE, DIVIDES_TRANS, DIVIDES_0].
    End.`
\end{lstlisting}

The theorem can be immediately loaded by running \ekey{M-h M-r} over the complete
text.
However, we recommend stepping through the \lstinline{nltac} steps one-by-one
with \ekey{M-h e} after starting an interactive proof with \ekey{M-h g}.

One particular thing to note here is that this is the first proof that
explicitly mentions subgoals in Lassie.
After performing a case split on whether $n$ is prime or not
(\lstinline{perform a case split for 'prime n'.}) HOL4 leaves us with two
subgoals to prove:

\begin{lstlisting}[frame=single]
> OK..
2 subgoals:
val it =

    0.  $\forall$ m. m < n $\rightarrow$ m $\neq$ 1 $\rightarrow$ $\exists$ p. prime p $\wedge$ p divides m
    1.  n $\neq$ 1
    2.  $\neg$ prime n
   ------------------------------------
        $\exists$ p. prime p $\wedge$ p divides n

    0.  $\forall$ m. m < n $\rightarrow$ m $\neq$ 1 $\rightarrow$ $\exists$ p. prime p $\wedge$ p divides m
    1.  n $\neq$ 1
    2.  prime n
   ------------------------------------
        $\exists$ p. prime p $\wedge$ p divides n

2 subgoals
   : proof
\end{lstlisting}

Here, the first subgoal ($\exists \texttt{p}. \texttt{prime p} \wedge \texttt{p divides n}$)
is solved first, with the natural language command \lstinline{Goal 1}.
Alternatively, we can say that we want to prove first the goal where \texttt{prime n} holds with
\lstinline{Goal 'prime n'}.

Having shown the theorem \lstinline{PRIME_FACTOR} we can go back to proving
Euclid's theorem:
\begin{lstlisting}
Theorem euclid:
  !n . ?p . n < p /\ prime p
Proof
  nltac `suppose not. simplify.`
QED
\end{lstlisting}

As a next step, we will obtain a prime factor of $n! + 1$, called $q$.
From this we know that $q$ is prime and \lstinline{q divides FACT n + 1}.
As $q$ is a prime number, we can derive that $q \leq n$.
We obtain a contradiction by deriving that $q = 1$ from the fact that any number
smaller than $n$ is a divisor of $!n$, and theorem \lstinline{DIVIDES_ADDL}.
The full proofscript becomes:
\begin{lstlisting}[mathescape=true]
nltac `
  suppose not. simplify.
  we can derive 'FACT n + 1 <> 1' from [FACT_LESS, neq_zero].
  thus PRIME_FACTOR for 'FACT n + 1'.
  we further know '?q. prime q and q divides (FACT n + 1)'.
  show 'q <= n' using [NOT_LESS_EQUAL].
  show '0 < q' using [PRIME_POS] .
  show 'q divides FACT n' using [DIVIDES_FACT].
  show 'q=1' using [DIVIDES_ADDL, DIVIDES_ONE].
  show 'prime 1' using (simplify).
  [NOT_PRIME_1] solves the goal.`
\end{lstlisting}

We recommend stepping through each step one by one and observing the changes to
the proof.

After finishing the proof the theory development is ended by putting
\lstinline{val _ = export_theory();} at the end of the file.
This directive tells HOL4 to export the defined functions and proven theorems
into a file \texttt{euclidTheory.sml} which can be used by future developments.
The file \texttt{euclidTheory.sig} gives an overview of the included theorems and
definitions in a human readable format.
%%% Local Variables:
%%% mode: latex
%%% TeX-master: "lassie-tutorial"
%%% End:


\documentclass[a4paper,12pt]{article}
\usepackage{amsmath, amssymb, amsthm}
\usepackage{mathtools}
\usepackage{tabulary}
\usepackage{multirow}

\usepackage{polyglossia}

\title{Project Euler - Problem 6}
\date{}
\author{DestructHub}

\begin{document}

\maketitle

\section {Statement}

The sum of the squares of the first ten natural numbers is

$$ 1^2 + 2^2 + \ldots + 10^2 = 385 $$

The square of the sum of the first ten natural numbers is,

$$ (1 + 2 + \ldots + 10)^2 = 55^2 = 3025 $$

Hence the difference between the sum of the squares of the first ten natural
numbers and the square of the sum is $$ 3025 - 385 = 2640$$.

Find the difference between the sum of the squares of the first one hundred
natural numbers and the square of the sum.

\section{Solution}

We can use two simple formulae:

\begin{align*}
  1+2+\ldots+n &= \frac{n(n+1)}{2}\\
  1^2+2^2+\ldots+n^2 &= \frac{n(n+1)(2n+1)}{6}
\end{align*}

(They can be easily proved by Induction.)

Now it is a matter of simple calculations:

$$\left(\frac{n(n+1)}{2})^2\right) - \frac{n(n+1)(2n+1)}{6} = 5050^2-338350 = 25164150$$

\end{document}

%%% Compile with lualatex

%%% Local Variables:
%%% mode: latex
%%% coding: utf-8-unix
%%% fill-column: 80
%%% End:


\documentclass[11pt,a4paper]{report}
\usepackage{amsmath,amsfonts,amssymb,amsthm,epsfig,epstopdf,titling,url,array}
\usepackage{enumitem}
\usepackage{changepage}
\usepackage{graphicx}
\usepackage{caption}
\theoremstyle{plain}
\newtheorem{thm}{Theorem}[section]
\newtheorem{lem}[thm]{Lemma}
\newtheorem{prop}[thm]{Proposition}
\newtheorem*{cor}{Corollary}
\theoremstyle{definition}
\newtheorem{defn}{Definition}[section]
\newtheorem{conj}{Conjecture}[section]
\newtheorem{exmp}{Example}[section]
\newtheorem{exercise}{Exercise}[section]
\theoremstyle{remark}
\newtheorem*{rem}{Remark}
\newtheorem*{note}{Note}
\def\changemargin#1#2{\list{}{\rightmargin#2\leftmargin#1}\item[]}
\let\endchangemargin=\endlist
\begin{document}

\section*{Socks}
Every morning when he wakes up, Moe reaches into his sock drawer and randomly picks two socks to wear. Each sock in the drawer has only one partner - i.e., he does not have multiple copies of any pair.
\begin{enumerate}[label=(\alph*)]
\item If there are two pairs of socks in the drawer, what is the probability that his random grab results in a pair?
\item Let $n$ be the number of pairs of socks in the drawer.  Find a formula for $p(n)$ = the probability that 2 randomly chosen socks from among the $2n$ in the drawer match.
\end{enumerate}
\section*{Bonus}
\begin{enumerate}[label=(\alph*)]\addtocounter{enumi}{2}
\item Moe's coworkers get tired of seeing Moe come in with mismatched socks all the time, so they decide to buy him a second pair exactly like each pair that he has. So now he has $2n$ pairs of socks (so a total of $4n$ socks) and each sock now has three possible matches.  What is the formula for $p(n)$ under this assumption?
\item Moe's teammates are pleased with the results of the sock augmentation, but they find that most days Moe's socks still don't match.  Joe claims that if they just double down on the strategy of buying more rounds of copies of the original $n$ pairs, they will eventually reach the point where most days Moe's socks will match and in fact for any $p < 1$, there is a number of rounds after which the probability of a match each day is at least $p.$  Is Joe right?
\end{enumerate}

\newpage
\section*{Solution (part a)}
Give a total of 4 socks in the drawer, there are ${4 \choose 2} = 6$ 2-sock combinations that Moe can pull out. (Imagine you can tell all socks apart. When selecting two of them, Moe has 4 choices for the first one times 3 for the second, assuming the order is significant.  The order is not significant,  so you need to divide by the number of ways the two socks can be ordered, which is 2, so you get $({4 \times 3})/2 = 6$.  This is how the general formula for ${n \choose k} =$ the number of $k$ element subsets that can be selected from an $n$-element set is derived.)  Among these 6 combinations, 2 of them are pairs. Since all combinations are equally likely, the probability of Moe selecting a pair is $2/6 = 1/3.$

\section*{Solution (part b)}
Given $n$ pairs, there are $2n$ total socks to choose from, so there are ${2n \choose 2} = \frac{2n(2n - 1)}{2} = n(2n - 1)$ possible two-sock combinations that Moe can grab.  Since $n$ of these are pairs and all are again equally likely, it follows that $$p(n) = \frac{n}{n(2n - 1)} = 1 / (2n - 1).$$

\section*{Solution (part c)}
Now Moe has $4n$ total socks, so there are ${4n \choose 2} = \frac{4n(4n - 1)}{2}$ possible 2-sock combinations.  Now each of the $n$ duplicated pairs creates ${4 \choose 2} = 6$ good combinations.  So the probability of a match is now $\frac{6n}{\frac{4n(4n - 1)}{2}} = \frac{3}{4n - 1}.$

\section*{Solution (part d)}
Joe is wrong. As the number of copies increases, probability of a match will increase, but it is bounded above by $1/n.$  This is easy to see using a simpler approach to parts a-c. Once Moe has selected one sock, the probability that he will end with a match equals the probability that his next selection is from the same pair. So for example in part c, that probability is (number of socks of the same kind) / (total number of remaining socks) $= 3/(4n-1)$.  So if $k$ is the number of copies, the probability of a match is $(2k - 1) / (2kn - 1).$

\end{document}


\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{tikz}
\setlength{\parindent}{0pt}

\newtheorem*{theorem}{Theorem}
\newtheorem*{definition}{Definition}
\newtheorem*{lemma}{Lemma}
\newtheorem*{corollary}{Corollary}
\newtheorem{example}{Example}
\newtheorem*{trick}{Trick}
\newtheorem*{question}{Question}

\title{Lecture 9: Max-Min and Least Squares}
\author{}
\date{}

\begin{document}

\maketitle

\section{Application of Partial Derivatives: Optimization Problem}

\subsection{Max-Min}

Optimization problems refer to the tasks of finding the maximum or minimum point
of a function. Here we focus on finding the maximum or minimum point of
multivariable functions, such as $f(x, y)$.

Another concept is local max/min point, which means the function value of this
point is greater/less than the function values of adjacent points, but it is not
necessarily the greatest or leaast function value in the function domain.

\begin{theorem}
  If a point in a function $f$ is a local max/min point, then all of the partial
  derivatives at this point are equal to 0.

  Proof: \\
  We will prove it by contradiction. Suppose there is a local max/min point in a
  function $f(x_1, x_2, ..., x_n)$, and one of its partial derivative
  $\frac{\partial f}{\partial x_i}$ is not 0. According to the definition of
  partial derivatives, in that direction the function values of the two adjacent
  point are
  \begin{gather*}
    f(x_1, x_2, ..., x_i + \Delta x_i, ..., x_n) = f(x_1, x_2, ..., x_n) + \frac{\partial f}{\partial x_i} \Delta x_i \\
    f(x_1, x_2, ..., x_i - \Delta x_i, ..., x_n) = f(x_1, x_2, ..., x_n) - \frac{\partial f}{\partial x_i} \Delta x_i \\
  \end{gather*}
  Therefore, one of them is less than the local max/min point and the other is
  greater than the local max/min point. Hence, it is not a local max/min point.
  There is a contradiction.

  Therefore, it is proved that if a point in a function $f$ is a local max/min
  point, then all of the partial derivatives at this point are equal to 0.
\end{theorem}

Therefore, A point is a local max/min point \\
$\Rightarrow$ All partial derivatives at that point are 0 \\
$\iff$ The tangent plane at that point is horizontal \\
$\iff$ The point is a critical point.

\subsection{Critical Points}

\begin{definition}
  A point is a critical point of a function $f$ if and only if all the partial
  derivatives on this point are equal to 0.
\end{definition}
For a multivariable function with two independent variables $f(x, y)$, a point
$(x_0, y_0)$ is a critical point if
$\frac{\partial f}{\partial x}(x_0, y_0) = 0$ and
$\frac{\partial f}{\partial y}(x_0, y_0) = 0$.

\begin{example}
  Find all the critical points of the function
  $f(x, y) = x^2 - 2xy + 3y^2 + 2x - 2y$.

  Solution: \\
  \begin{gather*}
    \frac{\partial f}{\partial x} = 2x - 2y + 2 \\
    \frac{\partial f}{\partial y} = -2x + 6y - 2 \\
  \end{gather*}
  For critical points, they should satisfy
  \begin{equation*}
    \begin{cases}
      \frac{\partial f}{\partial x} = 2x - 2y + 2 = 0 \\
      \frac{\partial f}{\partial y} = -2x + 6y - 2 = 0 \\
    \end{cases} \\
  \end{equation*}
  Solving this linear system, the result is $(-1, 0)$. Therefore, there are only
  one critical point for this function, which is $(-1, 0)$.
\end{example}

\subsection{Types of Critical Points}

A critical point of a function $f$ can be
\begin{itemize}
  \item local maximum point
  \item local minimum point
  \item saddle point: a point on the surface of the graph of a function where
    the slopes in orthogonal directions are all zero, but not a local extremum
    of the function.
\end{itemize}

\begin{question}
  Is there any other possibilities for a critical point of a multivariable
  function? If not, how to prove it?

  Answer: No, there is not. According to the definition of saddle points, all
  critical points that are not local max or min points are classified as saddle
  points.

  The point here is that saddle points can be many different forms. Examples:
  \begin{itemize}
    \item The point $(0, 0)$ on the graph of the function $z = x^2 - y^2$.
    \item The point $(0, 0)$ on the graph of the function $z = x^2 + y^3$.
  \end{itemize}
\end{question}

How to determine the type of a critical point?
\begin{itemize}
  \item Test the second derivative (cover in the next lecture).
  \item Find the codomain of the function and compare the function value on the
  critical point with the codomain.
\end{itemize}

\begin{example}
  Find the type of the critical point $(-1, 0)$ of the function
  $f(x, y) = x^2 - 2xy + 3y^2 + 2x - 2y$.

  Solution: \\
  The function value of the critical point $(-1, 0)$ is
  \begin{equation*}
    \begin{split}
      f(-1, 0) &= (-1)^2 - 2 \times (-1) \times 0 + 3 \times 0^2 + 2 \times (-1) - 2 \times 0 \\
               &= 1 - 2 \\
               &= -1 \\
    \end{split}
  \end{equation*}
  To find the codomain of the function, we can transform its formula
  \begin{equation*}
    \begin{split}
      f(x, y) &= x^2 - 2xy + 3y^2 + 2x - 2y \\
              &= (x - y)^2 + 2y^2 + 2x - 2y \\
              &= ((x - y)^2 + 2(x - y) + 1) + 2y^2 - 1 \\
              &= (x - y + 1)^2 + 2y^2 - 1 \\
    \end{split}
  \end{equation*}
  Therefore, it is apparent that the codomain of the function is $[-1, \infty]$.
  Hence, the critical point $(-1, 0)$ is the minimum point of the function.
\end{example}

\section{Example of Optimization Problems: Least Squares}

Given a series of discrete points $(x_1, y_1)$, $(x_2, y_2)$, ..., $(x_n, y_n)$,
find the "best fit" line $y = ax + b$.

The task is to find the best values of $a$ and $b$ in the line equation
$y = ax + b$.

We can define a distance function about the line equation $y = ax + b$, and find
proper values of $a$ and $b$ to minimize the distance function, in other words,
find the minimum point $(a_0, b_0)$.

\bigskip

One way to define the distance function about the line equation $y = ax + b$ is
to use the total square deviation, where deviation means the vertical distance
between an actual point and the line $y = ax + b$, described by the formula
$y_i - (ax_i + b)$. This method is called \textbf{least squares}.

Therefore, the distance function is
\begin{gather*}
  \begin{split}
    D &= (y_1 - ax_1 - b)^2 + (y_2 - ax_2 - b)^2 + ... + (y_n - ax_n - b)^2 \\
      &= \sum_{i=1}^{n}(y_i - ax_i - b)^2 \\
  \end{split} \\
  \frac{\partial D}{\partial a} = \sum_{i=1}^{n}-2x_i(y_i - ax_i - b) \\
  \frac{\partial D}{\partial b} = \sum_{i=1}^{n}-2(y_i - ax_i - b) \\
\end{gather*}

To find the minimum point, we need to solve the following system of equations:
\begin{gather*}
  \begin{cases}
    \frac{\partial D}{\partial a} = \sum_{i=1}^{n}-2x_i(y_i - ax_i - b) = 0 \\
    \frac{\partial D}{\partial b} = \sum_{i=1}^{n}-2(y_i - ax_i - b) = 0 \\
  \end{cases} \\
\end{gather*}
which is a linear system of $a$ and $b$. After simplified, it becomes
\begin{gather*}
  \begin{cases}
    (\sum_{i=1}^{n}x_i^2)a + (\sum_{i=1}^{n}x_i)b = \sum_{i=1}^{n}x_iy_i \\
    (\sum_{i=1}^{n}x_i)a + nb = \sum_{i=1}^{n}y_i \\
  \end{cases}
\end{gather*}
Therefore, we can solve the linear system to get the critical points of the
distance function, and hence get the minimum point $(a_0, b_0)$.

\bigskip

The least squares method can be more general. First of all, it can be used to
approximate any polynomial functions, since the deviation is a linear function
of unknown parameters. For example,
\begin{gather*}
  y = ax^2 + bx + c \\
  d_i = y_i - ax_i^2 - bx_i - c \\
\end{gather*}
Second, for other functions, we can try to transform it into polynomial
functions. A typical example is exponential functions:
\begin{gather*}
  y = ce^{ax} \\
  \ln y = ax + \ln c \\
  d_i = \ln y_i - ax_i - \ln c \\
\end{gather*}

\end{document}


% !TEX root = as_grf_sopt.tex

\newcommand{\cG}{\mathcal{G}}
\newcommand{\cH}{\mathcal{H}}
\newcommand{\bv}{\mathbf{v}}
%\newcommand{\bk}{\mathbf{k}}
%\newcommand{\bK}{\mathbf{K}}
\newcommand{\bc}{\mathbf{c}}
\newcommand{\bff}{\mathbf{f}}
\newcommand{\bSigma}{\boldsymbol{\Sigma}}
\newcommand{\bomega}{\boldsymbol{\omega}}

The database where active search is performed is given as a graph $\cG$ with known structure (edge connections). The edge connections are nonnegative and we use $\bA$ to represent the adjacency matrix of $\cG$, such that $A_{ij}\geq0, \forall i,j$. Let
$\mathcal{V}=\{v_1,\dotsc,v_n\}$ denote the set of all nodes in $\cG$.
From $\bA$ we can derive a graph Laplacian matrix,
$\cLap = \bD - \bA$,
where $\bD=\diag(\bA\cdot\mathbf{1})=\diag(\deg(v_1),\dotsc,\deg(v_n))$.
%A normalized Laplacian is defined to be $
%\widetilde{\cLap} = \bD^{-\frac{1}{2}} \cLap \bD^{-\frac{1}{2}}
%= \bI - \bD^{-\frac{1}{2}} \bA \bD^{-\frac{1}{2}} .
%$

Every node $v$ in our graph holds one reward value
we denote as $f(v)$, indicating whether the node is the search target. The reward is unknown at first and can be revealed only when it is queried explicitly. For mathematical benefits, we relax the reward to be a real value and introduce a Gaussian noise to its observation, as
\begin{equation}
	y(v)=f(v)+\epsilon, \;{\rm where}\; \epsilon\sim\mathcal{N}(0,\sigma_n^2).
	\label{eq:observation}
\end{equation}

Similar to bandit problems, querying a node also means collecting the true reward of that node.
Our goal is to design a query strategy,
which interactively generates a query sequence $\bv_t = (v_1,\dotsc,v_t)^\top$ without any repeated selections, in order
to maximize the cumulative reward
\begin{equation}
	F_T = \sum_{t=1}^T f(v_t).
\end{equation}

The cumulative reward is always upper-bounded by the optimal strategy with full knowledge of the true rewards on all the nodes. Let $\bv^*_t=(v^*_1,\dotsc,v^*_t)$ to be the optimal query sequence (without repeated selections),
our analysis in Theorem~\ref{thm:as_regret} (Section~\ref{sec:regret}) bounds the cumulative regret between our strategy and the optimal strategy,
\begin{equation}
	R_T = \sum_{t=1}^T f(v^*_t) - f(v_t).
\end{equation}

The above characterizes an active search problem, provided that the values of $f(v)$ are binary and the sequences $\bv_t$ and $\bv_t^*$ do not allow repeated selections.
Otherwise,
the above can also model a multi-armed bandit problem
if we relax $f(v)$ to be real and $\bv_t$ and $\bv_t^*$ to allow repeated selections.
In fact, our formulation discusses them together, providing analysis to the slightly more rigorous active search modeling except that $f(v)$ is relaxed to real values.

% the cumulative reward (or regret), provided that the values of $f(v)$ are binary, resemble active search recalls of the positives (or its sub-optimality in this objective). Also, particular to our active search application, the sequences $\bv_t$ and $\bv_t^*$ do not allow duplicated selections.
% Except for these two differences, $F_T$ and $R_T$ are the same as  in ordinary bandit problems.

In our notations, bold letters indicate vectors or matrices, while light letters without subscripts mean functions and light letters with subscripts represent scalars or specific elements. $t$, $\tau$, and $T$ are time indices, which when applied as subscripts, always mean the selection or model at that time step. Other letters as subscripts, such as $i,j,n$, always mean the natural indices. %In case of confusions, brackets and superscripts are applied to time indices.

\subsection{GAUSSIAN RANDOM FIELD PRIOR}
A key assumption in this work is that the reward values, or the target labels, are constrained
by the graph structure in a non-trivial way. Otherwise,
the input graph provides little information about the reward function, making active search
extremely difficult. More specifically,
we assume that the reward values of all the nodes in the graph,
collectively denoted as a vector
$\bff\in\mathbb{R}^N$, are random variables distributed jointly as
%are generated with respect to the graph adjacency matrix, in that there is always a bigger probability for connected nodes to share similar values, as
\begin{align}
	 \log
	p(\bff)
	% &\propto
	& \simeq
	% \exp\mathopen{}\left(
		-\sum_{i=1}^N\sum_{j=1}^N \frac{A_{ij}(f_i-f_j)^2}{2} -   \sum_{j=1}^N  \frac{\omega_0 (f_j-\mu_0)^2}{2}
	% \right)
	,
	\nonumber
	\\
	\mbox{i.e., }\;
	\bff &\sim \mathcal{N}\mathopen{}\left(
		\bmu_0 = \mu_0\cdot\bone,\;
		\bC_0 = \left(\cLap + \omega_0 \bI\right)^{-1}
	\right),
	\label{eq:generative}
\end{align}
where %is the vector concatenation of the reward values of all the nodes in the graph,
$\mu_0$ is a prior mean,
and
$\omega_0 > 0$ is a regularization parameter.
According to this probabilistic model, it is more likely for connected nodes to share similar values than not.
Define the initial covariance matrix as, $\bC_0 = \left(\cLap + \omega_0 I\right)^{-1}$, and denote $\widetilde{\cLap}_0=\cLap+\omega_0\bI$.
The above prior model is also known as \textbf{Gaussian random fields (GRFs)}.
%Equivalently, we can replace $\cLap$ with $\widetilde{\cLap}$ to assume the generation model, \eqref{eq:generative}, from a normalized graph Laplacian.%
%\todo{many things break.}

%%%%%%%%%%
\subsection{POSTERIOR INFERENCE}

Assume the nature draws one sample from the prior model, \eqref{eq:generative}, and we use query observations, \eqref{eq:observation}, to converge to that particular draw
by performing posterior inference conditioned on the history,
\begin{equation*}
	\cH_t = \{(v_\tau, y_\tau)\}_{\tau=1}^t
	= \{\bv_t, \by_t\},
\end{equation*}
which allows us to update the posterior distribution as,
\begin{equation*}
	\log p(\bff\mid\mathcal{H}_t) \simeq
	 - \frac{1}{2}(\bff-\bmu_0)^\top \widetilde{\cLap}_0 (\bff-\bmu_0)
	- \sum_{\tau=1}^t \frac{(y_\tau-f_{v_\tau})^2}{2\sigma_n^2}.
\end{equation*}
Notice that the prior distribution and likelihood model form Gaussian conjugate pairs. Denote the posterior distribution as,
$
\bff \mid \cH_t \sim \mathcal{N}(\bmu_t, \bC_t).
$
To some readers, it is easier to express $\bmu_t$ and $\bC_t$ using the prior \emph{precision} matrix, as
\begin{equation}
	\bmu_t = \bC_t
	\Bigl(\widetilde{\cLap}_0\bmu_0 +  \sum_{\tau=1}^t \frac{y_\tau \be_{v_\tau} }{\sigma_n^2}\Bigr),
	\,\,\;
	\bC_t^{-1} = \widetilde{\cLap}_0 + \frac{1}{\sigma_n^2}\mathbf{H}_t
	\label{eq:post_prec}
\end{equation}
where $\be_{v_\tau}=(0,\dotsc,0,1,0,\dotsc,0)^\top$ is an indicator vector of index $v_\tau$ and $\mathbf{H}_t$
% ={\rm diag}\bigl(\mathbf{h}_t=\sum_{\tau=1}^t \be_{v_\tau}\bigr)\in\mathbb{R}^{n\times n}$
is a diagonal matrix of index counts from $\bv_t$, whose $k$th diagonal element is $\sum_{\tau=1}^t e_{v_\tau}(v_k)$.

However, for convenience in later descriptions and to connect to \textbf{ Gaussian Process (GP) } literature \citep{gpml}, we also use the prior \emph{covariance} matrix to express the posterior distribution, as,
\begin{align}
	\begin{split}
		&\mu_t(v) = \mu_0(v) + \bc_{\bv_t v}^\top (\bC_{\bv_t\bv_t} + \sigma_n^2 \bI)^{-1} (\by_t - \bmu_{\bv_t}),
		\\
		&\! C_t(v,v') = C_0(v,v') - \bc_{\bv_t v}^\top (\bC_{\bv_t\bv_t} + \sigma_n^2 \bI)^{-1} \bc_{\bv_t v'},
	\end{split}
		\label{eq:var_update}
	% &\mu_t(v) = \mu_0(v) + \bc_{\bv_t v}^\top (\bC_{\bv_t\bv_t} + \sigma_n^2 \bI)^{-1} (\by_t - \bmu_{\bv_t}),
	% \label{eq:mean_update}
	% \\
	% &\! C_t(v,v') = C_0(v,v') - \bc_{\bv_t v}^\top (\bC_{\bv_t\bv_t} + \sigma_n^2 \bI)^{-1} \bc_{\bv_t v'},
	% \label{eq:var_update}
\end{align}
where the matrices can all be defined in terms of the prior:
\begin{align*}
	\bc_{\bv_t v} &= (C_0(v_1,v) ,\cdots, C_0(v_t,v))^\top\\
	\bC_{\bv_t \bv_t} &= \bigl( C_0(v_\tau,v_{\tau'}) \bigr)_{\tau,\tau'=1}^t \\
	\bmu_{\bv_t} &= (\mu_0(v_1),\cdots, \mu_0(v_t))^\top.
\end{align*}

The above update rules also applies to any time interval that starts with $t_0$, by replacing prior models (variables with subscript ``$0$'') with the model at time $t_0$.

Define simple notations for correlation coefficients and standard deviations from the covariance matrix,
$
	C_t(v,v') = \rho_t(v,v')\sigma_t(v)\sigma_t(v'),
$
which implies that $\sigma_t^2(v) = C_t(v,v)$.
Define $\bc_t(v)$ to be the column of $\bC_t$ corresponding to node $v$.

%\subsection{Connection to Spectral Bandits}
%
%\cite{valko2014spectral} gave another interpretation they called spectral bandits. This interpretation uses spectral decomposition of graph Laplacian, $\cLap$, and works in the eigen-space. We will show that the inference rules are fundamentally similar to what we described above, which establishes connections to conventional linear bandit problems.
%
%Let eigen-decomposition of the graph Laplacian to be,
%$\cLap=\bQ\bLam_\cLap \bQ^\top$,
%where
%$\bQ = \begin{pmatrix} \bx_1,\dotsc,\bx_n\end{pmatrix}^\top$
% is an orthogonal matrix and
%$\bLam$
%is the diagonal concatenation of eigen-values of $\cLap$,
% such that
%% \begin{equation}
%$	\bC_0(v,v') = \bx_v^\top \left( \bLam_\cLap + \omega_0 \bI\right)^{-1} \bx_{v'}.
%$
%%	\label{eq:eigen}
%%\end{equation}
%Define $\bLam_0 = \bLam_\cLap + \omega_0\bI$. Notice that $\bx_j$s are not eigen-vectors, but rather defined for notation simplicity. Nonetheless, $\{\bx_j\in\mathbb{R}^n : j=1,\dotsc,n\}$ are still orthogonal.
%
%
%With the spectral approach, a true loading vector, $\balpha\in\mathbb{R}^n$, is generated with prior, $ \balpha\sim\mathcal{N}(0, \bLam_0^{-1})$. This is equivalent to $\bff = \bQ \balpha$ and $f(v) = \bx_v^\top \balpha$ with our prior.
%
%The observations are still on the nodes, as
%$
%y(v) = \bx_v^\top \balpha + \epsilon, \epsilon\sim\mathcal{N}(0, \sigma_n^2).
%$
%With history $\cH_t=\{\bv_t, \by_t\}$, the posterior becomes,
%%
%%\begin{align*}
%$	\balpha_t \sim \mathcal{N}(\bm_t, \bLam_t^{-1}),
%$
%with
%$	 \bLam_t = \frac{1}{\sigma_n^2}\bX_t^\top \bX_t + \bLam_0,
%$
%$	\bm_t = \frac{1}{\sigma_n^2} \bLam_t^{-1}\bX_t^\top \by_t,
%$
%%\end{align*}
%where
%$\bX_t=\begin{pmatrix}\bx_{v_1},\dotsc,\bx_{v_n}\end{pmatrix}^\top$
%and
%$\by_t = \begin{pmatrix}y_1,\dotsc, y_t\end{pmatrix}^\top$.
%
%The posterior inference is also consistent with our \textsc{grf} model,
%by trivial applications of Schur complement to verify that
%$
%	\bQ \bLam_t^{-1} \bQ^\top
%	= \bC_t
%$
%and
%$	\bQ\bm_t
%	=
%	\bmu_t.
%$
% (Appendix~\ref{app:sec:spectral_equivalence}).


\paragraph{Skewness} indicates asymmetry. There are 3 cases:
\begin{enumerate}[noitemsep,nolistsep]
  \item $sk = 0$ the sample is symmetric
  \item $sk > 0$ the sample is heavier on the right
  \item $sk < 0$ the sample is heavier on the left
\end{enumerate}

\noindent The direction of inequality symbol points where the tail is.

\paragraph{Kurtosis} or so-called ``peakedness''.


% -*- root: Main.tex -*-
\section{SVD}
$\mathbf{A} = \mathbf{U} \mathbf{D} \mathbf{V}^\top = \sum_{k=1}^{\operatorname{rank}(\mathbf{A})} d_{k,k} u_k (v_k)^\top$\\
$\mathbf{A} \in \mathbb{R}^{N \times P}, \mathbf{U} \in \mathbb{R}^{N \times N}, \mathbf{D} \in \mathbb{R}^{N \times P}, \mathbf{V} \in \mathbb{R}^{P \times P}$\\
$\mathbf{U}^\top \mathbf{U} = I = \mathbf{V}^\top \mathbf{V}$ ($\mathbf{U}, \mathbf{V}$orthonormal)\\
$\mathbf{U}$ columns are eigenvectors of $\mathbf{A} \mathbf{A}^\top$, $\mathbf{V}$ columns are eigenvectors of $\mathbf{A}^\top \mathbf{A}$, $\mathbf{D}$ diagonal elements are singular values.\\
$(\mathbf{D}^{-1})_{i,i} = \frac{1}{\mathbf{D}_{i, i}}$ (don't forget to transpose)

\begin{inparaenum}[\color{red}1.]
	\item calc $\mathbf{A}^\top \mathbf{A}$.
	\item calc EVs of $\mathbf{A}^\top \mathbf{A}$, the $\sqrt{}$ in desc. order are diag. of $\mathbf{D}$.
	\item calc eigenvecs of $\mathbf{A}^\top \mathbf{A}$ using EVs resulting in cols of $\mathbf{V}$.
    \item calc missing matrix: $\mathbf{U} = \mathbf{A} \mathbf{V} \mathbf{D}^{-1}$
	\item normalize each col of $\mathbf{U}$ and $\mathbf{V}$.
\end{inparaenum}

Nb nonzero singular vals = rank(A). First r cols of U basis of C(A), last n - r cols of V basis of N(A).
$\lambda_i = \sigma_i^2$ for square symmetric matrix A.
SVD construction: $v_i = arg max_w ||Bw|| = \sigma_i $, s.t. $||w|| = 1$, $u_i = \frac{1}{\sigma_i} B_i v_i$. $B_0 = A, B_{i+1} = B_i - \sigma_i u_i v_i^T$

\subsection*{Low-Rank approximation}
Using only $K$ largest eigenvalues and corresponding eigenvectors. $\tilde{\mathbf{A}}_{i, j} = \sum_{k=1}^K \mathbf{U}_{i, k} \mathbf{D}_{k,k} \mathbf{V}_{j, k} = \sum_{k=1}^K \mathbf{U}_{i, k} \mathbf{D}_{k,k} (\mathbf{V}^\top)_{k, j}$.

\subsection*{Eckart-Young Theorem}
$\min_{rank(B)=K} ||A-B||_F^2 = ||A-A_k||_F^2 = \sum_{r=k+1}^{rank(A)} \sigma_r^2$
$\min_{rank(B)=K} ||A-B||_2 = ||A-A_k||_2 = \sigma_{k+1}$


\section{Numerical integrations}
\label{iso_section:numerical_integration}
\paragraph{}
When computing the coefficient matrix (Eq.~\ref{lr_eq:sbfem_coe_matrix}) in SBFEM , numerical integrations tends to be overwhelmingly preferred over the mathematical deduction.
The reason behind lies in the flexibility of the numerical method and that deduction of exact integrations scheme to any given shape functions may not be feasible.
Due to the fact that the polynomials are adopted as the shape function, the numerical integration methods such as Legendre Quadrature or Gauss Quadrature provides possibility for an exact integration numerically.
An integration quadrature is normally defined as followed:
    \begin{equation}
        \int_{-1}^{1}
        f(x)dx
        = \sum_{i=1}^n
        a_i f(x_i)
    \label{iso_eq:numerical_integration}
    \end{equation}
%
The integration of any targeted polynomial function defined on $[-1,1]$ can be explicitly expressed as series.
A set of integration points $\left\{ x_1, x_2, \dots, x_n \right\} \in \left[-1,1\right]$ and the corresponding weight $\left\{ a_1, a_2, \dots, a_n \right\} \in \mathbb{R}$ determined from the integration quadrature can be adopted to perform an exact integration on the given function.
\paragraph{}
Although shape functions used in NURBS are not polynomials, they can be separated into several spans within which the basis functions are rational polynomials.
Based on this property, the numerical integration quadrature on each of these spans can be applied to achieve a reasonably accurate result.
In other words, the NURBS curve with a knot vector of
$[
    \underbrace{-1,-1,\dots,-1}_{p+1},
    u_0,\dots,u_n,
    \underbrace{1,1,\dots,1 }_{p+1}
]$
can be integrated as
\begin{equation}
    \int_{-1}^{1} R(u) du = \int_{-1}^{u_0} R(u)du +
                            \int_{u_0}^{u_1} R(u)du + \dots +
                            \int_{u_n}^1 R(u)du
\label{iso_eq:numerical_integration_piecewise}
\end{equation}
%
Since the rational polynomials instead of the non-rational ones are utilized as the shape functions in the NURBS, the difference between the outputs from Eq.~\ref{iso_eq:numerical_integration_piecewise} and the analytical solution will be so large that can not be regarded as machine error.
Based on Eq.~\ref{iso_eq:rational_basis_function} we can conclude that the basis functions constructed by rational polynomials become non-rational if and only if the weight vector is identical i.e. $\left\{ w \right\} = \left[ 1,1,\dots,1 \right]$ after normalization.
That indicates the error of numerical integration will be decreased when the weight vector of the NURBS curve becomes more uniform as the basis functions are more close to the non-rational polynomials.
In order to achieve this target, the knot insertion or the order elevation introduced in Section~\ref{lr_sec:nurbs_knot_ins} and Section~\ref{lr_sec:nurbs_order_ele} can be used.


\subsection{Differentiable transition maps}

\subsubsection{Transition map recap}

Given two charts with an overlap, we have a transition mapping between the two charts of the overlap, where the mapping corresponds to a position on the manifold.

\subsubsection{Differentiable transition maps}

If this mapping is differentiable, we have a differentiable manifold.

\subsubsection{Smooth manifolds}

If transition maps are smooth (\(C^\infty \)) then the manifold is smooth.


\section{Quantum gases}
Grand canonical ensemble.
Second quantization. $\ket{n_1,n_2,\ldots}$.

Upper sign is for bosons,
lower sign is for fermions.
The grand potential is
\begin{align}
    \Omega &= \pm gk_B T V
    \int \frac{d^3k}{(2\pi)^3}
    \ln \left[
    1 \mp e^{-\beta\left(
    \frac{\hbar^2 k^2}{2M} - \mu
    \right)}
    \right]
\end{align}
and then the number density is
\begin{align}
    \frac{N}{V} &= - \frac{1}{V}\left.\frac{\partial \Omega}{\partial
    \mu}\right|_{T,V}\\
    &=
    g \int \frac{d^3k}{(2\pi)^3}
    \frac{1}{e^{\beta\left( E_k - \mu \right) \mp 1}}
\end{align}
and the energy density is
\begin{align}
    \frac{E}{V} &=
    \frac{\Omega - TS - \mu N}{V}\\
    &=
    g \int\frac{d^3 k}{(2\pi)^3}
    \frac{E_k}{e^{\beta\left( E_k - \mu \right)} \mp 1}
\end{align}

We don't know what the chemical potential is if I give you a box of atoms.
More likely you know the density and energy.

I adjust $\mu$ and I know the temperature.
I can then get a particular values of $N$ for a particular $T$ I know.
Then I get $\mu$ to compute the temperature nd anything you want.

There is no instrument I can stick in a bottle and measure the chemical
potential.
Maybe there is but it's not practical.

I need to go through this dance of fixing this and tuning $\mU$ to get the
property density.
If I have this integral calculated,
I will do this once and I'm done.
But I can't.
So I compute the integral numerically find the value of $\mu$.

Maybe I should put it in the homework so you do it once in your life.

I do this to approximate and make the physics explicit.
To be sincere,
it is a stupid tradition that I know no computers and I have to do everything
with pen and paper.
It's not completely meaningless to do this because it does bring up some physics.

Let's pretend we do not own computes and extract things with pen and paper.
The first thing I want to consider is the classical limit.
The classical limit may surprise you,
because you think it's getting $\hbar\to 0$,
but that's fake situation,
not even God can change $\hbar$,
because it's a creation of the human mind.
If I use a unit system where $\hbar=1$,
it's gone.
So the classical limit is actually when
\begin{align}
    e^{\beta\mu} \ll 1
\end{align}
How can this be small?
Certainly possible because it's an exponential.

It's necessary that $\mu$ is negative,
very negative.
That is,
\begin{align}
    - \mu \gg k_B T
\end{align}
So then $\mu$ has to be very negative and in magnitude much larger than
$k_BT$.
I claim this is the classical limit,
because it recovers the good old results you recover in kindergarten.

Let's look at the occupation number
\begin{align}
    n(k) &=
    \frac{1}{e^{\beta\left( E_k - \mu \right) \mp 1}}
\end{align}
This exponential is always a positive number,
so some people call this quantity
$z = e^{\beta \mu}$,
called a very poetic name,
the fugacity,
the property of being temporary,
something that goes away very quickly.
I have no idea where it's used in any other circumstances.

Richard: I used to hear geochemists use that term often about the exchange of
oxygen and CO2.

If I consider the limit where the fugacity is small,
no matter what $e$ is,
this is going to be much larger than 1,
and I can neglect this $\mp 1$,
and so approximately,
\begin{align}
    n(k) &=
    \frac{1}{e^{\beta\left( E_k - \mu \right) \mp 1}}\\
    &\approx
    e^{-\beta E_k} e^{\beta \mu}
\end{align}
and this is classical.
You see a Boltzmann factor appear here,
so it's beginning to look lie a classical gas.
And Siri is giving me a band called fugacity.
Why is the band called fugacity?
That's an optional question in the homework.

I can then do this approximation inside of the integral.
\begin{align}
    \frac{N}{V} &=
    g \int \frac{d^3k}{(2\pi)^3}
    e^{-\beta \frac{\hbar^2 k^2}{2m}} e^{\beta\mu}
\end{align}
which is a Gaussian integral you've been doing the whole semester,
and if I'm not mistaken.
\begin{align}
    \int \frac{d^3k}{(2\pi)^3}
    e^{-\beta \frac{\hbar^2 k^2}{2m}}
    &=
    \frac{1}{8\pi^2}
    \left( \frac{2mk_B T}{\hbar^2} \right)^{3/2}
    =
\end{align}
which you could check out by dimension analysis.
I wrote it in this particular way because it has a name
Here $\lambda_T$ is the thermal length,
\begin{align}
    \frac{1}{\lambda_T^2}
    =
    \frac{2mk_B T}{\hbar^2}
\end{align}
which different books may define differently up to factors of $2\pi$.

Serious people wrote papers about how to do dimensional analysis to work out
factors of $2\pi$ in particle physics.
Completely insane.
$2\pi$ is a big number, like 6,
so if you miss it you get the number completely wrong.
It's not a science,
it's an art,
looking at integrals,
squinting and extracting powers of $2\pi$.
It's dark magic, but we're not going to do that,
just compute the integral.
\begin{align}
    \frac{N}{V} &=
    g e^{\beta N} \frac{1}{\lambda_T^3}
\end{align}

One thing I know here,
if I work in the regime of small fugacity,
This is going to be small.
Small compared to what?

Then we compute the free energy
\begin{align}
    F &= \Omega + \mu N\\
    &=
    \pm k_B T V
    \int \frac{d^3k}{(2\pi)^3}
    \ln\left[
    1 \mp e^{-\beta \left( E_k - \mu \right)}
    \right]
\end{align}

Story about the astronaut pen.

\begin{question}
    What would I google to dabble the dark arts of $2\pi$?
\end{question}
Places you shouldn't.
There's an actual paper called counting powers of $2\pi$.
It's not general,
only a very particular context on particle physics.
It's based on the absurd statement that the number of $\pi$'s on the left and
right have to match.
It's hilarious,
because open the textbook and find an exception to this rule.
It's an irrational number.

Anyway, then I have to do this approximation.
Look at the log.
\begin{align}
    F &\approx
    k_B T N + \mu` N
\end{align}
but which term is larger in magnitude?
$\mu$ of course.
So my energy is just
\begin{align}
    F &= N\mu
\end{align}
But what is $\mu$?
Well I can extract it from $N/V$.
\begin{align}
    F &=
    N\ln \left( \frac{N}{V} \frac{\lambda_T^3}{g} \right) \frac{1}{\beta}
\end{align}
That's what I promised before.
Explicitly then I get that.
Writing the thermal wavelength the way it's supposed to be,
I get
\begin{align}
    F & k_B T N
    \ln\left(
    \frac{V}{N} \left( k_B T \right)^{3/2} \cdots
    \right)
\end{align}
which is what you derived before the hard way.
What's cool about this,
is that you don't have to stick the fudge factor of $N!$.

The fact we got $N$ here in the quantum derivation means we really need the $N!$
in the classical case.
Track down the $N!$ in the classical case derivation in our homework,
and you will find it will not match if you don't have the $N!$.

We had that fudge factor for 2 months for no good reason,
but finally we have a good reason for it.
\begin{question}
What's the physical interpretation of the thermal length.
\end{question}
If I have a particle in a gas,
the de Broglie wavelength is the thermal wavelength.
QM,
every particle you can think of as a wave,
and the wavelength of that wave is the wavelength of a typical particle.

The approximation was that the fugacity $z=e^{\beta N}\ll 1$,
but that's the same thing as saying the density times the thermal volume,
which is the de Broglie wavelength cubed is very small
\begin{align}
    \frac{N}{V} \lambda_T^3 \ll 1
\end{align}
and that is what I mean by a dilute gas.
What I'm saying is that to have a classical gas,
the de Broglie wavelength of a particle has to be a lot smaller than that.
If you think about it that's how quantum mechanics works.
If you have a particle moving along obstacles this big,
it's like rays.
But if you have wavelengths similar to distances,
it's behaving like waves.

Te complicated integral isn't that visible,
and the trivial thing is not.

By the way,
this is typically how you calculate the free energy,
you typically have to solve for $\mu$ from the formula for the density $N/V$.

It's a little too fast to say high temperature is classical because $T$ is
larger than $\mu$,
because not really,
because $\mu$ can also increase with $T$.

It's more useful to say that you want $z=e^{\beta N}$ to be large.
You want high density and low temperature.

You want the temperature to be large,
but large compared to what.
There's nothing large to compare against.
So you compare the thermal wavelength with the density.
That's the only thing that make sense.
There are classical gases that are not that hot,
as long as the density is smaller.

It's only the relation.

The direction is right.
Cold and dense things are quantum mechanical.
That's why every day at the physics department,
you get a truck with liquid nitrogen,
because no one wants to do high temperature.
Unless you do plasma physics,
and you live your life in classical physics.


% Chapter 2

\chapter{Background} % Main chapter title
\newcommand{\Mset}[2]{\ensuremath{\mathbb{M}_{#1 \times #2}}}
\newcommand{\reff}[1][e]{\ensuremath{R_#1^{\text{eff}}}}
\label{Chapter2} % For referencing the chapter elsewhere, use \ref{Chapter2}

%----------------------------------------------------------------------------------------
% \section{Markov Chains}
%
% \subsection{Fundamental theorem of Markov chain}
%
% \subsection{Markov chain tree theorem}

To make the exposition self contained I have chosen the results which are relevant to understanding the Harvey, Xu algorithm. Most of these results are taken from \citet{TCS-054}

\section{Preliminary Linear Algebra}

\begin{Bf}
 If $A$ is a $n \times n$ real symmetric matrix, then all it's eigenvalues are real.
\end{Bf}

\begin{Bf}[Eigenvectors of different eigenvalues are orthogonal]
 Let $\lambda_i$ and $\lambda_j$ be two eigenvalues of a symmetric matrix $A$ and $\textbf{u}_i, \textbf{u}_j$ be it's corresponding eigenvectors. If $\lambda_i \neq \lambda_j$ then $\langle \textbf{u}_i, \textbf{u}_j \rangle = 0$
\end{Bf}

\begin{Bf}[Min-Max Characterizations of Eigenvalues]
 If $A$ is a $n \times n$ real symmetric matrix, then the largest eigenvalue of $A$ is

 $$ \lambda_n(A) = \max_{v \in \mathbb{R}^n \setminus \{0\}} \frac{v^T A v}{v^Tv}$$

 $$ \lambda_1(A) = \min_{v \in \mathbb{R}^n \setminus \{0\}} \frac{v^T A v}{v^Tv}$$
\end{Bf}

% https://tex.stackexchange.com/questions/128508/a-new-line-inside-subscript

\begin{Bf}[Courant-Weyl-Fisher min-max principle]
 \[ \lambda_k(A) = \min_{\substack{v \in \mathbb{R}^n \setminus \{0\}\\ v^Tu_i = 0 \ \forall i \in \{1, \dots , k-1\}}} \frac{v^T A v}{v^Tv} \]

 \[ \lambda_k(A) = \max_{\substack{v \in \mathbb{R}^n \setminus \{0\}\\ v^Tu_i = 0 \ \forall i \in \{1, \dots , k-1\}}} \frac{v^T A v}{v^Tv} \]
\end{Bf}

\begin{Bf}[Positive Semi Definite]
 A matrix $A$ is said to be positive semi definite (PSD) if $\lambda_1(A) \geq 0$ . $A$ is said to be positive definite if $\lambda_1(A) > 0$
\end{Bf}

\section{Laplacian of a Graph}

\begin{Bd}[Laplacian]
 For an undirected unweighted graph $G = (V, E)$ the Laplacian $L_G$ is a $|V| \times |V|$ matrix defined as

  \[
    L_G(i, j) =
\begin{cases}
    -1& \text{if } (i, j) \ \in E\\
    deg(i)& \text{if } i = j\\
    0              & \text{otherwise}
\end{cases}
\]

It can also be seen that
$$L_G = D - A$$

where $D$ is a diagonal matrix with diagonal entries as degree of the corresponding vertex.

 \end{Bd}

 \begin{Bd}[Weighted Laplacian]
 For an undirected weighted graph $G = (V, E)$ and a weight function $\textbf{w}: E \rightarrow \mathbb{R}_{\geq 0}$ the Laplacian $L_G$ is a $|V| \times |V|$ matrix defined as

  \[
    L_G(i, j) =
\begin{cases}
    -w(i,j)& \text{if } (i, j) \ \in E\\
    \displaystyle\sum_{(i,v) \in E} w(i, v)& \text{if } i = j\\
    0              & \text{otherwise}
\end{cases}
\]

\end{Bd}

\subsection{Properties of Laplacian}

\begin{Bf}
 The Laplacian of a graph is PSD
\end{Bf}

\begin{Bf}
 ker($L$) = span(\textbf{1})
\end{Bf}

\begin{Bf}
 Let $L$ be the Laplacian of a graph $G= (V,E)$, then
 $$ \lambda_2(L) > 0 \iff G \text{ is connected}$$
\end{Bf}

\subsection{Kirchoff Matrix Tree Theorem}

\begin{Bf}
 The number of spanning trees in a graph $G$ is \textbf{det}($L_G[i]$) (for any $i$) where $L_G$ denotes the Laplacian of $G$ and $L_G[i]$ denotes the matrix with $i^{th}$ row and column removed.
\end{Bf}

\section{Electric Networks}

\subsection{Unweighted Graph}

\subsubsection{Incidence Matrix}

Given an undirected unweighted graph $G=(V,E)$ with arbitrary orientation of edges. Let $B \in  \Mset{n}{m}$ \footnote{I have used a transposed version compared to \citet{TCS-054} so that it's consistent with the notation used later} called the edge-vertex incidence matrix defined as

\[
    B(i, e) =
\begin{cases}
 1 & \text{if } i \text{ is tail of } e\\
 -1 & \text{if } i \text{ is head of } e \\
 0 & \text{otherwise}
\end{cases}
\]

\begin{Bf}
 For a graph $G$ with arbitrarily chosen incidence matrix $B$ and Laplacian $L$,
 $$B \cdot B^T = L$$
\end{Bf}

Given an unweighted graph $G = (V,E)$ we associate a electrical network by replacing each edge with a resistor with resistance $1 \ \Omega$. A current source is introduced in each vertex, denoted as $\textbf{c}_{\text{ext}} \in \mathbb{R}^n$. This induces a voltage at each vertex and current at each edge. Let's denote it as $\textbf{v} \in \mathbb{R}^n, \textbf{i} \in \mathbb{R}^m$

Let $i_{xy}$ denote the current from vertex $x$ to $y$ for edge $(x,y) \in E$. And $v_x$ denote the potential at a vertex $x \in V$.

\subsubsection{Kirchoff's current law}

Kirchoff's current law states that the algebraic sum of current into any vertex equals zero.

$$ B \cdot \textbf{i} = \textbf{c}_{\text{ext}} $$

\subsubsection{Ohm's law}
Ohm's law states that electric current through an edge is directly proportional to the potential different across an edge and inversely proportional to the resistance of the edge.

$$ i_{xy} = \frac{v_x - v_y}{r_{xy}} $$

Since the resistance in the unweighted graph is $1 \ \Omega$ we have

$$ \textbf{i} = B^T \cdot \textbf{v} $$

Combining Ohm's law and Kirchoff's law we get

$$ L \cdot \textbf{v} = \textbf{c}_{\text{ext}} $$

\subsubsection{Laplacian pseudoinverse}

\subsubsection{Effective Resistance}

Effective resistance across 2 vertices $x,y$ is the resistance between $x,y$ if we treat the graph as a single resistor connected between $x$ and $y$.

In our case we are mainly interested in the effective resistance across an edge $e = (x,y) \in E$.

\begin{Bd}
 Effective Resistance is the potential difference across an edge $e = (x,y)$ when $1A$ is inducted at $x$ and taken out at $y$. It is denoted as \reff
\end{Bd}

So we have $\textbf{c}_{\text{ext}} = e_x - e_y$ where $e_i$ denotes a vector with 1 in the $i^{th}$ index and 0 elsewhere. By definition of effective resistance we have

\begin{align*}
 \reff &= (e_x - e_y)^T \cdot \textbf{v} \\
 \reff &= (e_x - e_y)^T \cdot L^+  \cdot \textbf{c}_{\text{ext}} \\
 \reff &= (e_x - e_y)^T \cdot L^+  \cdot (e_x - e_y)
\end{align*}

\subsection{Weighted Graph}

There are a few subtle changes which needs to be incorporated for the weighted graph setting. Suppose $G=(V,E)$ be a undirected weighted graph with weight function $\textbf{w}: E \rightarrow \mathbb{R}_{\geq 0}$. Now the electric network of $G$ coressponds has edges replaced by a resistor with resistance $r_e = 1 / \textbf{w}(e) , \forall e \in E$. The intuition is that lower weight for an edge in graph $G$ means it's barely there hence it coressponds to higher resistance. And having no edge coressponds to infinite resistance.

For deriving the other relations let $W \in \Mset{m}{m}$ be a diagonal matrix such that $W(e,e) = \textbf{w}(e)$. Now $L = B \ W \ B^T$ and Ohm's law becomes $\textbf{i} = W \ B^T \ \textbf{v} $. As it can be seen the formula for effective resistance remains the same

\pagebreak

% https://tex.stackexchange.com/questions/57152/how-to-draw-graphs-in-latex

\subsection{An Example}
Consider the following weighted graph $G$ in \textbf{Figure 2.1}
\definecolor {processblue}{cmyk}{0,0,0,0}

% https://tex.stackexchange.com/questions/37581/latex-figures-side-by-side

\begin{figure}[h!]
\centering
\begin{subfigure}{.5\textwidth}
  \centering
%   \includegraphics[width=.4\linewidth]{image1}

\begin {tikzpicture}[auto ,node distance =4 cm and 5cm ,on grid ,
semithick ,
state/.style ={ circle ,top color =white , bottom color = processblue!20 ,
draw,black , text=black , minimum width =1 cm}]
\node[state] (C){$A$};
\node[state] (A) [above =of C] {$D$};
\node[state] (B) [above right =of C] {$C$};
\node[state] (D) [right =of C] {$B$};
\path (C) edge node[below] {$1$} (D);
\path (B) edge node[right] {$5$} (D);
\path (A) edge node[above] {$10$} (B);
\path (C) edge node[left] {$4$} (A);
\end{tikzpicture}

  \caption{The original graph $G$}
  \label{fig:sub1}
\end{subfigure}%
\begin{subfigure}{.5\textwidth}
  \centering
%   \includegraphics[width=.4\linewidth]{image1}

\begin{circuitikz}[american]
 \put(0,0){0};
 \draw (0, -2) to[short, -*, i=$1 A$] (0,0) node[left]{$A$};
 \draw (0,0) to[R, l=\mbox{$1 \  \Omega$}] (3,0) node[right]{$B$};
 \draw (0,0) to[R, l=$0.25 \ \Omega$] (0,3) node[left]{$D$};
 \draw (3,0) to[R, l=\mbox{$0.2 \ \Omega$}] (3,3) node[right]{$C$};
 % this works, but it has wrong spacing
 \draw (0,3) to[R, l=$0.1 \ \Omega$] (3,3);
 \draw (3, 0) to[short, *-, i=$1 A$] (3,-2);
 \draw (3, -2) to[isource, l=$1 A$] (0, -2);
 \end{circuitikz}

\caption{The electric network version of $G$}
  \label{fig:sub2}
\end{subfigure}
\caption{An example of a graph and it's corresponding electric network}
\label{fig:test}
\end{figure}

Following the convention such that current going inside a vertex as negative and out as positive.

By Ohm's law we have

\begin{align*}
i_{AD} &= 4  \, (v_A - v_D) \\
i_{DC} &= 10 \, (v_D - v_C) \\
i_{CB} &= 5  \, (v_C - v_B) \\
i_{AB} &= 1  \, (v_A - v_B)
\end{align*}

By Kirchoff's current law we have
\begin{align*}
 i_{AD} + i_{AB} &= 1 \\
 -i_{AD} + i_{DC} &= 0 \\
 -i_{DC} + i_{CB} &= 0 \\
 -i_{AB} - i_{CB} &= -1
\end{align*}

Now combining these two we get

\begin{align*}
 5v_A  - 1 v_B - 0 v_C - 1 v_D &= 1 \\
 -1v_A + 6 v_B - 5 v_C - 0 v_D &= -1 \\
 0v_A - 5v_B + 15 v_C - 10 v_D &= 0 \\
 -4v_A - 0v_B - 10v_C + 14v_D &= 0
\end{align*}

And this is exactly what we would have gotten using $L \cdot \textbf{v} = \textbf{c}_{\text{ext}}$

%----------------------------------------------------------------------------------------