\documentclass{article}
% ========================================================================
% preamble
% ========================================================================
% margins, size, formatting
\oddsidemargin=.25in
\evensidemargin=.25in
\topmargin=-.5in
\textwidth=6in
\textheight=9in
\parindent=0in
\pagestyle{empty}
% packages for fancy fonts, symbols, thm/proof environments, etc
\usepackage{amsmath,amssymb,amsthm}
% spacing hacks
\def\vs{\vspace{1\baselineskip}}
\def\svs{\vspace{.5\baselineskip}}
% ========================================================================
% body
% ========================================================================
\begin{document}
% header =================================================================
{\large Math 245-00} % insert section number 01/02
\hfill
{\large 9/23/09} % date it will be *submitted*
\svs
{\large Writeup of Problem 6.8} % insert number of problem module.number
\hfill
{\large Walter Writer (W) and Percy Presenter (P)} % names with W & P tags
\vs\vs
% stuff =================================================================
This sample document provides a template for writing a \LaTeX\/ document suitable for homework assignments in Laura's 245 class. Compare what is in the typeset version of this document to the file \verb|latexsample.tex|. Note in particular that anything typed after a percent sign in the text file is treated as a comment and is ignored by the compiler. Comments in the text file refer both to \LaTeX\/ and to hints about writing good solutions and proofs.
\vs
The very basics of \LaTeX\/:
(compare the typeset document latexsample.pdf and the text file latexsample.tex)
\begin{itemize}
\item
Extra spaces in the text file do not appear in the typeset document.
Except for a double carriage-return, that makes a new line.
Single
carriage
returns
don't
do
anything.
\item
Mathematical expressions are typed between dollar signs like this: $y=x^2+1$. To make a centered equation on its own line, use double dollar signs, like this:
%
$$y=x^2+1.$$
The percent sign above the equation in the text file just makes it so that extra space is not added between the centered equation and the main paragraph above.
\item
Many \LaTeX\/ commands and math symbols start with a backslash symbol. For example, $\sin x$ and $\{x \in \mathbb{R} \mid x \geq 0\}$. Notice that the set-notation parentheses need to have backslashes before them (while regular parentheses do not). This is because in \LaTeX\/, those squiggly parentheses often have other uses.
\item
If you need to put something in italics you do it {\em like this}. Or maybe you need to have something in {\bf boldface}. Or maybe {\bf \em both}.
\item
Notice that to have quotes appear ``correctly'' in the typeset document you may have to type them yourself using the \verb|`| and \verb|'| keys instead of the \verb|"| key.
\item
Here is some random notation you might need (again, look at the text document):
\svs
% the command above is defined at the top of this document and
% is short for: \vspace{.5\baselineskip}
% this "vspace" above just adds some vertical space. note that
% we can't add vertical space with carriage returns, so we have to
% add it this way instead. here "baselineskip" is the space of a line,
% so we're skipping by half that.
$x_2$,
$x_{25}$, % note parentheses needed to get both digits in subscript
$x^2$,
$x^{25}$, % note parentheses needed to get both digits in exponent
$\pm 4$,
$x \not = 17$, % you can put "not" in front of lots of different operators
$x > 5$,
$x < 5$,
$x \geq 5$,
$x \leq 5$,
$\{ 1, 2, 3 \}$, % note curly brackets need a backslash or they are invisible
$\{ x \mid \sqrt{x} > 2 \}$,
$\infty$.
\svs
$A \subset B$,
$A \subseteq B$,
$A \not \subset B$,
$A \not \subseteq B$,
$A \setminus B$,
$A^{\rm c}$, % "rm" changes the font to "roman", i.e. non-math, font
$A \cap B$,
$A \cup B$,
$x \in A$,
$x \not \in A$,
$|A|$,
$\mathcal{P}(A)$,
$\emptyset$.
\svs
$\frac{5}{1+x}$,
$\displaystyle\frac{5}{1+x}$, % anything in $$ is automatically displaystyle
$\bigcap_{i=1}^n S_i$,
$\displaystyle\bigcap_{i=1}^n S_i$,
$\bigcup_{i=1}^n S_i$,
$\displaystyle\bigcup_{i=1}^n S_i$,
$\sum_{k=1}^{10} a_k$,
$\displaystyle\sum_{k=1}^{10} a_k$,
$\prod_{k=1}^{10} a_k$,
$\displaystyle\prod_{k=1}^{10} a_k$.
\svs
% "displaystyle" is the default when using double dollar signs.
% so you only need to use "displaystyle" in the rare case where you
% want one of these oversized notations right in the middle of a line
% of text, which is not usually what you want. for centered equations,
% everything will automatically be in "displaystyle".
$\mathbb{R}$, % use this ONLY to denote the real numbers
$\mathbb{Q}$, % rational numbers
$\mathbb{Z}$, % integers
$\mathbb{N}$, % natural numbers
$\clubsuit$,
$\diamondsuit$,
$\heartsuit$,
$\spadesuit$,
$\rightarrow$,
$\leftarrow$,
$\leftrightarrow$,
$\longrightarrow$,
$\longleftarrow$,
$\longleftrightarrow$,
$\Rightarrow$, % the "implies" arrow
$\Leftarrow$,
$\Leftrightarrow$, % the "if and only if" arrow
$\Longrightarrow$, % longer "implies" arrow
$\Longleftarrow$,
$\Longleftrightarrow$, % longer "if and only if" arrow
$\mapsto$,
$\longmapsto$.
\svs
$\mathcal{P}$, % "mathcal" is a fancy font that can be applied to any letter.
$\mathcal{S}$,
$\mathcal{F}$,
$\forall$,
$\exists$,
$\lor$, % think "logical or"
$\land$, % think "logical and"
$\neg$, % \lnot also works. use this for logical negation (\sim looks funny)
$\sim$, % use this for equivalence relations, it's made to be a binary operation
$\approx$,
$\equiv$,
$\times$, % for cartesian products
$\ast$,
$\star$,
$\mid$, % use this for "such that"
$a | b$, % use this for "divides"
$|x|$, % use this for absolute value
$\|x\|$,
$\lceil x \rceil$,
$\lfloor x \rfloor$,
$\{x \in \mathbb{Z} \mid x \mbox{ is prime} \}$. % note use of "mbox"
% the "mbox" is needed so that we can have non-math type inside of the
% math environment. without the "mbox" the words would be in math/italics,
% and all smushed together with no spaces between words. notice also
% the space before the word "is".
\svs
$\gcd$, % in math mode, just "gcd" would be in italics, but "\gcd" is not
${\rm lcm}$, % there isn't a command for "lcm" in tex so we just roman it
$n \choose k$,
$n+1 \choose k$, % no brackets needed, the n+1 is all assumed to be on top
$a = {n+1 \choose k}$, % we need brackets or else "a=" would be in the choose
$\prec$, % think "precedes"
$\preceq$,
$\succ$, % think "succeeds"
$\succeq$,
$f \colon [0,\infty) \rightarrow \mathbb{R}$,
$f \circ g$ % composition
\{, % these next few symbols mean particular things to latex
\}, % so to get them to appear in your document you precede them with backslash
\$, % notice that these are NOT in math mode
\%,
\&,
\_,
\#.
\svs
\item
For how to write other symbols or to look up error messages that you get in your .log file, use teh google tubes.
\item
On the next page we write up three sample problems so you can see how things
might work out when you try to write up your homework.
\end{itemize}
% ========================================================================
% sample problem
% ========================================================================
{\bf Problem:}
\svs
42 students are taking algebra, 32 are taking Spanish, 7 are taking both.
How many students are there?
% you don't have to write out the problem word-for-word, but your homework
% assignment should make sense on its own without the book around.
\vs
{\bf Solution:}
\svs
The number of students can be found by adding up the number of students who are taking algebra and the number of students who are taking Spanish, and then subtracting off the number of students who are taking both (since they would otherwise be counted twice):
%
$$43 + 32 - 7 = 68 \mbox{ students}.$$
% for this problem, notice that i didn't just answer "68".
% there is work! and justification! and some info at the beginning!
\vfill
\hrule
\vfill
% ========================================================================
% sample problem
% ========================================================================
{\bf Problem:}
\svs
$P$ and $Q$ are statements.
Show that $\neg Q$ and $\neg(P \land Q) \land \neg Q$ are logically equivalent.
\vs
{\bf Solution:}
\svs
\begin{center}
\begin{tabular}{|c|c||c|c|c|c|}
\hline
$P$ & $Q$ & $P \land Q$ & $\neg(P \land Q)$ & $\neg Q$ & $\neg(P \land Q) \land \neg Q$ \\
\hline
T & T & T & F & F & F \\
T & F & F & T & T & T \\
F & T & F & T & F & F \\
F & F & F & T & T & T \\
\hline
\end{tabular}
\end{center}
Since the truth-values for $\neg Q$ and $\neg(P \land Q) \land \neg Q$ are the same for all possible truth-values of $P$ and $Q$, the two statements are logicaly equivalent.
\vfill
\hrule
\vfill
% ========================================================================
% sample problem
% ========================================================================
{\bf Problem:}
\svs
Prove that $n^3+n$ is even for every integer $n$.
\vs
{\bf Solution:}
\svs
\begin{proof} % notice there is a built-in proof environment - use it!
Suppose $n$ is any integer. We will examine two cases:
\vspace{.5\baselineskip}
If $n$ is even, then $n=2k$ for some $k \in \mathbb{Z}$, and therefore:
%
\begin{align*} % the "%" on the line above just prevents added linespace
n^3+n
&= (2k)^3 + (2k) % "&=" gives an aligned equals. the "&" is like "tab"
&\mbox{(since $n=2k$)} \\ % this is how you might provide a reason
&= 8k^3 + 2k \\
&= 2(4k^3+k). % notice we are still using punctuation, even here!
&\mbox{(factor out a $2$)}
\end{align*}
% the "*" in the align environment just makes it so the equations are not
% numbered. in this example the reasons/justifications given for the
% steps aren't really mathematically needed - they are pretty obvious - but
% i put them here so you could see how to include them when necessary.
Since $4k^3+k \in \mathbb{Z}$, this means $n^3+n$ is divisible by $2$ and therefore is even.
% notice that i am explaining the conclusion here
\vspace{.5\baselineskip}
On the other hand, suppose $n$ is odd. Then $n=2k+1$ for some $k \in \mathbb{Z}$, and thus:
%
\begin{align*}
n^3+n
&= (2k+1)^3 + (2k+1)
&\mbox{(since $n=2k+1$)} \\
&= (8k^3+12k^2+6k+1) + (2k+1)
&\mbox{(multiply out)} \\
&= 8k^3+12k^2+8k+2 \\
&= 2(4k^3+6k^2+4k+1).
&\mbox{(factor out a $2$)}
\end{align*}
Once again, $n^3+n$ is a multiple of $2$ and therefore is even.
\end{proof} % ending the proof environment automatically adds the "box"
\end{document} % every document must end with this.