% These settings are automatically generated by Overleaf's
% example document. No need to edit these, unless you
% feel like playing around.
\documentclass{article}

% A percent sign is how you start a commented line by the way.
% It doesn't affect how your document comes out.

% Language setting
% Replace `english' with e.g. `spanish' to change the document language
\usepackage[english]{babel}

% Set page size and margins
% Replace `letterpaper' with`a4paper' for UK/EU standard size
\usepackage[letterpaper,top=2cm,bottom=2cm,left=3cm,right=3cm,marginparwidth=1.75cm]{geometry}

% Useful packages
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage[colorlinks=true, allcolors=blue]{hyperref}

% I added this, might be useful to you.
\usepackage[shortlabels]{enumitem}
\usepackage{amsfonts}

\title{Problem Set X}
\author{Your name}

\begin{document}
% \maketitle generates the heading at the top of your paper.
% It autofills the date with today's date.
% For manually inserting a date,
% feel free to use \date.
% I know some of you want to make it look
% like you finished your homework earlier.
% example: \date{January 5th, 2022}
\maketitle

% Each of your problem solutions can be a 
% different "section" of the document.
\section{Problem 1}

Write your solution here!
This is all ``text.''
% This blank line below automatically starts a new paragraph.
% It doesn't matter how many blank lines you put,
% The spacing rendered by Latex will just start a new paragraph.
% To add more spacing, you can use \\.
% I'll show you after the next paragraph.

If you want to write some ``math,'' which you'll
probably want to in a discrete math course,
you'll use dollar signs to enter and exit ``math'' mode.
Like this: $\sigma = x + y$.
Notice how $x$ and $y$ are different from just writing x and y.
% Like I was saying, if I wanted multiple new lines before
% my next paragraph for whatever reason:
\\
\\
\\
This paragraph starts 3 lines later.
% You might notice that the indentation's different
% with these new lines.
% Use \indent or \noindent to add/remove indents as you please.

``Okay, but our solution includes exponents or fancy subscripts and 
stuff like that.''
I'm telling you, they're not that fancy.
Just do this:
$x^2$ for superscripts and $y_i$ for subscripts.

TA, it doesn't work! 
Our exponent's all messed up when I write $x^128$.
Don't panic. Use squiggly brackets for things with
more than one character or digit:
$x^{128}$ and $y_{i,j}$.
Name's John by the way, not TA.

What if we want one of those formulas that appear 
in the middle of the page.
You know, for emphasis, or dramatic effect,
or whatever.
Okay, there's another way to enter math mode. % with these \[\]

% I also show you how to do fractions and summations here:
\[
    \sum^{n}_{i=1} i = \frac{i(i+1)}{2}
\]

% Make sure your solution to each problem is on a different page.
% Use \newpage for that:
\newpage

\section{Problem 2: Wait this problem has multiple parts!}

% Wait, Prof. Rogaway gave us a multiple part problem.
% What do we do?
% Well, you can do these in a couple of ways.

% Creating subsections:
\subsection{Part a}

Your writeup for part a here.

\subsection{Part b}

Your writeup for part b here.

% You can even add \subsubsections, but you probably won't need those.

\subsection{More ways to handle multiple parts}

% Another way:
We can do it with lists.

\begin{enumerate}
    \item Part a
    \item Part b
    \item Part c
\end{enumerate}

% Wait, that list you made enumerates with numbers.
% That's more like Part 1, Part 2, Part 3.
% What if we want to make a list with letters,
% so it's actually Part a, etc.?

% Okay, okay. Do this instead:

Another type of list:

% The thing in the brackets lets you specify the style.
% Maybe you want only one parenthesis. 
% In that case, do "a)" in the brackets instead.
% Also this only works with the package enumitem.
% I put \usepackage[shortlabels]{enumitem} at the top before we made the document.
% So if yours isn't working, make sure you have that.
\begin{enumerate}[(a)]
    \item Part a
    \item Part b
    \item Part c
\end{enumerate}

% For bulleted lists, you can use \begin{itemize}.
% Enumerating makes more sense for multipart problems though.

\newpage

\section{Problem 3}
``I drew this very nice picture that shows my thinking process for a problem.
I scanned it and everything, but I don't know how to stick it into
my Latex document.'' 

% Well, I'm just going to shamelessly give you what Overleaf
% gives you in their example because
% they do a nice job of it and use a picture of a neat frog.

First you have to upload the image file from your computer using the upload link in the file-tree menu. Then use the includegraphics command to include it in your document. Use the figure environment and the caption command to add a number and a caption to your figure. 
% See the code for Figure \ref{fig:frog} in this section for an example.

% Going to comment out this section in the sample document with some
% multiline comment trickery.
% Don't want this affecting the template without the frog file.
\iffalse
\begin{figure}
\centering
\includegraphics[width=0.3\textwidth]{frog.jpg}
\caption{\label{fig:frog}This frog was uploaded via the file-tree menu.}
\end{figure}
\fi

% Hey, this "neat frog" is at the top of the page.
% I want him at the bottom, or some other place on the page!
% In that case, next to \begin{figure} you can add
% a flag for positioning him at the bottom as such: \begin{figure}[b]
% There's several commands for this.
% See: https://www.overleaf.com/learn/latex/Positioning_of_Figures

\newpage

\section{Problem 4: Now he's asking us to build a table?!}

Yeah, you might be asked to build a truth table once or twice.
I'm going to show you how to do it in Latex,
but you might have to figure out what's what.
Here's the table for $P\implies Q$.

% For more information on building a table:
% https://www.overleaf.com/learn/latex/Tables 

\begin{table} %[b] works here too if you want to move the table
\centering
% These vertical bars | in between each c determines the
% vertical lines for your table
\begin{tabular}{c|c|c}
$P$ & $Q$ & $P\implies Q$ \\ \hline % \hline inserts a horizontal line
$0$ & $0$ &      $1$ \\                 % Each & takes you to the next cell
$0$ & $1$ &      $1$ \\                 % \\ takes you to the next row.
$1$ & $0$ &      $0$ \\
$1$ & $1$ &      $1$ \\
\end{tabular}
\caption{\label{tab:implies}A truth table for $P\implies Q$.}
\end{table}

\newpage

\section{Problem 5}

Maybe I'll do something in this section for discussion.

% \emph, \phi, \mathbb, \sum, \frac, \log, \in, \subseteq, \neg, \land, \lor, and \overline.

% \emph means emphasis
\emph{Emphasizing something right here.}
% Similar to \textit{}
\textit{Italic text}.

% \phi is a greek symbol
% math mode required
$\phi$

% \mathbb is a "math" font. Needs \usepackage{amsfonts}
% math mode required.
$\mathbb{ABCZ}$

% \sum summation symbol
$\sum_{i=1}^n$

% Centering, out of line, math mode
\[
\sum_{i=1}^n i = \frac{i(i+1)}{2}
\]

% \log is logarithm
$log n$ vs $\log n$

% Squiggly brackets to actually appear in the document \{ \}
$\mathbb{B} = \{0,1\}$

% \in is element of
$1 \in \mathbb{B}$

% \subseteq is subset equals
$\{0\} \subseteq \mathbb{B}$

% \neg is negation
$\neg b$

% \land is logical AND and \lor is logical OR
$x\land y$ vs $x\lor y$

% Intersection and union
% $X\cup Y$ vs $X \cap Y$

% \overline{xyz} puts a line over xyz
$\overline{PQ}$

\end{document}