%%%%%%%%%%%%%%%%%%%%%%%%% NOTE %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% You can ignore everything from here until %%
%% "Question 1: Introduction" %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[11pt]{article}
\usepackage{amsmath, amsfonts, amsthm, amssymb} % Some math symbols
\usepackage{fullpage}
\usepackage[x11names, rgb]{xcolor}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{decorations,arrows,shapes}
\usepackage{etoolbox}
\usepackage{enumerate}
\usepackage{listings}
\setlength{\parindent}{0pt}
\setlength{\parskip}{5pt plus 1pt}
\newcommand{\N}{\mathbb N}
\newcommand{\E}{\mathbb E}
\newcommand{\V}{Var}
\renewcommand{\P}{\mathbb P}
\newcommand{\f}{\frac}
\newcommand{\nopagenumbers}{
\pagestyle{empty}
}
\def\indented#1{\list{}{}\item[]}
\let\indented=\endlist
\providetoggle{questionnumbers}
\settoggle{questionnumbers}{true}
\newcommand{\noquestionnumbers}{
\settoggle{questionnumbers}{false}
}
\newcounter{questionCounter}
\newenvironment{question}[2][\arabic{questionCounter}]{%
\addtocounter{questionCounter}{1}%
\setcounter{partCounter}{0}%
\vspace{.25in} \hrule \vspace{0.4em}%
\noindent{\bf \iftoggle{questionnumbers}{#1: }{}#2}%
\vspace{0.8em} \hrule \vspace{.10in}%
}{$ $\newpage}
\newcounter{partCounter}[questionCounter]
\renewenvironment{part}[1][\alph{partCounter}]{%
\addtocounter{partCounter}{1}%
\vspace{.10in}%
\begin{indented}%
{\bf (#1)} %
}{\end{indented}}
\def\show#1{\ifdefempty{#1}{}{#1\\}}
\newcommand{\header}{%
\begin{center}
{\Large \show\myhwname}
\show\myname
\show\myemail
\show\mysection
\today
\end{center}}
\usepackage{hyperref} % for hyperlinks
\hypersetup{
colorlinks=true,
linkcolor=blue,
filecolor=magenta,
urlcolor=blue,
}
%%%%%%%%%%%%%%%%% Identifying Information %%%%%%%%%%%%%%%%%
%% For 312, we'd rather you DIDN'T tell us who you are %%
%% in your homework so that we're not biased when %%
%% So, even if you fill this information in, it will not %%
%% show up in the document unless you uncomment \header %%
%% below %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\myhwname}{Hello}
\newcommand{\myname}{Test}
\newcommand{\myemail}{}
\newcommand{\mysection}{Se}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%% Document Options %%%%%%%%%%%%%%%%%%%%%%
\noquestionnumbers
\nopagenumbers
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
%\header
\begin{flushleft}
CSE 312 {\bf (DO NOT INCLUDE YOUR NAME)}\\
HW \#
\end{flushleft}
LaTeX is a markup language that produces beautiful documents with
mathematical formulas, and is \textbf{very} commonly used in
Computer Science research. There is a learning curve, and
\textbf{you are not required to use it for homework}. It is worth
learning though, and this template provides an example.
The following pages illustrate most of the notation used in the
class. Look at the .tex file to see how it was produced. If you
can't find it there, we also have a cheatsheet linked from the
course website. Also, feel free to Google it or use
\href{http://detexify.kirelabs.org/classify.html}{detexify}!
\textbf{LaTeX environment:} Our recommendation is to use
\href{http://www.sharelatex.com}{sharelatex.com}, which provides
an online editing environment. This is especially helpful if you
switch between lab and personal computers. However, if you'd like
to install LaTeX on your own computer, Adam Blank's
\href{http://www.countablethoughts.com/documents/HowToLaTeX.pdf}{LaTeX
tutorial} provides instructions.
\begin{question}{Problem 1 (example)}
\textbf{Answer:} \fbox{$\dfrac{1}{4!} = \dfrac{1}{24} \approx 0.04167$}
(In general, we want to see \textbf{both} a formula like $3! \cdot
\binom{5}{2}$, \textbf{and} the explicit numerical value or
approximation, in this case $60$.)
\textbf{Explanation:} We need to get exactly DABC, and there are $4
\cdot 3 \cdot 2 \cdot 1 = 4!$ ways to arrange those 4 letters, so we
have a $\dfrac{1}{24}$ probability of getting a random permutation in
that order.\\ \\
(\textbf{Remember to start each new problem on its own page.} Do \textbf{not} include the problem
statement in your solution as it takes up too much space and we already know the problem
statement.)
\end{question}
\begin{question}{Problem 2 (multi-part example, and large numbers)}
\begin{part}
\textbf{Answer:} \fbox{$20! \cdot \binom{13}{5} \approx 3.131 \cdot 10^{21}$}
(Please give the raw formula you used, \textbf{and} its value, possibly in scientific notation if it is too
large).
\textbf{Explanation:}
Explain here.
\end{part}
\begin{part}
\textbf{Answer:} \fbox{$answer$}
\textbf{Explanation:}
Explain here.
\end{part}
\end{question}
\begin{question}{Problem 3 (proof problem example)}
\textbf{(Short way)}
You can use the \textbf{align*} environment to align a proof or
calculation. Example below:
\begin{align*}
\P(E|F) &= \dfrac{\P(E \cap F)}{\P(F)} & \text{(def of conditional probability)} \\
&= \dfrac{\P(F|E) \P(E)}{\P(F)} & \text{(chain rule)}
\end{align*}
\textbf{How did I produce that?} The ``align*'' environment produces a table structure. You use \& to go to the next ``column'', and \text{\textbackslash \textbackslash} to start a new line. The whitespaces in the .tex document were not necessary. \\
\textbf{(Long way)}
First, by the chain rule, we have
$$\P(E|F) \P(F) = \P(E \cap F)$$
Switching the roles of $E$ and $F$ gives
$$\P(F|E) \P(E) = \P(F \cap E)$$
Since $\P(E \cap F) = \P(F \cap E)$, we can set them equal to get
$$\P(E|F) \P(F) = \P(F|E) \P(E)$$
But dividing by $\P(F) > 0$ gives Bayes Theorem
$$\P(E|F) = \dfrac{\P(F|E) \P(E)}{\P(F)}$$
\end{question}
\begin{question}{Problem 4 (Calculus notation)}
\begin{part} The syntax for integrals, summations, etc is a bit clunky but should be intuitive.
$$ \int_{a}^{b}{f(x)dx} $$
$$ \sum_{i=1}^{n} X_i $$
$$ \prod_{i=1}^{n} \P(x_i | \theta) $$
\end{part}
\begin{part} Partial derivatives:
$$ \dfrac{\partial}{\partial \theta} L(x_1, x_2, \dots x_n | \theta) = 2x$$
\end{part}
\end{question}
\end{document}