% \documentclass tells what type of document you are preparing.
% ''article'' is the most generic type and works for anything you'll be doing
\documentclass{article}
% \usepackage imports packages with new symbols
% There are LOTS of possible packages, but the ones below cover most everything
% you'll need for math.
\usepackage{amsmath,amsthm,amssymb,latexsym}
% \newtheorem lets you name a few different kinds of theorem environments
% The first argument is what you want the command to be named.
% The second argument is the word that should actually appear in the document.
% The optional third argument tells them all to use the same numbering scheme.
% It will make more sense when you see it in use later in the document.
\newtheorem{thm}{Theorem}
\newtheorem{prop}{Proposition}[thm]
\newtheorem{defn}{Definition}[thm]
\newtheorem{lem}{Lemma}[thm]
\newtheorem{cor}{Corollary}[thm]
\newtheorem{conj}{Conjecture}[thm]
% Put your title, author, and date information BEFORE \begin{document},
% then call the \maketitle command immediately after \begin{document}
\title{LaTeX Example}
\author{Austin Mohr}
\date{\today} % You can specify a date, or just use \today to use today's date.
% \begin{document} and \end{document} mark the beginning and end of the
% part of the document you actually want to be typeset
\begin{document}
% \maketitle takes all the title, author, and date information and makes
% a nice looking header for the document
\maketitle
% Finally, we'll start typing the body of our document.
% This tells the compiler that I'm getting ready to type a theorem.
\begin{thm}
The sum of two even integers is an even integer.
\end{thm}
%This tells the compiler that I'm getting ready to type a proof.
\begin{proof}
Let $m$ and $n$ be any two even integers, which means $m = 2j$ and $n = 2k$ for some integers $j$ and $k$.
Now,
% The align* environment lets you arrange long strings of equations.
% You don't use a $ anywhere in align* (it already expects math is coming).
% The & tells where the equations should be aligned (usually at the equals sign).
% The \\ is the LaTeX command for newline.
\begin{align*}
m + n &= 2j + 2k\\
&= 2(j + k).
\end{align*}
Since the integers are closed under addition, $j + k$ is an integer, and so we have written $m + n$ as
twice some integer. Therefore, $m + n$ is even, as desired.
\end{proof}
% Here's another example, but written a little more tersely using symbols.
\begin{thm}
The sum of any two rational numbers is rational.
\end{thm}
\begin{proof}
Let $r, s \in \mathbb{Q}$, which means $r = \frac{a}{b}$ and $s = \frac{c}{d}$, where $a,b,c,d \in \mathbb{Z}$ and $b, d \neq 0$.
Now,
\begin{align*}
r + s &= \frac{a}{b} + \frac{c}{d}\\
&= \frac{ad}{bd} + \frac{bc}{bd}\\
&= \frac{ad + bc}{bd}.
\end{align*}
By properties of integer addition and multiplication, we know $ad + bd, bd \in \mathbb{Z}$. We know also $bd \neq 0$, since $b, d \neq 0$. Therefore, $r + s$ is a rational number.
\end{proof}
% Here's the end of the document
\end{document}