\newpage

\appendix

\section{Cryptographic Assumptions}\label{app:assume}

Our constructions use the following assumptions.

\begin{assumption}[$q$-Strong Bilinear Diffie-Hellman]
	\label{asp::qSDH}
	For any probabilistic polynomial time (PPT) adversary $\mathcal{A}$, the following holds:

	\[\Pr\left[ \begin{aligned}
	&\mathsf{bp} \leftarrow \mathsf{BilGen}(1^\lambda) & \\
	&s \overset{R}{\leftarrow} \mathbb{Z}^{*}_{p} & : (x, e(g, g)^{\frac{1}{s+x}}) \leftarrow \mathcal{A}(1^\lambda, \sigma)\\
	&\sigma = (\mathsf{bp}, g^s, ..., g^{s^q})
	\end{aligned} \right] \le \negl{(\lambda)}\]
\end{assumption}

The second assumption is a generalization of the $q$-PKE assumption~\cite{groth2010short} to multivariate polynomials, proposed in~\cite{zhang2017vsql,zkvpd}. Let $\mathcal {W}_ {\ell,d}$ be the set of all multisets of $\{1, . . . , \ell\}$ with the cardinality of each element being at most $d$.

\begin{assumption}[$(d,\ell)$-Extended Power Knowledge of Exponent]
	\label{asp::dlEPKE}
	For any PPT adversary $\mathcal{A}$, there is a polynomial time algorithm $\mathcal{E}$ (takes the same randomness of $\mathcal{A}$ as input) such that for all benign auxiliary inputs $z \in \{0,1\}^{\poly({\lambda})}$ the following probability is negligible:
	{\footnotesize
	\[\Pr\left[ \begin{aligned}
	\mathsf{bp} \leftarrow \mathsf{BilGen}(1^\lambda) && \\
	s_1, ..., s_\ell, s_{\ell + 1}, \alpha \overset{R}{\leftarrow} Z_{p}^*, s_0=1 && \\
	\sigma_1 = (\{g^{\prod_{i\in W}s_i}\}_{W\in \mathcal{W}_{\ell, d}, g^{s_{\ell+1}}}) &&\hspace*{10pt} e(h, g^\alpha)=e(\tilde{h}, g)\\
	\sigma_2 = (\{g^{\alpha\prod_{i\in Ws_i}}\}_{W\in \mathcal{W}_{\ell, d}}, g^{\alpha s_{\ell+1}}) && : \prod_{W\in \mathcal{W}_{\ell, d}}g^{a_{W}\prod_{i\in W}s_i}g^{b{s_{\ell+1}}}\neq h\\
	\sigma = (\mathsf{bp}, \sigma_1, \sigma_2, g^{\alpha}) && \\
	\mathbb{G} \times \mathbb{G} \ni (h, \tilde{h}) \leftarrow \mathcal{A} \left(1^{\lambda}, \sigma, z\right)&& \\
	\left( a _ { 0 } , \dots , a _ { \left| \mathcal { W } _ { \ell , d } \right| } , b \right) \leftarrow \mathcal { E } \left( 1 ^ { \lambda } , \sigma , z \right) &&
	\end{aligned}\right] \le \negl{(\lambda)}\]
	}
\end{assumption}

\section{GKR protocol}\label{app:gkr}

