% begin preamble
\documentclass[11pt,titlepage]{article}
\usepackage[margin=1in,noheadfoot]{geometry}
\usepackage[parfill]{parskip}
\usepackage{graphicx}
\usepackage[colorlinks,urlcolor=blue]{hyperref}
\usepackage{amssymb}
\usepackage{amsbsy}
\usepackage{wrapfig}

\newcommand{\e}[1]{\times 10^{#1}}
\newcommand{\q}{\mathrm}
\newcommand{\where}[1][where]{\qquad\mbox{#1}\qquad}
\newcommand{\bs}[1]{\boldsymbol{#1}}
\newcommand{\bh}[1]{\hat{\boldsymbol{#1}}}
\newcommand{\bv}[1]{\vec{\boldsymbol{#1}}}
\newcommand{\bt}[1]{\tilde{\boldsymbol{#1}}}
\newcommand{\ad}{^{\dagger}}
\newcommand{\flow}[1]{\mathcal{E}_{#1}}
\newcommand{\flux}[1]{\Phi_{#1}}
\newcommand{\dslash}{d \hspace{-0.5ex}\rule[1.2ex]{0.6ex}{.1ex}}
\newcommand{\ts}{\textsuperscript}
\def\rcurs{{\mbox{$\resizebox{.16in}{.08in}{\includegraphics{ScriptR}}$}\!\!}}
\def\brcurs{{\mbox{$\resizebox{.16in}{.08in}{\includegraphics{BoldR}}$}\!\!}}
\def\hrcurs{{\mbox{$\hat \brcurs$}\!}}
%end preamble

\begin{document}
\begin{center}
  {\bf University of Kentucky, Physics 335 \\
    Homework \#2, Rev. B, due Thursday, 2021-10-13 }
\end{center}

\vspace{.3 in}

{\bf 1-d. Gaussian Moments}---In this homework we will learn the techniques for evaluating Gaussian intetegrals, and to use them to investigate the covariance of the joint Gaussian integral.

{\bf \quad a)} We saw in H01 that a 2-d Gaussian was much easier to generate than 1-d because of its natural Jacobian for $\chi^{2}$.  Integrate $I_{0}^{2}=\int_{-\infty}^{\infty} dx_{1}\int_{-\infty}^{\infty}dx_{2}\, e^{-\chi^{2}/2}$, where $\vec\chi=(x_{1},x_{2})$ in cylindrical coordinates to normalize the 2-d Gaussian, as in H01 2a).  Show that this is the square of $I_{0}=\int_{-\infty}^{\infty} dz\,e^{-z^{2}/2}$ for $\vec \chi=(z)$. Use this fact to normalize the 1-d Gaussian.  [bonus: and by extension, any dimension]

{\bf \quad b)} Perform a change-of-variables to $\alpha x^{2}=\chi^{2}/2$ on the above two integrals to evaluate $I_{n}(\alpha)=\int_{0}^{\infty} dx\, x^{n} e^{\alpha x^{2}}$ for $n=0,1$. Take the derivative with respect to $\alpha$ of both sides of the above integral indentities repeatedly to evaluate $I_{n}$ for $n=2,3,\ldots$.

{\bf \quad c)} [bonus: Make the factorials hidden in b) explicit by transforming $I_{n}$ to the \href{https://en.wikipedia.org/wiki/Gamma_function}{Gamma function} $\Gamma(\nu)=\int_{0}^{\infty}t^{\nu-1}e^{-t}$.  As in a), show that $\Gamma(\nu+1)=\nu\Gamma(\nu)$, $\Gamma(0)=1$ and $\Gamma(\frac12)=\sqrt\pi$.  Thus $\Gamma(n+1)=n!$ for $n\in\mathbb{N}$ and $\Gamma(\nu)$ is a generalization of the factorial to all real numbers.]

{\bf \quad d)} In 1-d, transform $z=(x-\mu)/\sigma$ and use the moments $I_{n}$ to show that $\mu$ and $\sigma$ are the {\it mean} and {\it standard deviation} of the Gaussian distribution, respectively.

{\bf 2-d. Gaussian Generator (Reprise)}---The general 2-d Gaussian, including both the {\it variances} $\sigma^{2}_{x}$, $\sigma^{2}_{y}$ and {\it covariance} $\sigma^{2}_{xy}=\sigma^{2}_{yx}$, takes the form $p_{G}(x_{1},x_{2})=N e^{-\chi^{2}/2}$, where $N$ is the normalization, $\vec\chi = \vec x-\vec \mu = (x_{1}-\mu_{1}, x_{2}-\mu_{2})$, is the vector of {\it deviances}, and $\chi^{2} = \vec\chi\cdot\vec\chi = \chi^{T} W \chi$ is {\it weighted} by the {\it metric} $W=\Sigma^{-1}$, which is the inverse of the symmetric {\it covariance matrix} $\Sigma={\small\pmatrix{\sigma_{x}^{2} & \sigma_{xy}^{2} \cr \sigma_{yx}^{2} & \sigma_{y}^{2} }}$.

If all covariances vanish (for example, in 1-d), this reduces to $\chi^{2}=z_{1}^{2}+z_{2}^{2}+\ldots$ as previously discussed, where the variances are absorbed into $z_{i}=(x_{i}-\mu_{i})/\sigma_{i}$, as before.  In this case the distribution factorizes into the simpler product $p_{G}(z_{1},z_{2},\ldots)=p_{G}(z_{1})p_{G}(z_{2})\cdots$  of 1-d Gaussians.  Otherwise, one must transform to new variables $\vec\chi'=(u_{1},u_{2},\ldots)$ to perform this factorization.

{\bf \quad a)} To generate a $p_{G}(x_{1},x_{2})$ with covariance, let $u=x+y$ and $v=x-y$ be independent.  Generate $n=$100,000 random points $(u,v)$ centered at $\vec\mu=(0,0)$ with $\sigma_{u}=1$ and $\sigma_{v}=2$.  Draw a {\it scatter plot} of $(x,y)$. [bonus: draw the $u$ and $v$ axes on the same plot]

{\bf \quad b)} Calculate the means $\mu_{x}$, $\mu_{y}$, variances $\sigma^{2}_{x}=\sigma^{2}_{xx}$, $\sigma^{2}_{y}=\sigma^{2}_{yy}$, and covariance $\sigma^{2}_{xy}$, where $\sigma^{2}_{ij}=\sum (x_{i}-\mu_{i})(x_{j}-\mu_{j})/n$, for $i,j=x,y$.  Calculate the {\it correlation coefficient} $r={\sigma_{xy}}/\sigma_{x}\sigma_{y}$.

{\bf \quad c)} Derive the distribution $p_{G}(x,y)$ from $p_{G}(u)$ and $p_{G}(v)$ used in a) to determine the covariance matrix $\Sigma$ and compare with b). [bonus: graph the contours $\chi^{2}=1$ and $\chi^{2}=2$ in a)]

{\bf \quad d)} [bonus: plot a 2d histogram of $(x,y)$ and calculate the $\chi^{2}$ statistic on all bins with greater than 10 entries.  What is the likelihood of the these random points following this distribution?]

{\bf \quad e)} [bonus: Describe the procedure for generating random pairs $(x,y)$ from a general Gaussian distribution with means $\vec\mu$ and covariances $\Sigma$.  How does this generalize to higher dimension?]

%{\bf \quad a)} Calculate the moments $M_{n_{1}n_{2}}=\int x_{1}^{n_{1}}dx_{1}x_{2}^{n_{2}}dx_{2}\, p_{G}(x_{1},x_{2})$ for $n_{0,1}=0,1,2$ to normalize $p_{G}$ and confirm the $\mu_{i}=\langle x_{i}$, variances $\Sigma_{i}=\langle x_{i}^{2}\rangle$, and covariance $\Sigma_{12}=\langle x_{1}x_{2}\rangle$ of $p_{G}$.

% For $\vec\mu=(2,1)$ and $\Sigma=\pmatrix{}$

% This readily generalizes to the $n$-dimensional Gaussian with the $n$-vector $\chi$ and $n\times n$ covariance matrix $\Sigma=W^{-1}$.

\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
