\documentclass[11pt]{article}
\usepackage{amsmath,amssymb,hyperref}
\oddsidemargin=0in
\evensidemargin=0in
\topmargin=-.5in
\textheight=135ex
\textwidth=42em
\baselineskip=16pt

\def\mn{\bigskip \noindent}

\begin{document}
Name goes here

PID goes here

Math 180C, Homework 1

\begin{enumerate}
\item This file is intended to help students to learn to type homework solutions in LaTeX.  Learning LaTeX is certainly not required for this course, but it may be useful if you plan on a career that involves scientific writing.  If you use the ``enumerate" command as above, LaTeX will automatically number your answers, as long as you make each one a separate item.

\item Usually, your answers will require mathematical notation.  In LaTeX, you use the dollars sign when you want to begin and end a mathematical equation.  For example, we can type the equation $x = y + z$.  Sometimes we need superscripts or subscripts such as $x^2$ or $y_1, \dots, y_n$.  We might also write inequalities such as $0 \leq 1 \leq 2$ or $5 \geq 1$.

\item LaTeX has special commands for greek letters, so we can write $E[X^2] = \sigma^2 + \mu^2$.  There are too many to list here, but one can find a list of LaTeX symbols at many web sites, such as \url{https://www.sharelatex.com/learn/List_of_Greek_letters_and_math_symbols}.

\item Often we want to display an equation, which can be done by using two dollars signs instead of one, so we write $$P(X > 1) = \int_1^{\infty} f(x) \: dx.$$ If we want to refer to the equation later, we can use the ``equation" command instead.  We have
\begin{equation}\label{meanofsum}
E[X + Y] = E[X] + E[Y].
\end{equation}
Now in text we can refer to equation \eqref{meanofsum}, and LaTeX will keep track of the numbering.

\item Fractions in text are best written like $1/2$ or $x/(x + y)$.  Within displays, one can use the ``frac" command to write something like $$\binom{n}{k} = \frac{n!}{k!(n-k)!}.$$

\item Sometimes we need to write equations that appear on multiple lines.  The ``align" command can help to get the equation lined up nicely.  We use the ``and" symbol to indicate what is being aligned, and we use the double backslash to move to the next line.  For example,
\begin{align*}
P(X > 3, Y > 2) &= \int_2^{\infty} \int_3^{\infty} f(x,y) \: dx \: dy \\
&= \int_2^{\infty} \int_3^{\infty} \frac{1}{x^2 y^2} \: dx \: dy \\
&= \bigg( \int_2^{\infty} \frac{1}{x^2} \: dx \bigg) \bigg( \int_3^{\infty} \frac{1}{y^2} \: dy \bigg) \\
&= \frac{1}{6}.
\end{align*}

\item Often in probability, we need to write unions and intersections such as $A \cap B$ or $A \cup B$.  In displays, one can write larger union and intersection symbols such as $$ \bigg( \bigcup_{i=1}^n A_i \bigg)^c = \bigcap_{i=1}^n A_i^c.$$

\clearpage
\item It is helpful for the grader if you can keep your answer to a particular homework problem on a single page.  The ``clearpage" command, as used above, can help you with this.

\item We can also write limits, sums, and products such as $$\lim_{n \rightarrow \infty} \sum_{k=1}^n \frac{1}{k^2} = \sum_{k=1}^{\infty} \frac{1}{k^2} = \frac{\pi^2}{6} \approx 1.64$$ or $$\prod_{j=1}^{3} j^2 = 36.$$

\item We can denote the real numbers by $\mathbb{R}$, the integers by $\mathbb{Z}$, the positive integers by $\mathbb{N}$, and the rational numbers by $\mathbb{Q}$.

\item Certain mathematical functions, such as the exponential, logarithm, and trigonometric functions, have special commands in LaTeX.  We write $\log 1 = 0$ rather than $log 1 = 0$, and $\sin(\pi) = 1$ rather than $sin(\pi) = 1$.  We likewise can write $\cos(2 \pi) = 1$ or $\tan(0) = 0$.  LaTeX does not have such a command for variance, but we can make the letters appear upright, rather than in italics, by using the ``mbox" command, which prints text within math mode.  For example, we have $$\mbox{Var}(aX + b) = a^2 \mbox{Var}(X)$$ and $$\mbox{SD}(X) = \sqrt{\mbox{Var}(X)}.$$

\item Often when writing down probability density functions or cumulative distribution functions, one needs to define the function in multiple pieces.  For example, if $X$ has the uniform distribution on $[a,b]$, then the density is given by
\begin{displaymath}
f(x) = \left\{
\begin{array}{ll}
1/(b-a) & \mbox{ if }a \leq x \leq b  \\
0 & \mbox{ otherwise}
\end{array} \right.
\end{displaymath}
while the distribution function is given by
\begin{displaymath}
F(x) = \left\{
\begin{array}{ll}  
0 & \mbox{ if }x < a \\
(x-a)/(b-a) & \mbox{ if }a \leq x \leq b  \\
1 & \mbox{ if }x > b
\end{array} \right.
\end{displaymath}

\item One can also use the array command to write matrices.  For example, we can write
$${\bf Q} = \left[
\begin{array}{ccc}
-1 & 0.5 & 0.5 \\
0 & -2 & 2 \\
1 & 1 & -2
\end{array} \right].$$
Note also the use of the ``bf" command for boldface.
\end{enumerate}

\end{document} 