\documentstyle[12pt]{article}

\setlength{\oddsidemargin}{0.25in}
\setlength{\textwidth}{6.0in}
\setlength{\topmargin}{0in}
\setlength{\textheight}{8.0in}

\newcommand{\blackslug}{\hbox{\hskip 1pt
        \vrule width 4pt height 8pt depth 1.5pt\hskip 1pt}}
\newcommand{\myQED}{\hfill \blackslug}

\newenvironment{proof}
    {\pagebreak[1]{\narrower\noindent {\bf Proof:\nopagebreak}}}%
    {\myQED}

\newenvironment{proofsk}
    {\pagebreak[1]{\narrower\noindent {\bf Proof (sketch):\nopagebreak}}}%
    {\myQED}

\newtheorem{theorem}{Theorem}
\newtheorem{lemma}{Lemma}
\newtheorem{observation}{Observation}

\begin{document}

Though it can be a bit daunting at first, I have found math typesetting in LaTeX
to be ultimately very flexible and useful. Inline mathematics such as
$I = \langle x, k, y, S, S' \rangle$ where $x = \sum_{i=1}^n \log_2 f(i)$,
$k = \left( \begin{array}{c} n^2 \\ 5 \end{array} \right) - \frac{1}{q}$,
$y = \log_k g(x)$, $S = \{ i ~ | ~ i \geq 53 ~ \rm{and} ~ q(i, y) \oplus 3 = 0\}$,
and $S' = \{3, 4, \ldots, \sqrt{k}\}$ can be done easily. Sometimes you
want math to stand out like this:

\[
S = \{ i ~ | ~ i \geq 53 ~ \rm{and} ~ q(i, y) \oplus 3 = 0\}
\]

\noindent
Or maybe you want numbers like this:

\begin{equation}
x = \left\{ \begin{array}{c l}
            1 & n = 1 \\
            k & n \geq r \times 5 ~ {\rm or} ~ k \neq i * 4 \\
            0 & {\rm otherwise}
            \end{array} \right.
\end{equation}

\noindent
If it's Tuesday or Friday, you may want multi-line numbered equations like this:

\begin{eqnarray}
(x + 1)(x - 1) & = & x^2 -x + x -1 \\
               & = & x^2 - 1 \\
               & < & x^2
\end{eqnarray}

\noindent
On other days of the week, you may want something simpler, like being able to say
$I = \langle x, k, y, S, S' \rangle$ where 

\begin{eqnarray*}
x  & = & \sum_{i=1}^n \log_2 f(i) \\
k  & = & \left( \begin{array}{c} n^2 \\ 5 \end{array} \right) - \frac{1}{q} \\
y  & = & \log_k g(x) \\
S  & = & \{ i ~ | ~ i \geq 53 ~ \rm{and} ~ q(i, y) \oplus 3 = 0\} \\
S' & = & \{3, 4, \ldots, \sqrt{k}\}
\end{eqnarray*}

\noindent
One final somewhat obscure LaTeX bug before we finish our basic introduction to
math in LaTeX: though useful, calligraphic font in math mode can misbehave badly. 
Hence, to ensure that an expression like $\cal{R}$ $= k^2 - \sqrt{q_2}$ does not end
up as $\cal{R} = k^2 - \sqrt{q_2}$, you need to split the calligraphic command into
a separate math-expression.

\end{document}
