\documentclass[11pt]{article}
\usepackage{fullpage}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{enumitem,amssymb}
\usepackage[linesnumbered,lined]{algorithm2e}
\usepackage{scrextend}
\makeatletter
\renewcommand{\@algocf@capt@plain}{above}% formerly {bottom}
\makeatother
\usepackage{enumitem}
\setlist[enumerate]{listparindent=\parindent}
\usepackage[colorlinks=true]{hyperref}
\usepackage{cleveref}%[nameinlink]
\crefname{lemma}{Lemma}{Lemmas}
\crefname{proposition}{Proposition}{Propositions}
\crefname{definition}{Definition}{Definitions}
\crefname{theorem}{Theorem}{Theorems}
\crefname{conjecture}{Conjecture}{Conjectures}
\crefname{corollary}{Corollary}{Corollaries}
\crefname{section}{Section}{Sections}
\crefname{appendix}{Appendix}{Appendices}
\crefname{figure}{Fig.}{Figs.}
\crefname{equation}{Eq.}{Eqs.}
\crefname{table}{Table}{Tables}
\crefname{algocf}{Algorithm}{Algorithms}
\title{CS200 - Problem Set 1\\\small{Due: Monday, Feb. 19. Upload to Canvas before the beginning of class}}
\author{}
\date{}
\parindent=.25in
\begin{document}
\maketitle
Please read the sections of the syllabus on problem sets and honor code before starting this homework.
\begin{enumerate}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\item \textit{Errors in Inductive Proofs}
\begin{enumerate}
\item \textbf{[2 points]} \href{http://discretetext.oscarlevin.com/dmoi/sec_seq-induction.html#exercises_seq-induction}{DMOI 2.5.14}. (You only need to do problem 14 in this section.)
{}
\item \textbf{[6 points]} Explain what is wrong with the following inductive proof that all Middlebury students have the same eye color. I find it easiest to describe the issue by using the ``ladder'' analogy from class.
\noindent\textbf{Proof:}
Let $P(n)$ be the predicate that any set of $n$ Middlebury students have the same eye color. We will prove $P(n)$ is true for all $n\in \mathbb{N}$ for $n\geq 1.$
Base case: $P(1)$ is true because any one Middlebury student has the same eye color as themselves.
Inductive case: Let $k\geq 1$. Assume for induction that any set of $k$ Middlebury students have the same eye color. Now let's consider any set of $k+1$ Middlebury students.
If we look at the first $k$ of those $k+1$ students, by our inductive assumption they must all have the same eye color. However, if we look at the last $k$ of those $k+1$ students, by our inductive assumption, they must also all have the same eye color. Now the second student must be part of the first set of $k$ and the last set of $k$, so all $k+1$ students must have the same eye color as this second student. Thus, any set of $k+1$ Middlebury students have the same eye color.
Therefore, by induction, $P(n)$ is true for all $n\geq 1.$
{}
\end{enumerate}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\item \textit{Inductive Proofs}
\begin{enumerate}
\item \textbf{[11 points]}
Prove using induction that for $n \geq 0$, $7^n - 2^n$ is divisible by 5. (An integer $m$ is divisible by an integer $r$ if $m=r\cdot g$, where $g$ is some other integer.)
{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\item \textbf{[11 points]} Prove using induction that $2^n>n^2$ whenever $n$ is an integer, and $n\geq 5.$
{}
\item \textbf{[11 points]} Prove that $1+2+3+\dots+n=n(n+1)/2$ for any integer $n$ such that $n\geq 1$. (So when $n=1$, we want to evaluate $1$, when $n=2,$ we want to evaluate $1+2$, when $n=3$ we want to evaluate $1+2+3$, etc.)
{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\item \textbf{[11 points]} Finish the following proof that Algorithm \ref{algocf:mult} correctly multiplies an integer $n\geq 0$ and an integer $b$.
~\\
\begin{algorithm}[H]
\SetKwInOut{Input}{Input}
\SetKwInOut{Output}{Output}
\Input{Non-negative integer $n$, and integer $b$}
\Output{$n\times b$}
\tcc{Base Case}
\eIf{$n==0$}{
return $0$\;
}
{ \tcp{Recursive step}
return $b+\texttt{Mult}(n-1,b)$\;
}
\caption{\texttt{Mult}$(n,b)$}\label{algocf:mult}
\end{algorithm}
\noindent\textbf{Proof:} Let $P(n)$ be the predicate: \texttt{Mult}(n,b) correctly outputs the product of $n$ and $b.$ We will prove using induction that $P(n)$ is true for all $n\geq 0.$
For the base case, let $n=0$. In this case, we see the \texttt{If} statement is true at line 1, and so the algorithm returns 0. This is precisely what we want, since $0\times b=0$ for any integer $b$, so the algorithm is correct and $P(0)$ is true.
For the inductive step...
{}
\end{enumerate}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\item How long did you spend on this homework?
\end{enumerate}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{document}