[Tex/LaTex] Display Math Should End With $$ error message

errors

I seem to be getting the same error message as several other people but I can't figure out how to apply a solution to my own work. I know the errors are occurring somewhere in here:

\begin{solution}
By Trichonomy, we know that x $>$ 0, x $=$ 0, or x $<$ 0.
$x\not=0$ is given so we are left with two cases:
1--If x$>$0 then $x^2$ $=$ $x\ x$
By order axiom six--if 0$\leq $x and 0$\leq $y then 0$\leq $ $x\ y$--$x^2$ $>$ 0.

2--If x$<$0 then $x^2$ $=$ $$$-1\ x$\ -1$\ x$
               $=$ $$-1^2$\ $x^2$$
                       $=$ $1\ $x^2$$
               $=$ $x^2$ $>$ 0, completing the proof.
\end{solution}

I get the Display math should end with $$ error and then there is also one that tells me to insert another $ at the beginning of the final line (the one that ends in "completing the proof") which makes no sense to me either.
Could you please provide some insight into what I'm doing wrong?

\documentclass[12pt]{exam}

\usepackage[dvips]{graphicx}

\usepackage{amsfonts,amssymb,amsmath,latexsym}

\pagestyle{empty}

\newcommand{\n}{\noindent}

\newcommand{\pp}{\parskip=0.25cm}

\newtheorem{tem}{{\sc Theorem}}

\newcommand{\R}{\mathbb{R}}

\newcommand{\N}{\mathbb{N}}

\begin{document}

\title{{\bf MA410.F13--Problem Set 1}}

\author{{\bf Lisa Snay }}

\date{}

\maketitle

\begin{questions}\pp

\question[10] Prove that if $a\in\R$ and $a\not=0$, then $a^2>0$

\end{questions}

\begin{solution}

By Trichonomy, we know that $x > 0$, $x = 0$, or $x < 0$.

$x\not=0$ is given so we are left with two cases:

1--If $x>0$ then $x^2 = x\ x$

By order axiom six--if $0\leq x$ and $0\leq y$ then $0\leq x\ y$ so $x^2 > 0$.

2--If $x<0$ then $x^2 = -1\ x\ -1\ x 

                      = -1^2\ x^2

              = 1\ x^2

              = x^2 > 0$, completing the proof.

\end{solution}

\end{document}

Best Answer

by default (it says in the comments in the class) solutions are not printed, you need the answers option. the error was because you can not have a paragraph break (blank line) in line math, I fixed some (not all:-) of the other issues such as obsolete font commands \bf and the option to the graphics package.

\documentclass[12pt,answers]{exam}

\usepackage{graphicx}

\usepackage{amsfonts,amssymb,amsmath,latexsym}

\pagestyle{empty}

\newcommand{\n}{\noindent}

\newcommand{\pp}{\parskip=0.25cm}

\newtheorem{tem}{\textsc{Theorem}}

\newcommand{\R}{\mathbb{R}}

\newcommand{\N}{\mathbb{N}}

\begin{document}

\title{\textbf{MA410.F13--Problem Set 1}}

\author{\textbf{Lisa Snay }}

\date{}

\maketitle

\begin{questions}\pp

\question[10] Prove that if $a\in\R$ and $a\not=0$, then $a^2>0$

\end{questions}

\begin{solution}

By Trichonomy, we know that $x > 0$, $x = 0$, or $x < 0$.

$x\not=0$ is given so we are left with two cases:

1--If $x>0$ then $x^2 = x\ x$

By order axiom six--if $0\leq x$ and $0\leq y$ then $0\leq x\ y$ so $x^2 > 0$.

2--If $x<0$ then 
\begin{align}x^2 &= -1 x -1 x\\ 
                  &= (-1)^2 x^2\\
              &= 1 x^2\\
             & = x^2 > 0
\end{align}, completing the proof.

\end{solution}

\end{document}