%\begin{figure}[t!]
	\small{
		\centering{\centering
			\framebox{\parbox{.99\linewidth}{
					\begin{protocol}
						\label{protocol::GKR}
						Let $\mathbb{F}$ be a prime field. Let $C$: $\mathbb{F}^n\rightarrow \mathbb{F}^k$ be a $d$-depth layered arithmetic circuit. $\mathcal{P}$ wants to convince that $\mathsf{out}=C(\mathsf{in})$ where $\mathsf{in}$ is the input from $\V$, and $\mathsf{out}$ is the output. Without loss of generality, assume $n$ and $k$ are both powers of 2 and we can pad them if not.

						\begin{itemize}
							\item Define the multilinear extension of array $\mathsf{out}$ as $\tV_0$. $\V$ chooses a random $g \in \mathbb{F}^{s_0}$ and sends it to $\P$. Both parties compute $\tilde{V_0}(g)$.
							\item $\P$ and $\V$ run a sumcheck protocol on
							\[
							\tV_{0}(g^{(0)})=\sum_{x, y\in \binary^{s_{1}}}\tilde{mult}_{1}(g^{(0)}, x, y)(\tV_{1}(x)\tV_{1}(y))+\tilde{add}_{1}(g^{(0)},x,y)(\tV_{1}(x)+\tV_{1}(y))
							\]
							At the end of the protocol, $\V$ receives $\tV_1(u^{(1)})$ and $\tV_1(v^{(1)})$. $\V$ computes $\tmult_1(g^{(0)},u^{(1)},v^{(1)})$, $\tadd_1(g^{(0)},u^{(1)},v^{(1)})$ and checks that $\tmult_1(g^{(0)},u^{(1)},v^{(1)})\tV_1(u^{(1)})\tV_1(v^{(1)})+\tadd_1(g^{(0)},u^{(1)},v^{(1)})(\tV_1(u^{(1)})+\tV_1(v^{(1)}))$ equals to the last message of the sumcheck.

							\item For $i=1,...,d-1$:
							\begin{itemize}

								\item $\V$ randomly selects $\alpha^{(i)}, \beta^{(i)}\in\F$ and sends them to $\mathcal{P}$.
								\item $\P$ and $\V$ run the sumcheck on the equation\\

								$\alpha^{(i)}\dot{V}_i(u^{(i)})+\beta^{(i)}\dot{V}_i(v^{(i)})=$
								\begin{align*}
								\sum_{x, y\in \binary^{s_{i+1}}}&((\alpha^{(i)}\tilde{mult}_{i+1}(u^{(i)}, x, y)+\beta^{(i)}\tilde{mult}_{i+1}(v^{(i)}, x, y))(\tV_{i+1}(x)\tV_{i+1}(y))\\
								+&(\alpha^{(i)}\tilde{add}_{i+1}(u^{(i)}, x, y)+\beta^{(i)}\tilde{add}_{i+1}(v^{(i)}, x, y))(\tV_{i+1}(x)+\tV_{i+1}(y))\nonumber
								\end{align*}

								\item At the end of the sumcheck protocol, $\P$ sends $\V$ $\tV_{i+1}(u^{(i+1)})$ and $\tV_{i+1}(v^{(i+1)})$.

								\item $\V$ computes the following and checks if it equals to the last message of the sumcheck. For simplicity, let $Mult_{i+1}(x) = \tilde{mult}_{i+1}(x, u^{(i+1)}, v^{(i+1)})$ and $Add_{i+1}(x) = \tilde{add}_{i+1}(x, u^{(i+1)}, v^{(i+1)})$.
								\begin{align*}
								&(\alpha^{(i)}Mult_{i+1}(u^{(i)})+\beta^{(i)}Mult_{i+1}(v^{(i)})(\tV_{i+1}(u^{(i+1)})\tV_{i+1}(v^{(i+1)}))+\\
						        &(\alpha^{(i)}\tilde{Add}_{i+1}(u^{(i)})+\beta^{(i)}\tilde{Add}_{i+1}(v^{(i)})(\tV_{i+1}(u^{(i+1)})+\tV_{i+1}(v^{(i+1)}))
								\end{align*}
								If all checks in the sumcheck pass, $V$ uses $\tV_{i+1}(u^{(i+1)})$ and $\tV_{i+1}(v^{(i+1)})$ to proceed to the $(i+1)$-th layer. Otherwise, $\V$ outputs $\reject$ and aborts.

							\end{itemize}
							\item At the input layer $d$, $\V$ has two claims $\tV_{d}(u^{(d)})$ and $\tV_{d}(v^{(d)})$. $\V$ queries the oracle of evaluations of $\tV_d$ at $u^{(d)}$ and $v^{(d)}$ and checks that they are the same as the two claims. If yes, output $\accept$; otherwise, output $\reject$.

						\end{itemize}
	\end{protocol}}}}}
%\end{figure}

\section{Definition of zkVPD}\label{app:zkvpd}

\begin{definition}\label{def::zkvpd}
Let $\mathbb{F}$ be a finite field, $\mathcal{F}$ be a family of $\ell$-variate polynomial over $\mathbb{F}$, and $d$ be a variable-degree parameter. A zero-knowledge verifiable polynomial delegation scheme (zkVPD) consists of the following algorithms: $(\pp, \vp) \leftarrow \KeyGen(1^\lambda, \ell, d)$, $\comm \leftarrow \Commit(f, r_f, \pp)$, $\{\accept,\reject\}\leftarrow\CheckComm(\comm, \vp)$, $(y,\pi)\leftarrow\Open(f,t,r_f,\pp)$, $\{\accept,\reject\}\leftarrow\Verify(\comm,t,y,\pi,\vp)$, such that

\begin{itemize}
			\item \textbf{Perfect Completeness}
				For any polynomial $f \in \mathcal{F}$ and value $t$, the following probability is 1.
				\[\Pr_{r_f}\left[
					\begin{aligned}
						(\pp, \vp) \leftarrow \KeyGen(1^\lambda, \ell, d) && \\
						\comm \leftarrow \Commit(f, r_f, \pp) &:&  \CheckComm(\comm, \vp)=\accept \hspace*{5pt}\land \\
						(y, \pi) \leftarrow \Open(f, t, r_f, \pp) && \hspace*{10pt}\Verify(\comm, t, y, \pi, \vp)=\accept\\
					\end{aligned}
				\right]\]
			\item \textbf{Binding}
			For any PPT adversary $\mathcal{A}$ and benign auxiliary input $z_1, z_2$ the following probability is negligible of $\lambda$:
			{\footnotesize
			\[\Pr \left[
				\begin{aligned}
					(\pp, \vp) \leftarrow \KeyGen(1^\lambda, \ell, d) && \CheckComm(\comm^*, \vp)=\accept \hspace*{5pt}\land\\
					(\pi^*, \comm^*, y^*, state) \leftarrow \mathcal{A}(1^\lambda, z_1, \pp) &:& \Verify(\comm^*, t^*, y^*, \pi^*, \vp)=\accept \hspace*{5pt} \land\\
					(f^*, t^*, r_f^*) \leftarrow \mathcal{A}(1^\lambda, z_2, state, \pp) && \comm^*=\Commit(f^*, r_f^*, \pp) \hspace*{5pt} \land\\
					&& (y^*, \pi^*) = \Open(f^*, t^*, r_f^*, \pp) \hspace*{5pt} \land \\
					&& f^*(t^*) \neq y^*\\
				\end{aligned}
			\right]\]
			}
			\item \textbf{Zero Knowledge} For security parameter $\lambda$, polynomial $f$, adversary $\mathcal{A}$, and simulator $\S$, consider the following two experiments:
			{\footnotesize
				\begin{align*}
					\begin{minipage}{.48\linewidth}
						$\mathsf{Real}_{\A, f}(1^\lambda)$:
						\begin{enumerate}
							\item $(\pp, \vp) \leftarrow \KeyGen(1^\lambda, \ell, d)$
							%\item \text{Generate $r_f$ uniformly at random}
							\item $\comm \leftarrow \Commit(f, r_f, \pp)$
							\item $k\leftarrow \mathcal{A}(1^\lambda, \comm, \vp)$
							\item \text{For $i=1,...,k$ repeat}
							\begin{enumerate}
								\item $t_i \leftarrow \A(1^\lambda, \comm, y_1,...,y_{i-1}, \pi_1,\\ ..., \pi_{i-1}, \vp)$
								\item $(y_i, \pi_i) \leftarrow \Open(f, t_i, r_f, \pp)$
							\end{enumerate}
							\item $b \leftarrow \A(1^\lambda, \comm, (y_1, ..., y_k, \pi_1, ..., \pi_k), \vp)$
							\item \text{Output b}
						\end{enumerate}
					\end{minipage}
					\hspace*{5pt}\vline \hspace*{5pt}
					%\vline
					\begin{minipage}{.48\linewidth}
						$\mathsf{Ideal}_{\A, \S}(1^\lambda)$:
						\begin{enumerate}
							\item $(\comm, \pp, \vp, \sigma) \leftarrow \mathsf{Sim}(1^\lambda, \ell, d)$
							\item $k \leftarrow \A(1^\lambda, \comm, \vp)$
							\item \text{For $i=1,...,k$ repeat}:
							\begin{enumerate}
								\item $t_i \leftarrow \A(1^\lambda, \comm, y_1, ..., y_{i-1}, \pi_1,\\ ..., \pi_{i-1}, \vp)$
								\item $(y_i, \pi_i, \sigma) \leftarrow \mathsf{Sim}(t_i, \sigma, \pp)$
							\end{enumerate}
							\item $b \leftarrow \A(1^\lambda, \comm, (y_1, ..., y_k, \pi_1, ..., \pi_k), \vp)$
							\item \text{Output b}
						\end{enumerate}
					\end{minipage}
				\end{align*}
				}
				For any PPT adversary $\A$ and all polynomial $f\in\F$, there exists simulator $\S$ such that
				\[
				|\Pr[\mathsf{Real}_{\A, f}(1^\lambda)=1] - \Pr[\mathsf{Ideal}_{\A, \S}(1^\lambda)=1]|\le \negl(\lambda).
				\]
\end{itemize}

\end{definition}

\section{Condensing to One Point in Linear Time}\label{app:onepoint}

In this section, we present an algorithm to reduce two claims about $\tV_{i+1}$ to one in linear time. Recall that as described in Section~\ref{subsec::GKR}, in the $i$-th layer, after the sumcheck, the verifier receives two claims $\tV(u), \tV(v)$. (Again we omit the superscript and subscript of $i$ for the ease of interpretation.) She then defines a line $\gamma(x): \mathbb{F}\rightarrow\mathbb{F}^{s}$ such that $\gamma(0) = u, \gamma(1)=v$ and the prover needs to provide $\tV(\gamma(x))$, a degree $s$ univariate polynomial, to $\V$. If the prover computes it naively, which was done in all prior papers, it incurs $O(s2^{s})$ time, as it is equivalent to evaluating $\tV()$ at $s+1$ points.

\begin{figure}[H]
	\begin{algorithm}[H]

		\caption{Compute $\tV(\gamma(x)) = \sum_{y\in\binary^s}I(\gamma(x), y)\tV(y)$}\label{alg::comb}
		\begin{algorithmic}[1]
			\State Initialize a binary tree $T$ with $s$ levels. We use $T_j[b]$ to denote the $b$-th node at level $j$.
			\For{$b\in\binary^s$}
				\State $T_s[b] = \tV(b)$.
				\State Multiply $T_s[b]$ with $b_s(c_s x+ d_s)+(1-b_s)(1-c_s x- d_s)$.
			\EndFor
			\For{$j = s-1, \ldots, 1$}
				\For{$b\in\binary^{j}$}
					\State $T_j[b] = T_{j+1}[b,0]+T_{j+1}[b,1]$.
					\State $T_j[b] = T_j[b] \cdot (b_j(c_j x+ d_j)+(1-b_j)(1-c_j x- d_j))$.
				\EndFor
			\EndFor
			\State Output $T_1[0]$.
		\end{algorithmic}
	\end{algorithm}
\end{figure}

In our new algorithm, we write $\tV(\gamma(x)) = \sum_{y\in\binary^s}I(\gamma(x), y)\tV(y)$, where $I(a,b)$ is an identity polynomial $I(a,b)=0$ iff $a=b$. This holds by inspection of both sides on the Boolean hypercube. We then evaluate the right side in linear time with a binary tree structure. The key observation is that the identity polynomial can be written as $I(a,b) = \prod_{j=1}^s (a_jb_j+(1-a_j)(1-b_j))$, and we can process one variable ($a_j,b_j$) at a time and multiply them together to get the final result.

We construct a binary tree with $2^s$ leaves and initialize each leaf $b\in\binary^s$ with $\tV(b)$. As $\gamma(x)$ is a linear polynomial, we write it as $\gamma(x) = [c_1, \ldots, c_s]^T x+ [d_1, \ldots, d_s]^T$. At the leaf level, we only consider the last variable of $I(\gamma(x), y)$. For each leaf $b\in\binary^s$, we multiply the value with $b_s(c_s x+ d_s)+(1-b_s)(1-c_s x- d_s)$, the result of which is a linear polynomial. For a node $b\in\binary^j$ in the intermediate level $j$, we add the polynomials from its two children, and multiply it with $b_j(c_j x+ d_j)+(1-b_j)(1-c_j x- d_j)$, the part in $I$ that corresponds to the $j$-th variable. In this way, each node in the $j$-th level stores a degree $j$ polynomial. Eventually, the root is the polynomial on the right side of degree $s$, which equals to $\tV(\gamma(x))$. The algorithm is given in Algorithm~\ref{alg::comb}.

To see the complexity of Algorithm~\ref{alg::comb}, both the storage and the polynomial multiplication at level $j$ is $O(s-j+1)$ in each node. So the total time is $O(\sum_{j=1}^s 2^j (s-j+1)) = O(2^s)$, which is linear to the number of gates in the layer.

An alternative way to interpret this result is to add an additional layer for each layer of the circuit in GKR relaying the values. That is, $$\tV_{i}(g) = \sum_{x\in\binary^{s_i}}I(g,x)\tV_{i+1}(x),$$ where $\tV_i = \tV_{i+1}$. Then when using the random linear combination approach, the sumcheck is executed on $$\alpha\tV_{i}(u)+\beta\tV_i(v) = \sum_{x\in\binary^{s_i}}(\alpha I(u,x)+\beta I(v,x))\tV_{i+1}(x).$$
At the end of the sumcheck, the verifier receives a single claim on $\tV_{i+1} = \tV_{i}$. The sumcheck can obviously run in linear time, and the relay layers do not change the result of the circuit. This approach is actually the same as the condensing to one point in linear time above conceptually.

\section{Proof of Theorem~\ref{thm:zksc}}\label{app:proofsc}

\begin{proof}

	We build the simulator $\S$ as following.

	\begin{enumerate}

		\item $\S$ selects a random polynomial $g^*(x_1,\ldots,x_\ell) = a^*_{0} + g^*_1(x_1) + g^*_2(x_2) + \cdots + g^*_\ell(x_\ell)$, where $g^*_i(x_i) = a^*_{i,1}x_i + a^*_{i,2}x_i^2 + \cdots + a^*_{i,d}x_i^d$. $\S$ sends $H$, $G^* = \sum\limits_{x_1, x_2, \cdots, x_\ell \in \binary} g^*(x_1, x_2, \cdots, x_\ell)$ and $\comm_{g^*} = \Commit(g^*)$ to $\V$.

		\item $\S$ receives $\rho \neq 0$ from $\V^*$.
		\item $\S$ selects a polynomial $f^*:\F^\ell\rightarrow\F$ with variable degree $d$ uniformly at random conditioning on $\sum\limits_{x_1, x_2, \cdots, x_\ell \in \{0, 1\}}f^*(x_1, x_2, \cdots, x_\ell) = H$. $\S$ then engages in a sumcheck protocol with $\V$ on  $H+\rho G^* = \sum\limits_{x_1, x_2, \cdots, x_l \in \{0, 1\}}(f^*(x_1, x_2, \cdots, x_\ell)+\rho g^*(x_1, x_2, \cdots, x_\ell))$

		\item Let $r \in \F^\ell$ be the point chosen by $\V^*$ in the sumcheck protocol. $\S$ runs $(g^*(r), \pi)\leftarrow\Open(g^*,r)$ and sends them to $\V$.

	\end{enumerate}

	As both $g$ and $g^*$ are randomly selected, and the zkVPD protocol is zero-knowledge, it is obvious that step 1 and 4 in $\S$ are indistinguishable from those in the real world of Construction~\ref{construction::zksumcheck}. It remains to show that the sumchecks in step 3 of both worlds are indistinguishable.

	To see that, recall that in round $i$ of the sumcheck protocol, $\V$ receives a univariate polynomial $h_i(x_i) = \sum\limits_{b_{i+1}, \ldots,b_\ell\in\binary}h(r_1, \ldots, r_{i-1},x_i, b_{i+1}, \ldots, b_\ell)$ where $h = f+\rho g$. (The view of $\V^*$ is defined in the same way with $h^*,f^*,g^*$ and we omit the repetition in the following.) As the variable degree of $f$ and $g$ is $d$, $\P$ sends $\V$ $h_i(0), h_i(1), \ldots, h_i(d)$ which uniquely defines $h_i(x_i)$. These evaluations reveal $d+1$ independent linear constraints on the coefficients of $h$. In addition, note that when these evaluations are computed honestly by $\P$, $h_i(0)+h_i(1) = h_{i-1}(r_{i-1})$, as required in the sumcheck protocol. Therefore, in all $\ell$ rounds of the sumcheck, $\V$ and $\V^*$ receives $\ell(d+1) - (\ell-1) = \ell d+1$ independent linear constraints on the coefficients of $h$ and $h^*$.

	As $h$ and $h^*$ are masked by $g$ and $g^*$, each with exactly $\ell d+1$ coefficients selected randomly, the two linear systems are identically distributed. Therefore, step 3 of the ideal world is indistinguishable from that of the real world.

\end{proof}

\section{Proof of Theorem~\ref{thm:zkgkr}}\label{app:proofgkr}

\begin{proof} With oracle access to $\mathsf{out}$, and the simulator $\S_{sc}$ of the zero-knowledge sumcheck protocol in Section~\ref{subsec:zksumcheck} as a subroutine, we construct the simulator $\mathcal{S}$ as following:

\begin{enumerate}

\item $\S$ sends the $\mathsf{out}$ to $\V^*$.

\item $\S$ randomly selects polynomials $R^*_1(z_1, w), \ldots, R^*_d(z_1, w): \F^2\rightarrow \F$ with variable degree 2. $\S$ commits to these polynomials by sending $\comm_i\leftarrow\Commit(R^*_i)$ to $\V^*$ for $i\in[1,d]$.

\item $\S$ receives $g^{(0)}$ from $\V^*$.

\item $\S$ calls $\S_{sc}$ to simulate the partial view of the zero knowledge sumcheck protocol on
{\footnotesize
\[
\dot{V}_{0}(g^{(0)})=\sum_{x, y\in \binary^{s_{1}}}\tilde{mult}_{1}(g^{(0)}, x, y)(\dot{V}_{1}(x)\dot{V}_{1}(y))+\tilde{add}_{1}(g^{(0)},x,y)(\dot{V}_{1}(x)+\dot{V}_{1}(y))
\]
}
If $u_1^{(1)} = v_1^{(1)}$, $\S$ aborts. At the end of the sumcheck, $\S$ samples $\dot{V}^*_1(u^{(1)})$ and $\dot{V}^*_1(v^{(1)})$ such that $\tmult_1(g^{(0)},u^{(1)},v^{(1)})\dot{V}^*_1(u^{(1)})\dot{V}^*_1(v^{(1)})+\tadd_1(g^{(0)},u^{(1)},v^{(1)})$ $(\dot{V}^*_1(u^{(1)})+\dot{V}^*_1(v^{(1)}))$ equals to the last message of the sumcheck.

\item For layer $i=1,\ldots,d-1$:
	\begin{enumerate}
	\item $\S$ receives $\alpha^{(i)}, \beta^{(i)}$ from $\V^*$.
	\item Let $Mult_{i + 1}(x, y) = \alpha^{(i)}\tilde{mult}_{i+1}(u^{(i)}, x, y)+\beta^{(i)}\tilde{mult}_{i+1}(v^{(i)}, x, y)$ and $Add_{i + 1}(x, y) = \alpha^{(i)}\tilde{add}_{i+1}(u^{(i)}, x, y)+\beta^{(i)}\tilde{add}_{i+1}(v^{(i)}, x, y)$. $\S$ calls $\S_{sc}$ to simulate the partial view of the zero knowledge sumcheck protocol on \\

	$\alpha^{(i)}\dot{V}_i(u^{(i)})+\beta^{(i)}\dot{V}_i(v^{(i)})=$
	\begin{align*}
	&\sum_{\substack{x, y\in \binary^{s_{i+1}}\\w \in \binary}}(I(\vec{0},w) \cdot Mult_{i+1}(x, y)(\dot{V}_{i+1}(x)\dot{V}_{i+1}(y))\\
	&+Add_{i+1}(x, y)(\dot{V}_{i+1}(x)+\dot{V}_{i+1}(y))\nonumber\\
	&+ I((x, y), \vec{0})(\alpha^{(i)}Z_i(u^{(i)})R_i(u_1^{(i)}, w)+\beta^{(i)}Z_i(v^{(i)})R_i(v_1^{(i)}, w)))
	\end{align*}
	If $u_1^{(i+1)} = v_1^{(i+1)}$, $\S$ aborts.

	\item At the end of the zero-knowledge sumcheck protocol, if $u_1^{(i+1)} = v_1^{(i+1)}$, $\S$ aborts. Otherwise, $\S$ samples $\dot{V}^*_{i+1}(u^{(i+1)})$ and $\dot{V}^*_{i+1}(v^{(i+1)})$ randomly such that the following equals to the last message of the sumcheck protocol.
	{\footnotesize
	\begin{align*}
	I(\vec{0},c^{(i)})(a_{i+1}(\dot{V}^*_{i+1}(u^{(i+1)})\dot{V}^*_{i+1}(v^{(i+1)}))+b_{i+1}(\dot{V}^*_{i+1}(u^{(i+1)})+\dot{V}^*_{i+1}(v^{(i+1)})))\\
	+I((u^{(i+1)},v^{(i+1)}),\vec{0})(\alpha^{(i)}Z_i(u^{(i)})R^*_i(u_1^{(i)}, c^{(i)})+\beta^{(i)}Z_i(v^{(i)})R^*_i(v_1^{(i)}, c^{(i)}))
	\end{align*}
	}
	$a_{i+1} = \alpha^{(i)}\tilde{mult}_{i+1}(u^{(i)}, u^{(i+1)}, v^{(i+1)})+\beta^{(i)}\tilde{mult}_{i+1}(v^{(i)}, u^{(i+1)}, v^{(i+1)})$ and $b_{i+1} = \alpha^{(i)}\tilde{add}_{i+1}(u^{(i)}, u^{(i+1)}, v^{(i+1)})+\beta^{(i)}\tilde{add}_{i+1}(v^{(i)}, u^{(i+1)}, v^{(i+1)})$. $\S$ sends $\dot{V}_{i+1}(u^{(i+1)})$ and $\dot{V}_{i+1}(v^{(i+1)})$ to $\V^*$.

	\item $\V^*$ computes the corresponding values locally as in step 5(d) of Construction~\ref{construction:zkgkr}.
	\item $\S$ opens $R^*_i$ at two points $R^*_i(u_1^{(i)},c^{(i)})$ and $R^*_i(v_1^{(i)},c^{(i)})$ using $\Open$.
	\item $\V^*$ performs the checks as in step 5(f) of Construction~\ref{construction:zkgkr}.
	\end{enumerate}
\end{enumerate}

Note here that $\V^*$ can actually behave arbitrarily in step 5(d) and 5(f) above. We include these steps to be consistent with the real world in  Construction~\ref{construction:zkgkr} for the ease of interpretation.

To prove zero-knowledge, step 1,3, 5(a), 5(d) and 5(f) are obviously indistinguishable as $\S$ only receives messages from $\V^*$. Step 2 and 5(e) of both worlds are indistinguishable because of the zero knowledge property of the zkVPD, and the fact that $R^*$ and $R$ are sampled randomly in both worlds. Step 4 and 5(b) are indistinguishable as proven in Theorem~\ref{thm:zksc} for $\S_{sc}$.

It remains to consider the messages received at the end of step 4 and in step 5(c), namely $\dot{V}_{i}(u^{(i)}), \dot{V}_{i}(v^{(i)})$ and $\dot{V}^*_{i}(u^{(i)}), \dot{V}^*_{i}(v^{(i)})$ for $i = 1,\ldots,d$. In the real world, $\dot{V}_{i}(z)$ is masked by $\sum\limits_{w \in\binary}R_i(z_1,w)$ ($Z(z)$ is publicly known), thus $\dot{V}_{i}(u^{(i)})$ and $\dot{V}_{i}(v^{(i)})$ are masked by $\sum\limits_{w \in\binary}R_i(u_1^{(i)},w)$ and $\sum\limits_{w \in\binary}R_i(v_1^{(i)},w)$ correspondingly. In addition, in step 5(e), $\V^*$ opens $R_i$ at $R_i(u_1^{(i)},c^{(i)})$ and $R_i(v_1^{(i)},c^{(i)})$. To simplify the notation here, we consider only a particular layer and omit the subscription and superscription of $i$. Let $R(z_1,w) = a_0+a_1z_1+a_2w+a_3z_1w+a_4z_1^2+a_5w^2+a_6z_1^2w^2$, where $a_0,\ldots,a_6$ are randomly chosen. We can write the four evaluations above as
\[
\begin{bmatrix}
2 & 2u_1 & 1 & u_1 & 2u_1^2 & 1 & u_1^2\\
2 & 2v_1 & 1 & v_1& 2v_1^2 & 1 & v_1^2\\
1 & u_1 & c & cu_1 & u_1^2 & c^2 & c^2u_1^2\\
1 & v_1 & c & cv_1 &  v_1^2 & c^2 & c^2v_1^2\\
\end{bmatrix}
\times
\begin{bmatrix}
a_0 & a_1 &a_2 &a_3&a_4&a_5&a_6
\end{bmatrix}^T
\]
After row reduction, the left matrix is
\[
\begin{bmatrix}
2 & 2u_1 & 1 & u_1 & 2u_1^2 & 1 & u_1^2\\
0 & 2(v_1-u_1) & 0 & v_1-u_1 & 2(u_1^2-v_1^2) & 0 & u_1^2-v_1^2\\
0 & 0 & 2c-1 & (2c-1)u_1 & 0 & 2c^2-1 & (2c^2-1)u_1^2\\
0 & 0 & 0 & (2c-1)(v_1-u_1)&0 & 0 & (2c^2-1)(v_1^2-u_1^2)\\
\end{bmatrix}
\]
As $u_1\neq v_1$, the matrix has full rank if $2c^2 - 1\neq 0 \mod p$, where $p$ is the prime that defines $\F$. This holds if $2^{-1}$ is not in the quadratic residue of $p$, or equivalently $p \not\equiv 1, 7 \mod 8$.\footnote{From the reduced matrix, we can see that setting $a_2 = a_3 = a_4 = 0$ does not affect the rank of the matrix, which simplifies the masking polynomial $R$ in practice.} In case $p\equiv 1, 7 \mod 8$, we can add a check to both the protocol and the simulator to abort if $2c^2 -1 =0$. This does not affect the proof of zero knowledge, and only reduces the soundness error by a small amount. \footnote{If one is willing to perform a check like this, we can simplify the masking polynomial $R$ to be multilinear. The reduced matrix will be the first 4 columns of the matrix showed above, and it has full rank if $c\neq 2^{-1}$.}

Because of the full rank of the matrix, the four evaluations are linearly independent and uniformly distributed, as $a_0,\ldots a_6$ are chosen randomly. In the ideal world, $R^*(u_1,c)$ and $R^*(v_1,c)$ are independent and uniformly distributed, and $\dot{V}^*(u), \dot{V}^*(v)$ are randomly selected subject to a linear constraint (step 5(c)), which is the same as the real world. Therefore, they are indistinguishable in the two worlds, which completes the proof.

\end{proof}

\section{zkVPD Protocol for the Input Layer}\label{app:zkvpdconstruction}

\begin{figure}[t!]
	\small{
		\centering{\centering
			\framebox{\parbox{.99\linewidth}{
					\begin{construction}
						\label{construction::zkVPD}
						Let $\mathbb{F}$ be a prime-order finite field. Let $\dot{V}(x): \F^\ell\rightarrow \F$ be an $\ell$-variate polynomial such that $\dot{V}(x) = \tV(x)+Z(x)R(x_1)$, where $\tV(x)$ is a multilinear polynomial, $Z(x) = \prod_{i=1}^\ell x_i(1-x_i)$ and $R(x_1) = a_0+a_1x_1$.

						\begin{itemize}
							\item $(\pp, \vp) \leftarrow \KeyGen(1^\lambda, \ell)$: Select $\alpha, t_1, t_2, \cdots, t_l, t_{\ell+1} \in \F$ uniformaly at random, run $\mathsf{bp} \leftarrow \mathsf{BilGen}(1^{\lambda})$ and compute $\pp = (\mathsf{bp},g^\alpha, g^{t_{\ell+1}}, g^{\alpha t_{\ell+1}}, \{g^{\prod_{i\in W}t_i}, g^{\alpha\prod_{i\in W}t_i}\}_{W\in \mathcal{W}_\ell})$, where $\mathcal{W}_\ell$ is the set of all subsets of $\{1,\ldots, \ell\}$. Set $\vp = (\mathsf{bp},g^{t_1}, \ldots, g^{t_{\ell+1}}, g^\alpha)$.

							\item $\comm \leftarrow \Commit(\dot{V}, r_V, r_R, \pp)$: Compute $c_1 = g^{\tV(t_1, t_2, \cdots, t_\ell) + r_Vt_{\ell+1}}$, $c_2 = g^{\alpha(\tV(t_1, t_2, \cdots, t_\ell) + r_Vt_{\ell+1})}$, $c_3 = g^{R(t_1)+r_Rt_{\ell+1}}$ and $c_4 = g^{\alpha(R(t_1)+r_Rt_{\ell+1})}$  output the commitment $\comm = (c_1, c_2,c_3,c_4)$.

							\item $\{\accept,\reject\}\leftarrow\CheckComm(\comm, \vp)$: Output $\accept$ if $e(c_1, g^\alpha) = e(c_2,g)$ and $e(c_3, g^\alpha) = e(c_4,g)$. Otherwise, output $\reject$.

							\item $(y,\pi)\leftarrow\Open(\dot{V}, r_V, r_R, u,\pp)$: Choose $r_1,\ldots, r_\ell\in\F$ at random, and compute polynomials $q_i$ such that
							\[
							\tV(x)+r_Vx_{\ell+1}+Z(u)(R(x_1)+r_Rx_{\ell+1}) -(\tV(u)+Z(u)R(u_1)) =
							\]
							\[ \sum_{i=1}^\ell(x_i-u_i)(q_i(x_i,\ldots,x_\ell)+r_ix_{\ell+1})+x_{\ell+1}(r_V+r_RZ(u)-\sum_{i=1}^\ell r_i(x_i-u_i)).
							\]
							Set $\pi = (\{g^{q_i(t_i\ldots, t_\ell)+r_it_{\ell+1}}, g^{\alpha(q_i(t_i\ldots, t_\ell)+r_it_{\ell+1})}\}_{i\in[1,\ell]},$ $ g^{r_V+r_RZ(u)-\sum_{i=1}^\ell r_i(t_i-u_i)}, g^{\alpha(r_V+r_RZ(u)-\sum_{i=1}^\ell r_i(t_i-u_i))})$ and $y = \tV(u)+Z(u)R(u_1)$.

							\item $\{\accept,\reject\}\leftarrow\Verify(\comm,u,y,\pi,\vp)$: Parse $\pi$ as $(\pi_i,\pi_{\alpha i})$ for $i\in[1,\ell+1]$. Check $e(\pi_i,g^\alpha) = e(\pi_{\alpha i},g)$ for $i\in[1,\ell+1]$. Check $e(c_1c_3^{Z(u)}/g^y, g) = \prod_{i=1}^\ell e(\pi_i, g^{t_i-u_i}) \cdot e(g^{\pi_{\ell+1}},g^{t_{\ell+1}})$. Output $\accept$ if all the checks pass, otherwise, output $\reject$.

						\end{itemize}

	\end{construction}}}}}
\end{figure}

\section{Additional Optimizations for \name}\label{app:opt}

\paragraph{Key generation with look-up tables.} There is a setup phase in our zkVPD protocol, where the generator $g$ of the bilinear map base group is raised to $O(n)$ different powers. We developed an algorithm with look-up tables that improves this setup time by $\frac{\log n}{2}$.

The bit-length of these powers is $\log |\F|$, as they are products of the secret keys selected randomly. We divide the $\log|\F|$ bits into $\frac{2\log|\F|}{\log n}$ blocks with $\frac{\log n}{2}$ bits each. For each block, we consider all $i\in\binary^{\log n/2}$ in the block and set the bits of other blocks as 0. We precompute the powers of $g$ to all possible values in each block as the look-up table. The space and time of this step is $O(\frac{2\log|\F|}{\log n}\cdot\sqrt{n})$. To compute a power $g^a$, we divide the bits of $a$ into such blocks. The contribution of each block can be computed in constant time by the look-up table, and we simply multiply them together to get $g^a$. The computation takes $O(\frac{2\log|\F|}{\log n})$ time, while without this optimization, each exponentiation takes $O(\log |\F|)$ time.

Concretely, the optimization improves the setup time by around $10\times$ in practice, and can also be applied to the setup in SNARKs.

\paragraph{More gate types with no overhead.} In our protocol, we only consider addition and multiplication gates, as they are enough to represent all arithmetic circuits. However, in practice, the size of the circuit can be reduced significantly if we introduce other types of gate. The GKR protocol still works with these new gates, but they incur an overhead on the prover time for a circuit of the same size. Therefore, in prior work such as~\cite{wahby2016verifiable,vram}, this is considered as a trade-off.

Our protocol supports any gate with fan-in $\le 2$ and degree $\le 2$ with no overhead on the prover. Recall that in the GKR protocol, the values in layer $i$ is represented as a sumcheck of values in layer $i+1$ and the wiring predicates, as shown in Equation~\ref{eq:GKR}. With a set of gate types $\mathcal{T}$, we can write the polynomial in the sum as $$\sum_{j\in\mathcal{T}}\tilde{gate}^{(j)}_i(g,x,y) G^{(j)}_i(\tV_{i+1}(x),\tV_{i+1}(x)),$$ where $G^{(j)}_i()$ is the computation of gate type $j$ (e.g., for addition gates, \\$G^{(j)}_i(\tV_{i+1}(x),\tV_{i+1}(x)) = \tV_{i+1}(x)+\tV_{i+1}(x)$). As the gates have fan-in $\le 2$ and degree $\le 2$, $G^{(j)}_i$ has up to 2 variables and total degree at most 2 for all $j$. Therefore, each $G^{(j)}_i$ can be expressed explicitly as $a_0+a_1\tV_{i+1}(x)+a_2\tV_{i+1}(y)+a_3\tV_{i+1}(x)\tV_{i+1}(y)+a_4\tV_{i+1}(x)^2+a_5\tV_{i+1}(y)^2$, at most 6 nonzero monomials. The prover can then combine all the wiring predicates $\tilde{gate}^{(j)}_i(g,x,y)$ for the same monomial through a summation. With this approach, when generating the proof in Algorithm~\ref{alg::phase1} and~\ref{alg::phase2}, the prover only allocates one array for each monomial, and initializes all 6 arrays with one scan through all the gates in $\mathsf{Init\_PhaseOne}$ and $\mathsf{Init\_PhaseTwo}$. In this way, the prover time remains the same regardless of the number of gate types.

In our experiments, useful types of gates include subtraction, relay, multiply by constant, $x(1-x)$ for binary check, \texttt{NOT,AND,OR,XOR}, etc.


Input to the Buoyancy (BUY) Package is read from the file that has type ``BUY6'' in the Name File.  If the BUY Package is included for a model, then the model will use the variable-density form of Darcy's Law for all flow calculations using the approach described by \cite{langevin2020hydraulic}.  Only one BUY Package can be specified for a GWF model.  In its simplest case, the user can specify a concentration array that is used to calculate fluid density for each cell in the model.  These density values, which are held constant and do not change in response to flowing groundwater, are then used in Darcy's Law.  Alternatively, the BUY Package can be coupled with one or more GWT Models so that fluid density is updated dynamically with one or more simulated concentration fields.

The BUY Package calculates fluid density using the following equation of state from \cite{langevin2008seawat}:

\begin{equation}
\label{eqn:volumeconservationdiscrete}
%\rho = \rho_0 + \sum_{i=1}^{NRHOSPECIES} \left ( C_i - C_{i,0} \right )
\rho = DENSEREF + \sum_{i=1}^{NRHOSPECIES} DRHODC_i \left ( CONCENTRATION_i - CRHOREF_i \right )
\end{equation}

\noindent where $\rho$ is the calculated density, $DENSEREF$ is the density of a reference fluid, typically taken to be freshwater at a temperature of 25 degrees Celsius; $NRHOSPECIES$ is the number of chemical species that contribute to the density calculation, $DRHODC_i$ is the parameter that describes how density changes as a function of concentration for chemical species $i$ (i.e. the slope of a line that relates density to concentration), $CONCENTRATION_i$ is the concentration of species $i$, and $CRHOREF_i$ is the concentration of species $i$ in the reference fluid, which is normally set to zero.

\subsubsection{Stress Packages}
For head-dependent stress packages, the BUY Package may require fluid density and elevation for each head-dependent boundary so that the model can use a variable-density form of Darcy's Law to calculate flow between the boundary and the aquifer.  By default, the boundary elevation is set equal to the cell elevation.  For water-table conditions, the cell elevation is calculated as bottom elevation plus half of saturation multiplied by the cell thickness.  If desired, the user can more precisely locate the boundary elevation by specifying an auxiliary variable with the name ``ELEVATION''.  The program will use the values in this column as the boundary elevation.  A situation where this may be required is for river or general-head boundaries that are conceptualized as being on top of a model cell.  In those cases, an ELEVATION column should be specified and the values set to the top of the cell or some other appropriate elevation that corresponds to where the boundary stage applies.

By default, the boundary density is set equal to DENSEREF, commonly specified as the density of freshwater; however, there are two other options for setting the density of a boundary package.  The first is to assign an auxiliary variable with the name ``DENSITY''.  If this auxiliary variable is detected, then the density value in this column will be assigned to the density for the boundary.  Alternatively, a density value can be calculated for each boundary using the density equation of state and one or more concentrations provided as auxiliary variables.  In this case, the user must assign one auxiliary variable for each AUXSPECIESNAME listed in the PACKAGEDATA block below.  Thus, there must be NRHOSPECIES auxiliary variables, each with the identical name as those specified in PACKAGEDATA.  The BUY Package will calculate the density for each boundary using these concentrations and the values specified for DENSEREF, DRHODC, and CRHOREF.  If the boundary package contains an auxiliary variable named DENSITY and also contains AUXSPECIESNAME auxiliary variables, then the boundary density value will be assigned to the one in the DENSITY auxiliary variable.

A GWT Model can be used to calculate concentrations for the advanced stress packages (LAK, SFR, MAW, and UZF) if corresponding advanced transport packages are specified (LKT, SFT, MWT, and UZT).  The advanced stress packages have an input option called FLOW\_PACKAGE\_AUXILIARY\_NAME.  When activated, this option will result in the simulated concentration for a lake or other feature being copied from the advanced transport package into the auxiliary variable for the corresponding GWF stress package.  This means that the density for a lake or stream, for example, can be dynamically updated during the simulation using concentrations from advanced transport packages that are fed into auxiliary variables in the advanced stress packages, and ultimately used by the BUY Package to calculate a fluid density using the equation of state.  This concept also applies when multiple GWT Models are used simultaneously to simulate multiple species.  In this case, multiple auxiliary variables are required for an advanced stress package, with each one representing a concentration from a different GWT Model.

\begin{longtable}{p{3cm} p{12cm}}
\caption{Description of density terms for stress packages}
\tabularnewline
\hline
\hline
\textbf{Stress Package} & \textbf{Note} \\
\hline
\endhead
\hline
\endfoot
GHB & ELEVATION can be specified as an auxiliary variable.  A DENSITY auxiliary variable or one or more auxiliary variables for calculating density in the equation of state can be specified \\
RIV & ELEVATION can be specified as an auxiliary variable.  A DENSITY auxiliary variable or one or more auxiliary variables for calculating density in the equation of state can be specified \\
DRN & The drain formulation assumes that the drain boundary contains water of the same density as the discharging water; auxiliary variables have no affect on the drain calculation  \\
LAK & Elevation for each lake-aquifer connection is determined based on lake bottom and adjacent cell elevations. A DENSITY auxiliary variable or one or more auxiliary variables for calculating density in the equation of state can be specified \\
SFR & Elevation for each sfr-aquifer connection is determined based on stream bottom and adjacent cell elevations. A DENSITY auxiliary variable or one or more auxiliary variables for calculating density in the equation of state can be specified \\
MAW & Elevation for each maw-aquifer connection is determined based on cell elevation. A DENSITY auxiliary variable or one or more auxiliary variables for calculating density in the equation of state can be specified \\
UZF & No density terms implemented \\
\end{longtable}

\vspace{5mm}
\subsubsection{Structure of Blocks}

\vspace{5mm}
\noindent \textit{FOR EACH SIMULATION}
\lstinputlisting[style=blockdefinition]{./mf6ivar/tex/gwf-buy-options.dat}
\lstinputlisting[style=blockdefinition]{./mf6ivar/tex/gwf-buy-dimensions.dat}
\lstinputlisting[style=blockdefinition]{./mf6ivar/tex/gwf-buy-packagedata.dat}
\vspace{5mm}
\noindent \textit{FOR ANY STRESS PERIOD}
\lstinputlisting[style=blockdefinition]{./mf6ivar/tex/gwf-buy-period.dat}

\vspace{5mm}
\subsubsection{Explanation of Variables}
\begin{description}
\input{./mf6ivar/tex/gwf-buy-desc.tex}
\end{description}

\vspace{5mm}
\subsubsection{Example Input File}
\lstinputlisting[style=inputfile]{./mf6ivar/examples/gwf-buy-example.dat}


%File: GMM.tex
%Date: Fri Jan 03 17:55:16 2014 +0800
%Author: Yuxin Wu <ppwwyyxxc@gmail.com>

\subsection{GMM-UBM}

\begin{frame}{GMM}
  \textbf{Gaussian Mixture Model}
  is commonly used to model human's acoustic feature.  \begin{exampleblock}{}
    \[ p(\theta) = \sum_{i=1}^{K}{w_i \mathcal{N}(\mathbf{\mu}_i, \Sigma_i)}\]
  \end{exampleblock}
  \pause

  \begin{columns}
    \begin{column}{0.5\textwidth}
      \begin{center}
        \only<1>{\includegraphics[width=\textwidth]{res/gmm.png}}
        \visible<2>{ \includegraphics[width=\textwidth]{res/nmixture.pdf} }
      \end{center}
    \end{column}
    \begin{column}{0.3\textwidth}
      We use $ K=32$
    \end{column}
  \end{columns}
\end{frame}

\begin{frame}{Optimized GMM}
  \begin{itemize}
    \item Basic GMM training: random initialize, estimate parameters with EM.
    \item Improvment: initialize with a parallel KMeansII.
    \item Improvment: parallel training implementation in C++.
    \item Compared to GMM from scikit-learn:
  \end{itemize}

  \begin{columns}
    \begin{column}{0.5\textwidth}
      \begin{center}
        \visible<2>{ \includegraphics[width=\textwidth]{res/gmm-compare.pdf} }
      \end{center}
      \vspace{0.6em}
    \end{column}
    \begin{column}{0.6\textwidth}
      \visible<2>{ \includegraphics[width=\textwidth]{res/time-comp-small.pdf} }
    \end{column}
  \end{columns}
  \vspace{3em}

  \begin{reference}{4mm}{85mm}
    Arthur, David, Sergei, 2007,
    k-means++: The advantages of careful seeding.

    Bahmani, et. al, 2012,
    Scalable K-means++
  \end{reference}
\end{frame}

\begin{frame}{UBM}
  \textbf{Universal Background Model} is a GMM trained on giant datasets.

  UBM can be used to:
  \begin{itemize}
    \item Describe general acoustic feature of human.
    \item Reject the decision of GMM.
    \item Train adaptive GMM.
  \end{itemize}

  \begin{reference}{4mm}{85mm}
    Reynolds, Douglas, et al, 2000,

    Speaker verification using adapted Gaussian mixture models
  \end{reference}
\end{frame}

\begin{frame}{GMM Results}
  \begin{columns}[t]
    \begin{column}[t]{0.5\textwidth}
      \begin{center}
        \includegraphics[width=0.8\textwidth]{res/reading.pdf}\\
        \includegraphics[width=0.8\textwidth]{res/spont.pdf}
      \end{center}
    \end{column}
    \begin{column}[t]{0.5\textwidth}
      \begin{center}
        \includegraphics[width=0.8\textwidth]{res/whisper.pdf}\\
        Train duration: 20s

        Random selected test utterance: 50

        Each value in the graph is an average of 20 independent experiments.
      \end{center}
    \end{column}
  \end{columns}
\end{frame}


\chapter{identical particle solution}
\begin{abox}
	Practice set solutions
	\end{abox}
\begin{enumerate}
\begin{minipage}{\textwidth}
	\item Consider a particle in a one dimensional potential that satisfies $V(x)=V(-x) .$ Let $\left|\psi_{0}\right\rangle$ and $\left|\psi_{1}\right\rangle$ denote the ground and the first excited states, respectively, and let $|\psi\rangle=\alpha_{0}\left|\psi_{0}\right\rangle+\alpha_{1}\left|\psi_{1}\right\rangle$ be a normalized state with $\alpha_{0}$ and $\alpha_{1}$ being real constants. The expectation value $\langle x\rangle$ of the position operator $x$ in the state $|\psi\rangle$ is given by
	\exyear{NET DEC 2011}
\end{minipage}
\begin{tasks}(2)
	\task[\textbf{A.}] $\alpha_{0}^{2}\left\langle\psi_{0}|x| \psi_{0}\right\rangle+\alpha_{1}^{2}\left\langle\psi_{1}|x| \psi_{1}\right\rangle$
	\task[\textbf{B.}]$\alpha_{0} \alpha_{1}\left[\left\langle\psi_{0}|x| \psi_{1}\right\rangle+\left\langle\psi_{1}|x| \psi_{0}\right\rangle\right]$
	\task[\textbf{C.}]$\alpha_{0}^{2}+\alpha_{1}^{2}$
	\task[\textbf{D.}]$2 \alpha_{0} \alpha_{1}$
\end{tasks}
\begin{answer}
	$\text { Since } V(x)=V(-x) \text { so potential is symmetric. }$\\
	\begin{align*}
		&\left\langle\psi_{0}|x| \psi_{0}\right\rangle=0,\left\langle\psi_{1}|x| \psi_{1}\right\rangle=0 \\
		&\langle\psi|x| \psi\rangle=\left(\alpha _ { 0 } \left\langle\psi_{0}\left|+\alpha_{1}\left\langle\psi_{1}\right|\right) \times\left(\alpha_{0}\left|\psi_{0}\right\rangle+\alpha_{1}\left|\psi_{1}\right\rangle\right)=\alpha_{0} \alpha_{1}\left[\left\langle\psi_{0}|x| \psi_{1}\right\rangle+\left\langle\psi_{1}|x| \psi_{0}\right\rangle\right]\right.\right.
	\end{align*}
	The correct option is \textbf{(b)}
\end{answer}
\begin{minipage}{\textwidth}
	\item Consider a system of two non-interacting identical fermions, each of mass $m$ in an infinite square well potential of width $a$. (Take the potential inside the well to be zero and ignore spin). The composite wavefunction for the system with total energy $E=\frac{5 \pi^{2} \hbar^{2}}{2 m a^{2}}$ is
	\exyear{NET JUNE 2014}
\end{minipage}
\begin{tasks}(2)
	\task[\textbf{A.}] $\frac{2}{a}\left[\sin \left(\frac{\pi x_{1}}{a}\right) \sin \left(\frac{2 \pi x_{2}}{a}\right)-\sin \left(\frac{2 \pi x_{1}}{a}\right) \sin \left(\frac{\pi x_{2}}{a}\right)\right]$
	\task[\textbf{B.}]$\frac{2}{a}\left[\sin \left(\frac{\pi x_{1}}{a}\right) \sin \left(\frac{2 \pi x_{2}}{a}\right)+\sin \left(\frac{2 \pi x_{1}}{a}\right) \sin \left(\frac{\pi x_{2}}{a}\right)\right]$
	\task[\textbf{C.}]$\frac{2}{a}\left[\sin \left(\frac{\pi x_{1}}{a}\right) \sin \left(\frac{3 \pi x_{2}}{2 a}\right)-\sin \left(\frac{3 \pi x_{1}}{2 a}\right) \sin \left(\frac{\pi x_{2}}{a}\right)\right]$
	\task[\textbf{D.}]$\frac{2}{a}\left[\sin \left(\frac{\pi x_{1}}{a}\right) \cos \left(\frac{\pi x_{2}}{a}\right)-\sin \left(\frac{\pi x_{2}}{a}\right) \cos \left(\frac{\pi x_{2}}{a}\right)\right]$
\end{tasks}
\begin{answer}
	 Fermions have antisymmetric wave function\\
	 \begin{align*}
	 	&\psi\left(x_{1} x_{2}\right)=\frac{2}{a}\left[\sin \left(\frac{\pi x_{1}}{a}\right) \sin \left(\frac{2 \pi x_{2}}{a}\right)-\sin \left(\frac{2 \pi x_{1}}{a}\right) \cdot \sin \left(\frac{\pi x_{2}}{a}\right)\right] \\
	 	&\because E_{n}=\frac{5 \pi^{2} \hbar^{2}}{2 m a^{2}} \Rightarrow n_{x_{1}}=1, n_{x_{2}}=2
	 \end{align*}
	 The correct option is \textbf{(a)}
\end{answer}
\begin{minipage}{\textwidth}
	\item The state vector of a one-dimensional simple harmonic oscillator of angular frequency $\omega$, at time $t=0$, is given by $|\psi(0)\rangle=\frac{1}{\sqrt{2}}[|0\rangle+|2\rangle]$, where $|0\rangle$ and $|2\rangle$ are the normalized ground state and the second excited state, respectively. The minimum time $t$ after which the state vector $|\psi(t)\rangle$ is orthogonal to $|\psi(0)\rangle$, is
	\exyear{NET DEC 2017}
\end{minipage}
\begin{tasks}(2)
	\task[\textbf{A.}] $\frac{\pi}{2 \omega}$
	\task[\textbf{B.}]$\frac{2 \pi}{\omega}$
	\task[\textbf{C.}]$\frac{\pi}{\omega}$
	\task[\textbf{D.}]$\frac{4 \pi}{\omega}$
\end{tasks}
\begin{answer}
	$\left\langle\psi ( 0 ) \left|=\frac{1}{\sqrt{2}}[|0\rangle+|2\rangle]\right.\right.$\\
	\begin{align*}
		&E_{2}=\frac{5}{2} \hbar \omega \quad|\psi(t)\rangle=\frac{1}{\sqrt{2}}\left[|0\rangle e^{\frac{-\hbar \omega t}{2 \hbar}}+|2\rangle e^{\frac{-5 \hbar \omega t}{2} \hbar}\right] \\
		&E_{0}=\frac{\hbar \omega}{2} \cdot\langle\psi(0) \psi \mid \psi(t)\rangle=0 \Rightarrow t=\frac{\hbar}{E_{2}-E_{0}} \cos ^{-1}(-1) \\
		&t=\frac{\hbar}{\left(\frac{5 \hbar \omega}{2}-\frac{1}{2} \hbar \omega\right)} \cos ^{-1}(-1)=\frac{\hbar}{2 \hbar \omega / 2} \pi=\frac{\pi}{2 \omega}
	\end{align*}
	The correct option is \textbf{(a)}
\end{answer}
\end{enumerate}
\newpage
\begin{abox}
	Practice set 2 solutions
	\end{abox}
\begin{enumerate}
\begin{minipage}{\textwidth}
	\item Consider the wavefunction $\psi=\psi\left(\vec{r}_{1}, \vec{r}_{2}\right) \chi_{s}$ for a fermionic system consisting of two spinhalf particles. The spatial part of the wavefunction is given by
	$$
	\psi\left(\vec{r}_{1}, \vec{r}_{2}\right)=\frac{1}{\sqrt{2}}\left[\phi_{1}\left(\vec{r}_{1}\right) \phi_{2}\left(\vec{r}_{2}\right)+\phi_{2}\left(\vec{r}_{1}\right) \phi_{1}\left(\vec{r}_{2}\right)\right]
	$$
	where $\phi_{1}$ and $\phi_{2}$ are single particle states. The spin part $\chi_{s}$ of the wavefunction with spin states $\alpha(+1 / 2)$ and $\beta(-1 / 2)$ should be
	\exyear{GATE 2013}
\end{minipage}
\begin{tasks}(2)
	\task[\textbf{A.}]$\frac{1}{\sqrt{2}}(\alpha \beta+\beta \alpha)$
	\task[\textbf{B.}]$\frac{1}{\sqrt{2}}(\alpha \beta-\beta \alpha)$
	\task[\textbf{C.}]$\alpha \alpha$
	\task[\textbf{D.}] $\beta \beta$
\end{tasks}
\begin{answer}
	Since $\psi\left(r_{1}, r_{2}\right)$ is symmetric the total wavefunction must be antisymmetric for fermions so spin part must be antisymmetric.\\
	The correct option is \textbf{(b)}
\end{answer}
\begin{minipage}{\textwidth}
	\item The ground state and first excited state wave function of a one dimensional infinite potential well are $\psi_{1}$ and $\psi_{2}$ respectively. When two spin-up electrons are placed in this potential which one of the following with $x_{1}$ and $x_{2}$ denoting the position of the two electrons correctly represents the space part of the ground state wave function of the system?
	\exyear{GATE 2014}
\end{minipage}
\begin{tasks}(2)
	\task[\textbf{A.}] $\frac{1}{\sqrt{2}}\left[\psi_{1}\left(x_{1}\right) \psi_{2}\left(x_{1}\right)-\psi_{1}\left(x_{2}\right) \psi_{2}\left(x_{2}\right)\right]$
	\task[\textbf{B.}]$\frac{1}{\sqrt{2}}\left[\psi_{1}\left(x_{1}\right) \psi_{2}\left(x_{2}\right)+\psi_{1}\left(x_{2}\right) \psi_{2}\left(x_{1}\right)\right]$
	\task[\textbf{C.}]$\frac{1}{\sqrt{2}}\left[\psi_{1}\left(x_{1}\right) \psi_{2}\left(x_{1}\right)+\psi_{1}\left(x_{2}\right) \psi_{2}\left(x_{2}\right)\right]$
	\task[\textbf{D.}]$ \frac{1}{\sqrt{2}}\left[\psi_{1}\left(x_{1}\right) \psi_{2}\left(x_{2}\right)-\psi_{1}\left(x_{2}\right) \psi_{2}\left(x_{1}\right)\right]$
\end{tasks}
\begin{answer}
	 From the given information only possible spin configuration is symmetric in nature so space part will anti symmetric
	$$
	\frac{1}{\sqrt{2}}\left[\psi_{1}\left(x_{1}\right) \psi_{2}\left(x_{2}\right)-\psi_{1}\left(x_{2}\right) \psi_{2}\left(x_{1}\right)\right]
	$$
	The correct option is \textbf{(d)}
\end{answer}
\begin{minipage}{\textwidth}
	\item $\psi_{1}$ and $\psi_{2}$ are two orthogonal states of a spin $\frac{1}{2}$ system. It is given that
	$\psi_{1}=\frac{1}{\sqrt{3}}\left(\begin{array}{l}1 \\ 0\end{array}\right)+\sqrt{\frac{2}{3}}\left(\begin{array}{l}0 \\ 1\end{array}\right)$, where $\left(\begin{array}{l}1 \\ 0\end{array}\right)$ and $\left(\begin{array}{l}0 \\ 1\end{array}\right)$ represent the spin-up and spin-down states, respectively. When the system is in the state $\psi_{2}$ its probability to be in the spin-up state is
	\exyear{GATE 2014}
\end{minipage}
\begin{answer}
	If is $\psi_{1}=\frac{1}{\sqrt{3}}\left(\begin{array}{l}1 \\ 0\end{array}\right)+\sqrt{\frac{2}{3}}\left(\begin{array}{l}0 \\ 1\end{array}\right)$, then $\psi_{2}=\sqrt{\frac{2}{3}}\left(\begin{array}{l}1 \\ 0\end{array}\right)+\sqrt{\frac{1}{3}}\left(\begin{array}{l}0 \\ 1\end{array}\right)$,\\
	 so probability that $\psi_{2}$ is in up state is $\frac{2}{3}$
\end{answer}
\begin{minipage}{\textwidth}
	\item For a spin $\frac{1}{2}$ particle, let $|\uparrow\rangle$ and $|\downarrow\rangle$ denote its spin up and spin down states respectively. If $|a\rangle=\frac{1}{\sqrt{2}}(|\uparrow\rangle|\downarrow\rangle+|\downarrow\rangle|\uparrow\rangle)$ and $|b\rangle=\frac{1}{\sqrt{2}}(|\uparrow\rangle|\downarrow\rangle-|\downarrow\rangle|\uparrow\rangle)$ are composite states of two such particles, which of the following statements is true for their total spin $S ?$
	\exyear{GATE 2018}
\end{minipage}
\begin{tasks}(2)
	\task[\textbf{A.}] $S=1$ for $|a\rangle$ and $|b\rangle$ is not an eigenstate of the operator $\hat{S}^{2}$
	\task[\textbf{B.}]$|a\rangle$ is not an eigenstate of the operator $\hat{S}^{2}$ and $S=0$ for $|b\rangle$
	\task[\textbf{C.}]$S=0$ for $|a\rangle$, and $S=1$ for $|b\rangle$
	\task[\textbf{D.}]$S=1$ for $|a\rangle$, and $S=0$ for $|b\rangle$
\end{tasks}
\begin{answer}
	$S=1 \text { is triplet }|a\rangle \text {, and } S=0 \text { for singlet for }|b\rangle$\\
	The correct option is \textbf{(d)}
\end{answer}
\begin{minipage}{\textwidth}
	\item Let $\left|\psi_{2}\right\rangle=\left(\begin{array}{c}1 \\ 0\end{array}\right),\left|\psi_{2}\right\rangle=\left(\begin{array}{c}0 \\ 1\end{array}\right)$ represent two possible states of a two-level quantum system. The state obtained by the incoherent superposition of $\left|\psi_{1}\right\rangle$ and $\left|\psi_{2}\right\rangle$ is given by a density matrix that is defined as $\rho \equiv c_{1}\left|\psi_{1}\right\rangle\left\langle\psi_{1}\left|+c_{2}\right| \psi_{2}\right\rangle\left\langle\psi_{2}\right| .$ If $c_{1}=0.4$ and $c_{2}=0.6$, the matrix element $\rho_{22}$ (rounded off to one decimal place) is
	\exyear{GATE 2018}
\end{minipage}
\begin{answer}
	\begin{align*}
		& \rho_{2,2}=\left\langle\psi_{2}|\rho| \psi_{2}\right\rangle=\rho \equiv c_{1}\left\langle\psi_{2} \mid \psi_{1}\right\rangle\left\langle\psi_{1} \mid \psi_{2}\right\rangle+c_{2}\left\langle\psi_{2} \mid \psi_{2}\right\rangle\left\langle\psi_{2} \mid \psi_{2}\right\rangle \\
		&\Rightarrow c_{2}=0.6
	\end{align*}
\end{answer}
\end{enumerate}

QM -CSIR/chapter/identical particle solution.tex


\documentclass{article}
\usepackage{amsmath}

\author{Kenneth P. Esler, Jr.}
\title{Hybrid orbital representation}
\date{\today}

\begin{document}
\newcommand{\vr}{\mathbf{r}}
\maketitle
\begin{equation}
\phi(\vr) = \sum_{\ell=0}^{\ell_\text{max}} \sum_{m=-\ell}^\ell Y_\ell^m (\hat{\Omega})
u_{\ell m}(r),
\end{equation}
where $u_{lm}(r)$ are complex radial functions represented in some
radial basis (e.g. splines).

\section{Real Spherical Harmonics}
\renewcommand{\Re}{\rm Re}
\renewcommand{\Im}{\rm Im}
If $\phi(\vr)$ can be written as purely real, we can change the
representation so that
\begin{equation}
\phi(\vr) = \sum_{l=0}^{l_\text{max}} \sum_{m=-\ell}^\ell Y_{\ell m}(\hat{\Omega})
\bar{u}_{lm}(r),
\end{equation}
where $\bar{Y}_\ell^m$ are the {\em real} spherical harmonics defined by
\begin{equation}
Y_{\ell m} = \begin{cases}
Y_\ell^0 & \mbox{if } m=0\\
{1\over 2}\left(Y_\ell^m+(-1)^m \, Y_\ell^{-m}\right) \ = \Re\left[Y_\ell^m\right]
%\sqrt{2} N_{(\ell,m)} P_\ell^m(\cos \theta) \cos m\varphi
& \mbox{if } m>0 \\
{1\over i 2}\left(Y_\ell^{-m}-(-1)^{m}\, Y_\ell^{m}\right) = \Im\left[Y_\ell^{-m}\right]
%\sqrt{2} N_{(\ell,m)} P_\ell^{-m}(\cos \theta) \sin m\varphi
&\mbox{if } m<0.
\end{cases}
\end{equation}
We need then to relate $\bar{u}_{\ell m}$ to $u_{\ell m}$.  We which
to express,
\begin{equation}
\Re\left[\phi(\vr)\right] = \sum_{\ell=0}^{\ell_\text{max}} \sum_{m=-\ell}^\ell
\Re\left[Y_\ell^m (\hat{\Omega}) u_{\ell m}(r)\right]
\end{equation}
in terms of $\bar{u}_{\ell m}(r)$ and $Y_{\ell m}$.
\begin{eqnarray}
\Re\left[Y_\ell^m u_{\ell m}\right] & = & \Re\left[Y_\ell^m\right]
\Re\left[u_{\ell m}\right] - \Im\left[Y_\ell^m\right] \Im\left[u_{\ell m}\right]
\end{eqnarray}
For $m>0$,
\begin{equation}
\Re\left[Y_\ell^m\right] = Y_{\ell m} \qquad \text{and} \qquad \Im\left[Y_\ell^m\right] = Y_{\ell\,-m}.
\end{equation}
For $m<0$,
\begin{equation}
\Re\left[Y_\ell^m\right] = (-1)^m Y_{\ell\, -m} \qquad \text and \qquad \Im\left[Y_\ell^m\right] = -(-1)^m Y_{\ell m}.
\end{equation}
Then for $m > 0$,
\begin{eqnarray}
\bar{u}_{\ell m} & = & \Re\left[u_{\ell m}\right] + (-1)^m \Re\left[u_{\ell\,-m}\right] \\
\bar{u}_{\ell\, -m} & = & -\Im\left[u_{\ell m}\right] + (-1)^m \Im\left[u_{\ell\,-m}\right].
\end{eqnarray}

\end{document}


\externaldocument{paper.tex}

\section{Local metric estimation}
\label{sec:Local-intrinsic-metric}

We will now present a few settings in which one can approximate the intrinsic metric merely from observed data. All these settings require some assumptions about the structure of the data in the latent intrinsic space which generates the observed data-set. The need for such prior knowledge is not very surprising, since in order to ``look beyond'' the observed manifold and calculate properties of the intrinsic geometry in the latent space, we must somehow estimate what distortion was applied to the manifold by the observation function. A prior assumption about the structure of the latent data serves as a sort of gauge of this distortion and by comparing the observed data structure to the
assumed latent structure we can, under certain setting, infer the effect of the observation function.

In this section we focus on local methods of metric estimation, these methods operate on small patches of the manifold for which the observation function can be approximated as a linear function using its local Jacobian. The settings discussed below are not in any way unique and one can think of a multitude of scenarios in which priors assumptions about the latent system allow us to estimate the local distortion imposed on data by the unknown observation function.

\subsection{Rigid sensor array}
\label{ssec:Rigid-sensor-array}

Consider the values of an observation function $f:\mathbb{R}^{n}\to\mathbb{R}^{m}$ observed at $\mathbf{x}+\hat{\mathbf{u}}$. According to the Taylor series approximation:
\[
f\left(\mathbf{x}+\hat{\mathbf{u}}\right)=f\left(\mathbf{x}\right)+\frac{df}{dx}\left(\mathbf{x}\right)\hat{\mathbf{u}}+\mathcal{O}\left(\left\Vert \hat{\mathbf{u}}\right\Vert \right)
\]
If the difference between the two measurements $\left\Vert \hat{\mathbf{u}}\right\Vert $ is small with respect to the higher derivatives of the function $f$ we get that:
\[
f\left(\mathbf{x}+\hat{\mathbf{u}}\right)-f\left(\mathbf{x}\right)\approx\frac{df}{dx}\left(\mathbf{x}\right)\hat{\mathbf{u}}
\]
If one observes the function at $k$+1 intrinsic points $\mathbf{x},\mathbf{x}+\hat{\mathbf{u}}_{1},\ldots,\mathbf{x}+\hat{\mathbf{u}}_{k}$
we get a set of such equations :

\begin{align*}
	f\left(\mathbf{x}+\hat{\mathbf{u}}_{1}\right)-f\left(\mathbf{x}\right)= & \frac{df}{dx}\left(\mathbf{x}\right)\hat{\mathbf{u}}_{1}\\
	\vdots\\
	f\left(\mathbf{x}+\hat{\mathbf{u}}_{\text{k}}\right)-f\left(\mathbf{x}\right)= & \frac{df}{dx}\left(\mathbf{x}\right)\hat{\mathbf{u}}_{k}+\mathbf{w}_{k}
\end{align*}
To simplify this we denote:
\begin{align*}
	\hat{\mathbf{U}}= & \left[\hat{\mathbf{u}}_{1}|\cdots|\hat{\mathbf{u}}_{k}\right]\\
	\mathbf{D}= & \left[f\left(\mathbf{x}+\hat{\mathbf{u}}_{1}\right)-f\left(\mathbf{x}\right)|\cdots|f\left(\mathbf{x}+\hat{\mathbf{u}}_{k}\right)-y\left(\mathbf{x}\right)\right]
\end{align*}
And get:
\[
\mathbf{D}=\frac{df}{dx}\left(\mathbf{x}\right)\hat{\mathbf{U}}
\]

If the vectors $\hat{\mathbf{u}}_{1},\hat{\mathbf{u}}_{2},\dots,\hat{\mathbf{u}}_{k}$ span the $n$-dimensional intrinsic space (i.e. the matrix $\hat{\mathbf{U}}$ has a full row rank), we can invert this relationship using the pseudo-inverse of $\hat{\mathbf{U}}$ matrix in order to recover the observation function Jacobian by:
\[
\mathbf{D}\hat{\mathbf{U}}^{T}\left[\hat{\mathbf{U}}\hat{\mathbf{U}}^{T}\right]^{-1}=\frac{df}{dx}\left(\mathbf{x}\right)
\]
This suggests a method for estimating the Jacobian of an unknown observation function, using an array of measurements with a known structure. $\mathbf{M}\left(\mathbf{y}\right)$ can then be estimated by:
\begin{equation}
\mathbf{M}\left(\mathbf{y}\right)=\frac{df}{dx}\left(\mathbf{x}\right)\frac{df}{dx}\left(\mathbf{x}\right)^{T}\approx\mathbf{D}\hat{\mathbf{U}}^{T}\left[\hat{\mathbf{U}}\hat{\mathbf{U}}^{T}\right]^{-1}\left[\hat{\mathbf{U}}\hat{\mathbf{U}}^{T}\right]^{-T}\hat{\mathbf{U}}\mathbf{D}\label{eq:array-est}
\end{equation}
We notice that if this array is rotated around the point $\mathbf{x}$ with a rotation matrix $\mathbf{R}$ we get a rotation of the estimated Jacobian:
\begin{align*}
	\mathbf{D}\left[\mathbf{R}\hat{\mathbf{U}}\right]^{T}\left[\mathbf{R}\hat{\mathbf{U}}\left[\mathbf{R}\hat{\mathbf{U}}\right]^{T}\right]^{-1} & =\mathbf{D}\hat{\mathbf{U}}^{T}\mathbf{R}^{T}\left[\mathbf{R}\hat{\mathbf{U}}\hat{\mathbf{U}}^{T}\mathbf{R}^{T}\right]^{-1}\\
	& =\mathbf{D}\hat{\mathbf{U}}^{T}\mathbf{R}^{T}\mathbf{R}^{-T}\left[\hat{\mathbf{U}}\hat{\mathbf{U}}^{T}\right]^{-1}\mathbf{R}^{-1}\\
	& =\mathbf{D}\hat{\mathbf{U}}^{T}\left[\hat{\mathbf{U}}\hat{\mathbf{U}}^{T}\right]^{-1}\mathbf{R}^{-1}\\
	& =\frac{df}{dx}\left(\mathbf{x}\right)\mathbf{R}^{-1}
\end{align*}
However the estimation of $\mathbf{M}\left(\mathbf{y}\right)$ in \cref{eq:array-est} is unaffected by this rotation:
\begin{equation}
\frac{df}{dx}\left(\mathbf{x}\right)\mathbf{R}^{-1}\left[\frac{df}{dx}\left(\mathbf{x}\right)\mathbf{R}^{-1}\right]^{T}=\frac{df}{dx}\left(\mathbf{x}\right)\mathbf{R}^{-1}\mathbf{R}^{-T}\cdot\left[\frac{df}{dx}\left(\mathbf{x}\right)\right]=\frac{df}{dx}\left(\mathbf{x}\right)\frac{df}{dx}\left(\mathbf{x}\right)^{T}
\end{equation}
This shows that the estimation suggested in (\cref{eq:array-est}) is invariant to a rigid rotation of the measurement directions $\hat{\mathbf{u}}_{1},\ldots,\hat{\mathbf{u}}_{n}$.
This invariance to a rotation makes this setting practical for intrinsic metric estimation, since one does not have to align the sensor array in any particular way with respect to the intrinsic axis and one can even allow this array to rotate between observations at different points. \cref{fig:Observation-with-a} shows the set of points observed using a sensor array of 3 directions (4 total measurements) for 10 points, where the intrinsic manifold $\mathcal{X}$ is a disk in 2-dimensional Euclidean space.

\begin{figure}[h]
	\begin{subfigure}[b]{0.48\columnwidth}%
			\includegraphics[width=1\textwidth]{figures/Chapter_4/sensor_array_example}
	\end{subfigure}\hfill
	\begin{subfigure}[b]{0.48\columnwidth}%
			\includegraphics[width=1\textwidth]{figures/Chapter_4/sensor_array_example_intrinic}
	\end{subfigure}
	\caption{Observation with a rigid sensor array Observation for $10$ representative points \label{fig:Observation-with-a}}
\end{figure}

While observation in $n$ linearly independent directions is sufficient in theory in order to estimate the function Jacobian, observation in more directions will make the estimation more robust in the presence of possible observation noise.

\subsection{Intrinsic isotropic Gaussian mixture model \label{ssec:Intrinsic-isotropic-GMM}}

Assume that the intrinsic data are sampled from an $n$-dimensional \ac{GMM} consisting of $N$ isotropic Gaussian distributions, all with known variance $\sigma_{int}^{2}$, where the means of these distributions are points on the intrinsic manifold which are denoted by $\left\{ \mathbf{x}_{i}\right\} _{i=1}^{N}=\mathcal{X}_{S}=\in\mathcal{X}$. $N_{i}$ points are sampled from the $i$-th Gaussian and we denote these points using a double index:
\[
{\bf x}_{i,j}\sim\mathcal{N}\left(\mathbf{x}_{i},\sigma_{int}^{2}I\right)
\]
This model is illustrated in \cref{fig:Intrinsic-Gmm-setting}. Sampled points are observed via an observation function $f:\mathbb{R}^{n}\to\mathbb{R}^{m}$ and are distorted by an \ac{AWGN} with variance $\sigma_{obs}^{2}$ introduced in the observation process resulting in observed data points:
\[
{\bf y}_{i,j}=f\left({\bf x}_{i,j}\right)+w_{i,j}
\]
where $w_{i,j}\sim\mathcal{N}\left(0,\sigma_{obs}^{2}\mathbf{I}\right)$. If the variance $\sigma_{int}^{2}$ of the intrinsic Gaussians is small with respect to the higher-derivatives of the observation function, each Gaussian cluster will only effectively experiences the local linear part of the observation function and one can regard the observed cluster generated by an intrinsic Gaussian as a Gaussian distribution with a transformed covariance and mean:.
\begin{equation}
{\bf y}_{i,j}=f\left({\bf x}_{i,j}\right)+w_{i,j}\sim\mathcal{N}\left(f\left(\mathbf{x}_{i}\right),\sigma_{int}^{2}\frac{df}{dx}\left(\mathbf{x}_{i}\right)\frac{df}{dx}\left(\mathbf{x}_{i}\right)^{T}+\sigma_{obs}^{2}\mathbf{I}\right)\label{eq:prob-pca}
\end{equation}
We see that the observed data also has the structure of a \ac{GMM} , however, the covariance of the observed Gaussians are anisotropic due to stretching and contraction induced by the observation function Jacobian. The distribution of a single observed Gaussian corresponds to the model presented in the probabilistic \ac{PCA} interpretation \cite{tipping1999probabilistic} where it is shown that the optimal estimator, in the maximum-likelihood sense, of the matrix $\frac{df}{dx}\left(\mathbf{x}_{i}\right)\frac{df}{dx}\left(\mathbf{x}_{i}\right)^{T}$ can be computed by performing \ac{PCA} and finding the $n$ most significant principle directions of the observed sample covariance
matrix $\mathbf{S}_{i}$:
\[
\begin{aligned}{\bf \bar{y}}_{i} & =\frac{1}{N_{i}}\sum_{j=1}^{N_{i}}{\bf y}_{i,j}\\
\mathbf{S}_{i} & =\frac{1}{N_{i}}\sum_{j=1}^{N_{i}}\left[{\bf y}_{i,j}-{\bf \bar{y}}_{i}\right]\left[{\bf y}_{i,j}-{\bf \bar{y}}_{i}\right]^{T}
\end{aligned}
\]
This matrix can be decomposed using spectral decomposition:
\[
\mathbf{S}_{i}=\left[\mathbf{u}_{1}\mathbf{u}_{2}\cdots\mathbf{u}_{n}\cdots\mathbf{u}_{m}\right]\left[\begin{array}{ccccc}
\sigma_{1}^{2} & 0 & 0 & \ldots & 0\\
0 & \ddots & 0 & \ldots & \vdots\\
0 & 0 & \sigma_{n}^{2} & \ldots & 0\\
\vdots & \vdots & \vdots & \ddots & \vdots\\
0 & \ldots & 0 & \ldots & \sigma_{m}^{2}
\end{array}\right]\left[\begin{array}{c}
\mathbf{u}_{1}^{T}\\
\mathbf{u}_{2}^{T}\\
\vdots\\
\vdots\\
\mathbf{u}_{n}^{T}\\
\vdots\\
\mathbf{u}_{m}^{T}
\end{array}\right]
\]
And the maximum-likelihood estimator is given by \cite{tipping1999probabilistic}:
\begin{equation}
\begin{aligned}\frac{df}{dx}\left(\mathbf{x}_{i}\right)\frac{df}{dx}\left(\mathbf{x}_{i}\right)^{T} & \approx\left[\mathbf{u}_{1}\mathbf{u}_{2}\cdots\mathbf{u}_{n}\right]\left[\begin{array}{ccccc}
\sigma_{1}^{2}-\bar{\sigma^{2}} & 0 & 0 & \ldots & 0\\
0 & \ddots & 0 & \ldots & \vdots\\
0 & 0 & \sigma_{n}^{2}-\bar{\sigma^{2}} & \ldots & 0\\
\vdots & \vdots & \vdots & 0 & \vdots\\
0 & \ldots & 0 & \ldots & 0
\end{array}\right]\left[\begin{array}{c}
\mathbf{u}_{1}^{T}\\
\mathbf{u}_{2}^{T}\\
\vdots\\
\vdots\\
\mathbf{u}_{n}^{T}
\end{array}\right]\\
\bar{\sigma^{2}} & =\frac{1}{m-n}\sum_{k=n+1}^{m}\sigma_{k}^{2}
\end{aligned}
\end{equation}
Assuming that we know the clustering structure of observed measurements (i.e. we know which observation points originate from the same Gaussian)
we can estimate $\mathbf{M}\left({\bf y}_{i}\right)=\frac{df}{dx}\left(\mathbf{x}_{i}\right)\frac{df}{dx}\left(\mathbf{x}_{i}\right)^{T}$ for each observed Gaussian separately. This setting is similar to the setting presented in \cite{singer2008non} where short bursts of diffusion processes with isotropic diffusion were used, resulting in an approximate intrinsic \ac{GMM} process and leading to the same estimator of the intrinsic metric using local application of \ac{PCA}.

\begin{figure}[h]
	\begin{centering}
		\includegraphics[width=0.6\textwidth]{figures/Chapter_4/intrinsic_GMM_model}
	\end{centering}
	\caption[Intrinsic \ac{GMM} setting]{Intrinsic \ac{GMM} setting. $10$ representative Gaussians from the mixture model are visualized in the intrinsic space for the case where $\mathcal{X}$ is a disk in 2-dimensional Euclidean space \label{fig:Intrinsic-Gmm-setting}}
\end{figure}

\subsection{Intrinsic diffusion process\label{ssec:Intrinsic-diffusion-processes}}

Data often originates from observation of a latent dynamical system over time. In such situations, information is not encoded only in the measurement values but also in time at which these measurements were received. Prior knowledge about the statistical model of the latent system combined with this temporal information can be used in order to estimate the intrinsic metric.

Here we present a setting where a latent system governed by a single continuous diffusion process, as is encountered in many scientific fields, allows one to estimate the local intrinsic metric from the observed measurement process. Consider an $n$-dimensional Itô process governed by the following \ac{SDE} :
\[
d\mathbf{x}\left(t\right)=\mu_{int}\left(\mathbf{x}\left(t\right)\right)\cdot dt+\sigma_{int}dB\left(t\right)
\]
A scalar observation function $f:\mathbb{R}^{n}\to\mathbb{R}$ is
applied to this process creating the observation process $f\left(\mathbf{x}\left(t\right)\right)$
. According to Itô's lemma \cite{karatzas2012brownian} we get that
the observed process propagates according to the following \ac{SDE}:
\[
df\left(\mathbf{x}\left(t\right)\right)=\left(\frac{df}{dx}\left(\mathbf{x}\left(t\right)\right)\mu_{int}\left(\mathbf{x}\left(t\right)\right)+\text{Tr}\left(\frac{d^{2}f}{dx^{2}}\left(\mathbf{x}\left(t\right)\right)\frac{\sigma_{int}^{2}}{2}\right)\right)dt+\sigma_{int}\frac{df}{dx}\left(\mathbf{x}\left(t\right)\right)dB\left(t\right)
\]
To simplify this equation we denote:
\[
\mathbf{\mu}_{obs}\left(\mathbf{x}\left(t\right)\right)=\frac{df}{dx}\left(\mathbf{x}\left(t\right)\right)\mu_{int}\left(\mathbf{x}\left(t\right)\right)+\text{Tr}\left(\frac{d^{2}f}{dx^{2}}\left(\mathbf{x}\left(t\right)\right)\frac{\sigma_{int}^{2}}{2}\right)
\]
And get:
\[
df\left(\mathbf{x}\left(t\right)\right)=\mathbf{\mu}_{obs}\left(\mathbf{x}\left(t\right)\right)dt+\sigma_{int}\frac{df}{dx}\left(\mathbf{x}\left(t\right)\right)dB\left(t\right)
\]
We can easily consider the case where the observation function is a $m$-dimensional vector function $f:\mathbb{R}^{n}\to\mathbb{R}^{m}$ which leads to a set of such equations for each dimension that can be written in matrix form:
\[
df\left(\mathbf{x}\left(t\right)\right)=\mathbf{\mu}_{obs}\left(\mathbf{x}\left(t\right)\right)dt+\sigma_{int}\frac{df}{dx}\left(\mathbf{x}\left(t\right)\right)dB\left(t\right)
\]
An observation of such an intrinsic diffusion process is described in \cref{fig:Diffusion-process-observation}.
\begin{figure}[h]
	\centering{}\includegraphics[width=1\textwidth]{figures/Chapter_4/diff_set}\caption{Diffusion process observation\label{fig:Diffusion-process-observation}}
\end{figure}
Observing this process at equally spaced time-intervals results in a discreet process which can be, according to the Euler–Maruyama schema\cite{kloeden1992numerical}, approximately described by the following discrete stochastic difference equation:
\[
f\left(\mathbf{x}\left[k+1\right]\right)=f\left(\mathbf{x}\left[k\right]\right)+\mathbf{\mu}_{obs}\left(\mathbf{x}\left[k\right]\right)\triangle t+\sigma_{int}\frac{df}{dx}\left(\mathbf{x}\left[k\right]\right)W\left[k\right]\triangle t
\]
Where $\triangle t$ is the sampling interval and $W\left[k\right]$
is a discrete white Gaussian noise process with unit variance. To
further simplify this we re-denote:
\begin{align*}
	\mu_{obs}\left(\mathbf{x}\left[k\right]\right)= & \mathbf{\mu}_{obs}\left(\mathbf{x}\left[k\right]\right)\triangle t\\
	\sigma_{int}= & \sigma_{int}\triangle t
\end{align*}
And get the following difference equation:
\[
f\left(\mathbf{x}\left[k+1\right]\right)-f\left(\mathbf{x}\left[k\right]\right)=\mathbf{\mu}_{obs}\left(\mathbf{x}\left[k\right]\right)+\sigma_{int}\frac{df}{dx}\left(\mathbf{x}\left[k\right]\right)W\left[k\right]
\]
This states that the difference process of the discretely sampled observation process has an approximately normal distribution with the following distribution:
\begin{equation}
f\left(\mathbf{x}\left[k+1\right]\right)-f\left(\mathbf{x}\left[k\right]\right)\sim\mathcal{N}\left(\mathbf{\mu}_{obs}\left(\mathbf{x}\left[k\right]\right),\sigma_{int}^{2}\frac{df}{dx}\left(\mathbf{x}\left[k\right]\right)\frac{df}{dx}\left(\mathbf{x}\left[k\right]\right)^{T}\right)\label{eq:dist_diff}
\end{equation}
We can also consider the possibility \ac{AWGN} being introduced in the observation process and get the following equation for the observation process:
\begin{equation}
\mathbf{y}\left[k+1\right]-\mathbf{y}\left[k\right]\sim\mathcal{N}\left(\mathbf{\mu}_{obs}\left(\mathbf{x}\left[k\right]\right),\sigma_{int}^{2}\frac{df}{dx}\left(\mathbf{x}\left[k\right]\right)\frac{df}{dx}\left(\mathbf{x}\left[k\right]\right)^{T}+\sigma_{obs}^{2}\mathbf{I}\right)
\end{equation}
This indicates that the difference process can be seen as being sampled from a Gaussian distribution whose covariance and drift are location dependent. A straightforward method to estimate $\mathbf{M}\left(\mathbf{y}_{i}\right)$ for a specific observation point $\mathbf{y}_{i}$ is to look for all observation time indexes $k$ for which $\mathbf{y}[k]\approx\mathbf{y}_{i}$ and donate this set by $K_{\mathbf{y_{i}}}$:
\[
K_{\mathbf{y_{i}}}=\left\{ k|\mathbf{y}[k]\approx\mathbf{y}_{i}\right\}
\]

If the observation function is sufficiently smooth and invertible, observations which are close enough to each other in the observation space originate from similar intrinsic points and therefor experience similar observation function Jacobians. As a result the observed process ``jumps'' $f\left(\mathbf{x}[k+1]\right)-f\left(\mathbf{x}[k]\right)$ for all $k\in K_{\mathbf{y_{i}}}$ will be distributed with very similar Gaussian distributions. \cref{fig:Process-jump-clustering} illustrates how three points from the observed process which are ``close-enough'' to each other in the observation space can be clustered together. The three process ``jumps'' originating from these three points are all approximately distributed with the same distribution. Gathering enough such ``jumps'' from a single location allows us to estimate the covariance matrix and the intrinsic metric again by performing local \ac{PCA} as described in \cref{ssec:Intrinsic-isotropic-GMM} and \cite{tipping1999probabilistic}.

\begin{figure}[h]
	\centering{}\includegraphics[width=1\textwidth]{figures/Chapter_4/cluster_for_metric}\caption{Process jump clustering \label{fig:Process-jump-clustering}}
\end{figure}

This method clusters together vectors of the observed difference process which are almost identically distributed according to (\cref{eq:dist_diff}). If these clusters are disjoint this results in independent Gaussians distributions and leads again to an observed \ac{GMM} as in \cref{ssec:Intrinsic-isotropic-GMM}. However, in general this clusters are not necessarily disjoint and the different Gaussian distributions are not independent of each other, in such cases this estimator can only be regarded as a heuristic approximation of the true maximum-likelihood estimator.

Diffusion processes were used in \cite{singer2008non} in order to expose the intrinsic metric, however they were used in a different setting where multiple burst of intrinsic diffusion processes starting from the same initial state were used, a setting which is less realistic and is applicable mainly for dimensionality reduction of complex non-linear systems which admit simulations as in


    \filetitle{regress}{Ordinary or weighted least-square regression}{tseries/regress}

	\paragraph{Syntax}\label{syntax}

\begin{verbatim}
[B,BStd,E,EStd,YFit,Range,BCov] = regress(Y,X)
[B,BStd,E,EStd,YFit,Range,BCov] = regress(Y,X,Range,...)
\end{verbatim}

\paragraph{Input arguments}\label{input-arguments}

\begin{itemize}
\item
  \texttt{Y} {[} tseries {]} - Tseries object with independent (LHS)
  variables.
\item
  \texttt{X} {[} tseries{]} - Tseries object with regressors (RHS)
  variables.
\item
  \texttt{Range} {[} numeric {]} - Date range on which the regression
  will be run; if not specified, the entire range available will be
  used.
\end{itemize}

\paragraph{Output arguments}\label{output-arguments}

\begin{itemize}
\item
  \texttt{B} {[} numeric {]} - Vector of estimated regression
  coefficients.
\item
  \texttt{BStd} {[} numeric {]} - Vector of std errors of the estimates.
\item
  \texttt{E} {[} tseries {]} - Tseries object with the regression
  residuals.
\item
  \texttt{EStd} {[} numeric {]} - Estimate of the std deviation of the
  regression residuals.
\item
  \texttt{YFit} {[} tseries {]} - Tseries object with fitted LHS
  variables.
\item
  \texttt{Range} {[} numeric {]} - The actually used date range.
\item
  \texttt{bBCov} {[} numeric {]} - Covariance matrix of the coefficient
  estimates.
\end{itemize}

\paragraph{Options}\label{options}

\begin{itemize}
\item
  \texttt{'constant='} {[} \texttt{true} \textbar{}
  \emph{\texttt{false}} {]} - Include a constant vector in the
  regression; if true the constant will be placed last in the matrix of
  regressors.
\item
  \texttt{'weighting='} {[} tseries \textbar{} \emph{empty} {]} -
  Tseries object with weights on the observations in the individual
  periods.
\end{itemize}

\paragraph{Description}\label{description}

This function calls the built-in \texttt{lscov} function.

\paragraph{Example}\label{example}


\documentclass[12pt]{article}
\usepackage[usenames]{color} %used for font color
\usepackage{amsmath, amssymb, amsthm}
\usepackage{wasysym}
\usepackage[utf8]{inputenc} %useful to type directly diacritic characters
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{float}
\usepackage{mathtools}
\usepackage [english]{babel}
\usepackage [autostyle, english = american]{csquotes}
\MakeOuterQuote{"}
\graphicspath{ {./} }
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\prob}{\mathbb{P}}
\newcommand{\degrees}{^{\circ}}
\DeclarePairedDelimiter\ceil{\lceil}{\rceil}
\DeclarePairedDelimiter\floor{\lfloor}{\rfloor}

\author{Tianshuang (Ethan) Qiu}
\begin{document}
\title{Math 104, HW9}
\maketitle
\newpage

\section{Q1}
\subsection{a}
To show that the inverse $g$ as defined in the problem is a function, we simply need to show that each unique input has a single output. This implies that our function $f$ must be injective on to $\R$, which is to say $f(a) = f(b) \iff a = b$.
\newline
We can assume that there exists $x_0, x_1 \in I$ such that $f(x_0) = f(x_1)$.
Then by the Mean Value Theorem we know that there is a point $y \in (x_0, x_1)$ where $f'(y) = \frac{f(x_0)-f(x_1)}{x_0-x_1}=0$
However the problem specifies that $f'(x) \not= 0$, therefore our assumption is incorrect and $f$ must be injective to $\R$. Thus its inverse $g$ exists.

\subsection{b}
We claim that $f$ is monotone. Since $f'(a) = \lim_{x \to a}\frac{f(x)-f(a)}{x-a}$ exists, we know that it satisfies the epsilon-delta property at $a$. Since $f$ is differentiable, its derivative is defined on all $I$. Therefore each point in $I$ also must satisfy the epsilon-delta property, and $f'$ is therefore continuous. Now since it is continuous, if $f'(b)>0$ and $f'(c)<0$ for some $b,c \in I$, then by Intermediate Value Theorem there must be $d \in (b,c)$ such that $f(d)=0$. However we know that to be false, therefore $f$ is monotone.
\newline
Let $\epsilon > 0, y_0 \in f(I), x_0 \in \R$ such that $f(x_0)=y_0$. Without loss of generality assume that $f$ is monotonically increasing. Therefore $f(x_0-\epsilon) < f(x_0) < f(x_0+\epsilon)$.
Now we can simply take $\delta = \min\{f(x_0)-f(x_0-\epsilon), f(x_0+\epsilon) - f(x_0)\}$. Then for any $|y_1-y_0|<\delta$, let $f(x_1)=y_1$, then $x_0-\epsilon < x_1 < x_0 + \epsilon$ by monoticity. Thus $g$ is continuous.
\newline
If $f$ is monotonically decreasing we can simply repeat the above argument but with the signs flipped since if $a > b$, now we will have $f(b) > f(a)$
\newpage

\section{Ross 30.2}
\subsection{a}
$\sin(0)-0=0$, so we attempt to use l'hospital's rule. Assume that the limit exists, then it must be equal to
$$\lim_{x \to 0}\frac{x^2}{\cos x} = \lim_{x \to 0}\frac{0}{1} = 0$$
Therefore the limit is 0

\subsection{b}
For this problem we need to use l'hoospital's rule 3 times
$$\lim_{x \to 0} \frac{\tan x-x}{x^3} = \lim_{x \to 0} \frac{\sec^2 x-1}{3x^2} = \lim_{x \to 0}\frac{2\tan(x)\sec^2(x)}{6x}$$
$$= \lim_{x \to 0}\frac{2 \sec^2x (\sec^2(x) + 2 \tan^2(x))}{6} = \frac{2}{6} = \frac{1}{3}$$
We used the chain rule for the second step, both the chain rule and the product rule for the third step.

\subsection{c}
We combine these fractions, then apply l'hospital's rule twice:
$$\lim_{x\to 0}\frac{x-\sin x}{x\sin x} = \lim_{x\to 0}\frac{1-\cos x}{\sin x + x\cos x} = \lim_{x\to 0}\frac{\sin x}{\cos x + \sin x - x \sin x} $$
$$= \lim_{x\to 0}\frac{0}{1} = 0$$

\subsection{d}
We know that if $\lim_{x \to a} f(x)=b, \lim_{x \to b} g(x)=c$, then $\lim_{x \to a}g(f(x)) = g(\lim_{x \to a}f(x))$. Assume that the limit does exist for our expression, and since the natural log is continuous, we can apply this theorem.
\newline
$$\ln(\lim_{x \to 0} \cos x ^{1/x^2}) = \lim_{x \to 0} \ln(\cos x^{1/x^2}) = \lim_{x \to 0}\frac{\ln(\cos x)}{x^2}$$
Now we can use l'hospital's Theorem
$$=\lim_{x \to 0}\frac{-\sin x / \cos x}{2x} = \lim_{x \to 0}\frac{- \sec^2 x}{2} = -\frac{1}{2}$$
Now to find $\lim_{x \to 0} \cos x ^{1/x^2}$, we simply apply the inverse of the natural log:
$$e^\frac{-1}{2} = \frac{1}{\sqrt e}$$
\newpage

\section{Q3}
\subsection{a}
Since $x_n \to \infty$, $x_n$ get can arbitrarily large. More rigorously, for any $r \in \R$, there exists $n \in \N$ such that if $m > n$, $x_m > r$
\newline
Consider $y_n = \frac{1}{x_n}$. Let $\epsilon > 0$, let $\epsilon_0 = \max \{ \frac{1}{\epsilon}, 1\}$. Find $n \in \N$ such that $x_n > \epsilon 0$, which we know exists as we have shown above.
Now since $\epsilon_0 > 0$, we know that $x_n, y_n$ are positive, so we have $|y_n| = |\frac{1}{x_n}| < |\frac{1}{\epsilon_0}| \leq \epsilon$
\newline
Thus we have shown that $|y_n|$ can get arbitrarily small, therefore $y_n \to 0$
\newline
$\blacksquare$

\subsection{b}
Since $\ln_{x \to a} f(x) = \infty$, then for any $r \in \R$, there exists a $\delta > 0$ such that $|x-a|<\delta \implies f(x)>r$
\newline
Let $g(x)=\frac{1}{f(x)}$. We know that $g$ is well defined since $f(x)\not = 0$ for $x \in (a,b)$. Let $\epsilon > 0$, take $\epsilon_0 = \max \{ \frac{1}{\epsilon}, 1\}$. Find $\delta > 0$ such that $f(a+\delta) > \epsilon_0$, which we know exists as we have shown above.
\newline
$|g(a+\delta)| < \frac{1}{\epsilon_0} \leq \epsilon$ We have shown thata $|g(x)|$ gets arbitrarily small when $x$ is close to $a$, therefore $\lim_{x\to a}\frac{1}{f(x)}=0$
\newline
$\blacksquare$
\newpage

\section{Q4}
Let $P$ be a partition such that $P=\{t_1 = a < t_2 < ... < t_n = b \}$, furthermore let $P$ be evenly spaced such that $t_i-t_{i-1}$ is equal for all $1<i<n$. Let $M(s)$ denote the supremum of $f$ in a set $s$, and $m(s)$ the infimum.
\newline
We find the upper and lower Darboux Sum. Since $f(x)=x$, if $x_0 > x_1, f(x_0)>f(x_1)$, so the infimum is at the lower bound of the interval and the supremum the upper bound.
$$U(f, P) = \sum_{i=1}^n M(s)(t_i-t_{i-1}) = \sum_{i=1}^n (t_i)(t_i-t_{i-1})$$
$$L(f, P) = \sum_{i=1}^n m(s)(t_i-t_{i-1}) =  \sum_{i=1}^n (t_{i-1})(t_i-t_{i-1})$$
Since $P$ is evenly spaced, we know that $t_i = a + (b-a)i/n$
\newline
Let $\epsilon > 0$, consider $U(f,P)-L(f,P)$, we can combine the sums to get
$$U(f,P)-L(f,P) = \sum_{i=1}^n (t_i-t_{i-1})(t_i-t_{i-1}) = \frac{(b-a)^2}{n}$$
Now for any $\epsilon > 0$ we simply need to choose $n > (b-a)^2/\epsilon$, which implies that $U(f,P)-L(f,P) < \epsilon$. Since it is less than any positive number and $U(f,P) \geq L(f,P)$, we have $U(f) = L(f)$ and the function is integrable.
\newline
In order to find U(f) we need to subsitute $U(f, P) = \sum_{i=1}^n (t_{i})(t_i-t_{i-1}) = \sum_{i=1}^n (a + (b-a)i/n)((b-a)/n) = (b-a)/n(\frac{((a+ (b-a)/n) + b)n}{2})$
\newline
The last step is using the sum of an arithmetic sequence, now we can tidy up to see that $U(f, P) = \frac{(b-a)(a+(b-a)/n) + b}{2}$. Since $U(f)$ is the infimum of the set $U(f, P)$ where $P$ is a partition, and we know that this sum is minimized as $n \to \infty$ since the term $(b-a)/n \to 0$ as proven in the last problem.
Thus we have found
$$U(f) = \lim_{n \to \infty}  \frac{(b-a)(a+(b-a)/n) + b}{2} = \frac{(b-a)(b+a)}{2}$$
\newpage

\section{Ross 32.6}
Since $f$ is bounded, we know that $U_n, L_n$ are finite. Therefore we have $\lim U_n - \lim L_n = 0$. Since we know that $U(f,P)$ where $P$ is a partition has an infimum at $U(f)$ and similarly $L(f,P)$ has a supremum at $L(f)$.
We have $\lim U_n = \lim L_n$, and that $U_n \geq L_n$ with the equivalence happening if and only if they are the infimum and the supremums and the function is integrable.
We must have $\lim L_n = L(f)$ and $\lim U_n = U(f)$. Since $L(f)=U(f)$, the function is integrable. Thus we have
$$\int_a^n f = L(f)=U(f) = \lim L_n = \lim U_n$$
\newpage

\subsection{Q6}
We essentially have to show that since this is a finite subset, we can create finitely many "thin rectangles" around each of these points. These rectangles have negligible width and converges to 0.
\newline
For any $s_n \in S$, for ease of notation let $f(s_n) = y_n$. Now we consider the upper and lower Darboux sums of this function.
\newline
We define our partition $P$ as such: $P = \{a, s_n-\delta, s_n+\delta, b \}$ for each $s_n \in S$ with $\delta>0$(if $a \in S$ or $b \in S$,
our first partitions become $\{a, a+\delta, ...\}$ or our last partitions become $\{..., b-\delta, b\}$).
Since $S$ is finite, we can iterate through all the points in it with the above expression.
\newline
For the lower sum, since each partiton contains some points that are not in $S$, the infimum for every partiton is $0$, and we have $U(f,P) = 0$
\newline
For the upper sum, each partition that doesn't contain a point in $S$ has a supremum of $0$, a partiton $[s_n-\delta, s_n+\delta]$ has a supremum at $s_n$ with a value of $y_n$. So we have
$$U(f,P) \leq 2\delta \sum_{i=1}^n y_i$$
If $a$ or $b$ is in $S$, the above inequality still holds since our interval would only be $\delta$ instead of $2\delta$ and $\delta < 2\delta$
\newline
Let $z = \max \{y_1, y_1, ..., y_n\}$. For any $\epsilon >0$, choose $\delta = \frac{\epsilon}{4nz}$. Now consider our inequality:
$$U(f,P) \leq 2\delta \sum_{i=1}^n y_i \leq 2\delta nz = \frac{\epsilon}{2} < \epsilon$$
Thus we have shown that $U(f,P)$ can be less than any positive number, and we also know that $U(f,P) \geq L(f,P)=0$ so we have $U(f,P)=L(f,P)=0$. Thus the function is integrable.
\newline
Since this equivalency can only happen if $U(f,P)=U(f)$ and $L(f,P)=L(f)$, we have $\int_a ^b f = 0$
\newpage

\section{Q7}
Let $P$ be an equi-distant partition of $[0, \pi/2]$. We compute the upper and lower Darboux sums:
$$U(f, P) = \sum_{i=1}^n M(s)(t_i-t_{i-1})$$
$$L(f, P) = \sum_{i=1}^n m(s)(t_i-t_{i-1})$$
Since we know that $\sin x$ is monotonically increasing in our domain, so $M([a,b]) = \sin(b), m([a,b]) = \sin(a)$.
\newline
Since $P$ is equi-distant, we have $t_i = a + (b-a)i/n$, so when we take $U(f,P)-L(f,P)$, we can get a clean telescopic series:
$$U(f,P)-L(f,P) = \sum_{i=1}^n \sin(a + (b-a)\frac{i}{n})(b-a)/n - \sin(a + (b-a)\frac{i-1}{n})(b-a)/n)$$
$$= \frac{b-a}{n}(\sin b - \sin a)$$
We know that $a=0, b = \pi/2$, so we have $U(f,P)-L(f,P) = \frac{\pi}{2n}1$
\newline
For any $\epsilon > 0$, pick $n > \max \{\frac{\pi}{2\epsilon}, 1\}$. After partitioning $[0, \pi/2]$ into $n$ equal partitions, the difference between our upper and lower sum is $\frac{\pi}{2n} < \frac{\pi}{\epsilon \pi} = \epsilon$
Thus we have shown that the difference between $U(f,P)$ and $L(f,P)$ can get arbitrarily small. Therefore the two converges to the same number, and $\sin x$ is integrable on our interval.
\end{document}