\documentclass[12pt]{article}

\usepackage{hyperref}

\usepackage{amssymb, amsmath, lineno, amsthm, pdfsync}

\tolerance=2000
\textwidth 6.55in
\textheight 9.0in
\oddsidemargin 0.001in
\evensidemargin 0.001in
\topmargin -0.4in

\newtheorem{theorem}{Theorem}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{theoremnonum}{Theorem} 
\newtheorem{definition}{Definition}[section] 
\newtheorem{lemma}[theorem]{Lemma} 
\newtheorem{corollary}[theorem]{Corollary} 
\newtheorem{claimnonum}{Claim} 
\newtheorem{mycomment}{comment}[section] 
\newtheorem{conjecture}[theorem]{Conjecture} 
\newtheorem{problem}{Problem} 
\newcommand{\finishproof}{~$\Box$}
\newtheorem{remark}{Remark} 


\newcommand{\AND}{\; \wedge \;}

\newcommand{\SAT}{{\sf SAT}}
\newcommand{\DTIME}{{\sf DTIME}}
\newcommand{\NTIME}{{\sf NTIME}}
\newcommand{\DSPACE}{{\sf DSPACE}}
\newcommand{\NSPACE}{{\sf NSPACE}}
\newcommand{\EE}{{\sf E}}
\newcommand{\EXP}{{\sf EXP}}
\newcommand{\NEXP}{{\sf NEXP}}
\newcommand{\PSPACE}{{\sf PSPACE}}
\newcommand{\eL}{{\sf L}}
\newcommand{\NL}{{\sf NL}}
\newcommand{\LOGSPACE}{{\sf LOGSPACE}}
\newcommand{\Pe}{{\sf P}}
\newcommand{\NP}{{\sf NP}}
\newcommand{\coNP}{{\sf coNP}}
\newcommand{\FP}{{\sf FP}}
\newcommand{\PH}{{\sf PH}}
\newcommand{\CH}{{\sf CH}}
\newcommand{\PP}{{\sf PP}}
\newcommand{\num}{{\sf\#}}
\newcommand{\numP}{{\sf\#\Pe}}
\newcommand{\ParP}{{\mbox{$\oplus$\Pe}}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\Z}{\mathbb{Z}} 
\newcommand{\C}{\mathbb{C}}
\newcommand{\R}{\mathbb{R}} 
\newcommand{\ket}[1]{{|{#1} \rangle}} 
\newcommand{\bra}[1]{{\langle {#1}|}}
\newcommand{\bracket}[2]{{\langle {#1} | {#2} \rangle}}
\newcommand{\nb}{{\bf {\sf n}}} 
\newcommand{\Xb}{{\bf {\sf X}}}
\newcommand{\Xbi}{{\Xb}_i}
\newcommand{\Xbj}{{\Xb}_j}
\newcommand{\nbt}{{\tilde{\nb}}}
\newcommand{\nbi}{{\nb_i}}
\newcommand{\nbj}{{\nb_j}}
\newcommand{\nbti}{{\tilde{\nb}_i}}
\newcommand{\nbtj}{{\tilde{\nb}_j}}
\newcommand{\Sb}{{{\bf{\sf S}}}}
\newcommand{\Cb}{{\bf {\sf C}}}
\newcommand{\Zb}{{\bf {\sf Z}}}
\newcommand{\Yb}{{\bf {\sf Y}}}
\newcommand{\Hb}{{\bf {\sf H}}}

\sloppy
 
\begin{document}
% The paper really starts here.

\noindent {\bf Sample LaTeX Document}\\

I can't possibly write a whole tutorial on \TeX\/ or \LaTeX\/ (which is what this document
uses). The main purpose of this document is to give you some examples that you can draw on
and modify in your assignments. Learning \TeX\/ is a lifelong experience, and it continues to grow with its user base. There are, of course, innumerable written and/or video tutorials,
e.g., \url{https://youtu.be/Rsoj2YavveE} and its associated blog,
\url{http://quicklatex.blogspot.com/}. A quick reference for
the various symbols is also handy, e.g.,  \url{https://reu.dimacs.rutgers.edu/Symbols.pdf}.
Of course, just about any question you have about how to do something
in \TeX\/ can be answered almost instantaneously thanks to the ``wisdom of the web";
 for example, I forgot the command for displaying the backslash
character, needed below, so I just googled ``What is the LaTeX symbol for backslash?"

 A disadvantage with many (most?) tutorials 
is that they're too general. They include a lot of stuff you won't need for any
assignment in this course, and leave out some things you may find useful.
My suggestion, based on personal experience: The best way to learn it is to just jump in and start using it. Try beginning with this document. It illustrates a few things,
including math symbols,
 the theorem environment, the proof environment,
  the symbolic labeling of theorems and equations,
and how to reference them. Study the source file ({\tt latexDemo.tex}) and the typeset version you are now
reading, and try to understand their relationship.
 Leave in the ``preamble" that you find in the source {\tt latexDemo.tex} (everything up to and including the {\tt \textbackslash begin\{document\}}) and, of course, the {\tt \textbackslash end\{document\}}.
Otherwise, modify what it says to suit your purposes.\\

Let's start with the theorem and proof environments.
\begin{theorem}\label{bezout}
(``B{\'e}zout's Lemma"): Let $a, b \in \Z$. Then $\exists x, y \in \Z$ such that
$gcd(a,b) = ax + by$. 
\end{theorem}

\begin{proof}
Let 
$$d = \min_{x, y \in \Z}\{ax + by | ax + by > 0\}.$$ 
Write $d = ax' + by'$.
We first show, for
any $x, y \in \Z$, that $d | (ax + by)$. 

Let $z = ax + by$ for any $x, y \in \Z$. We divide $z$ by $d$, i.e., write
$z = md + r$, where $r$ is the remainder so $0 \le r < d$. Suppose
now that $r > 0$; we will derive a contradiction. We have
$z-md = r$, which implies that $ax + by - md = r$. 
But then,
\begin{eqnarray}\label{eqnForR}
   r= ax + by - md = ax + by - m(ax' + by') = a(x-mx') + b(y-my').
\end{eqnarray}
What Eq.~(\ref{eqnForR}) says is that $r$ is of the form $ax'' + by''$,
where as it happens $x'' = x-mx'$ and $y'' = y-my'$. Since $d$ is the
minimum such positive number, and we're assuming that $r$
is positive, it follows that $d \le r$. However, $r < d$,
so this is a contradiction. Therefore, $r$ must equal $0$.
It follows that $z = ax + by = md$, i.e., $d | (ax + by)$,
as we wished to show.

We now know that $d$ is a common divisor of $a$ and $b$. We need to
show it's the {\it greatest} common divisor to complete the proof.
To see that, suppose $c | (ax + by)$, where $ax + by > 0$.
 Then $c \le d$, since $d$ is the minimum value that $ax + by$
 takes on. Therefore, $d = gcd(a,b)$.
\end{proof}

Theorem~\ref{bezout} is useful, for example, since it leads to an
 extension of the Euclidean
algorithm for finding the inverse of $a$ modulo $b$, or $b$ modulo $a$,
 in the event
that $gcd(a,b) = 1$, an important operation in cryptography.\\[-0.1in]

The preamble to this document's source includes a bunch of commands for
symbols that will be useful. In particular, we have standard symbols for the
natural numbers $\N$, the
integers $\Z$, the reals $\R$, the complex numbers $\C$ and so forth.
Of great use in this course will be the {\tt \textbackslash ket},
 {\tt \textbackslash bra}, and {\tt \textbackslash bracket} commands,
which, via expressions like
{\tt \textbackslash ket\{\textbackslash psi\}} and the like can be used to form expressions like $\ket{\psi}$ or $\ket{0101}$ or $\bracket{\varphi}{\psi}$
or $\sum_{k=1}^n\ket{k}\bra{k}$.

Just to illustrate how you use basic but commonly occurring
things like fractions, subscripts, exponents/superscripts, the summation sign, and how to align equalities in an array
of equations, here's an old
boring (but far from useless) theorem that I expect you know well.

\begin{theorem}
(Sum of the numbers from $1$ to $n$): Let $n \in \N$ and let
\begin{eqnarray*}
   S_n = \sum\limits_{k=1}^n k.\\[-0.4in]
\end{eqnarray*}
Then $S_n = \frac{n(n+1)}{2}$.
\end{theorem}
\begin{proof}
We prove this by induction on $n$.\\[-0.2in]

\noindent {\bf Base case:} Let $n = 1$. Then by definition of the sum,
we clearly have $S_n = S_1 = 1$. Furthermore, when $n = 1$,
we have $\frac{n(n+1)}{2} = \frac{1(1+1)}{2} = 1$, so the relation follows
for $n = 1$. \\

\noindent {\bf Induction step:} Suppose that $S_n = \frac{n(n+1)}{2}$.
Let's break down $S_{n+1}$:
\begin{eqnarray*}
   S_{n+1} & = & \sum\limits_{k=1}^{n+1} k\\[-0.05in]
           & = & \sum\limits_{k=1}^{n} k + (n+1)\\[-0.05in]
           & = & S_n + (n+1)\\[-0.05in]
           & = & \frac{n(n+1)}{2} + (n+1)\\[-0.05in]
           & = & \frac{n(n+1)}{2} + \frac{2(n+1)}{2}\\[-0.05in]
           & = & \frac{(n+2)(n+1)}{2},
\end{eqnarray*}
where the fourth equality followed from the induction hypothesis. But
$S_{n+1} = \frac{(n+2)(n+1)}{2}$ establishes the original assertion for $n+1$,
so we are done.
\end{proof}

Matrices can be denoted conveniently, as in:
\begin{align*}
{\Hb} &= \frac{1}{2} \left[\begin{array}{cccc}
1 & 1 &1 &1  \\
1 & -1 &1 &-1  \\
1 & 1 &-1 &-1  \\
1 & -1 &-1 &1  \\
\end{array}\right],~~~\;
{\Cb}_{ij} = \left[\begin{array}{cccc}
1 & 0 &0 &0  \\
0 & 1 &0 &0  \\
0 & 0 &0 &1  \\
0 & 0 &1 &0  \\
\end{array}\right].
\end{align*}
 (the first one, $\Hb$, being the familiar Hadamard matrix, and
 ${\Cb}_{ij}$ is controlled NOT).


\end{document}
