\documentclass[12pt]{article}

\usepackage[margin=0.5in,top=0.7in,dvips]{geometry}
\usepackage{fancyhdr,lastpage}
\usepackage{amsmath}
\usepackage{tikz}
\usepackage{multirow}
\usepackage{substr}
\usepackage{pgfplots}

\makeatletter
\renewcommand*\env@matrix[1][*\c@MaxMatrixCols c]{%
  \hskip -\arraycolsep
  \let\@ifnextchar\new@ifnextchar
  \array{#1}}
\makeatother

% Include "solution" in your filename to make sure the right mode is
% used below.

\IfSubStringInString{\detokenize{solution}}{\jobname}{%
  % Solutions
  \newcommand\qfill{}
  \newcommand\qpage{}
  \newcommand\qonly[1]{}
  \newcommand\answer[1]{#1}
  \newcommand\question[1]{{\em #1}}
}
{%
  % Problems
  \newcommand\qfill{\vfill}
  \newcommand\qpage{\newpage}
  \newcommand\qonly[1]{#1}
  \newcommand\answer[1]{}
  \newcommand\question[1]{#1}
}

\pagestyle{fancy}
\lhead{MATH 521--01}
\chead{Problem Set \#1\answer{ solutions}}
\rhead{\answer{YOUR NAME HERE}}
\lfoot{}
\cfoot{\answer{Page \thepage\ of \pageref{LastPage}}}
\rfoot{due Thursday, September 4, 2014}

\begin{document}
\begin{enumerate}
\item \question{Prove that for every integer $n$, $n^3\equiv n\pmod 6$.}

  \answer{

  }

\item \question{Let us say that, for nonzero rational numbers $a$ and
    $b$, $a\simeq b$ if $a$ and $b$ have the same denominator when
    written in lowest terms. Explain why $\simeq$ is an equivalence
    relation and describe its equivalence classes.}

  \answer{

  }

\item \question{Prove that for every number $k$ there is a number $N$
    such that all of the numbers $N+1, N+2, N+3, \cdots, N+k$
    are composite.}

  \answer{

  }

\item \question{Determine the symmetries of a rectangle which is not a
    square; give each symmetry a name and produce a Cayley table.}

  \answer{

  }

\item \question{Describe the infinite group of symmetries of the
    following infinitely long figure. Determine as many rules as you
    can for multiplying the symmetries, and determine whether this
    group is Abelian.
    \begin{center}
      \begin{tikzpicture}
        \fill (-2,0) circle (0.05);
        \fill (-1.5,0) circle (0.05);
        \fill (-1,0) circle (0.05);
        \draw[thick] (-0.5,0)--(6.5,0);
        \draw[thick] (0,0)-- ++(-0.5,0.5);
        \draw[thick] (1,0)-- ++(-0.5,-0.5);
        \draw[thick] (2,0)-- ++(-0.5,0.5);
        \draw[thick] (3,0)-- ++(-0.5,-0.5);
        \draw[thick] (4,0)-- ++(-0.5,0.5);
        \draw[thick] (5,0)-- ++(-0.5,-0.5);
        \draw[thick] (6,0)-- ++(-0.5,0.5);
        \fill (7,0) circle (0.05);
        \fill (7.5,0) circle (0.05);
        \fill (8,0) circle (0.05);
      \end{tikzpicture}
    \end{center}
  }

  \answer{

  }

\end{enumerate}
\end{document}