\documentclass[11pt]{article}

\usepackage {amsfonts}


\title{CS243 Homework Assignment 5}
\date{Due Thursday, Nov 1 2012 \\ Max points: 85}


\begin{document}
\maketitle

 Please hand in a hard copy of your solutions before class on the due date. The
answers to the homework assignment should be typeset using LaTeX and must be your own individual work. You may
discuss problems with  other students in the class; however, your write-up must
mention the names of these individuals. 
 
\begin{enumerate} 
\item (10 points) Prove by induction that the sum of the first $n$ positive odd integers is   $n^2$. Explicitly state whether you are using regular or strong induction.
\item (10 points) Use induction to prove that the following equality holds for every positive integer $n$:
\[
\sum_{i=1}^n i \cdot 2^i = (n-1) \cdot 2^{n+1} + 2
\]
State whether you are using regular or strong induction.
\item (10 points) Prove by induction that $3^n < n!$  for all integers $n$ greater than $6$. State whether you are using regular or strong induction.
\item (15 points) Prove by induction that every integer $n>17$ can be written in the form $n=4a+7b$ where $a,b \geq 0$. State whether you are using regular or strong induction.
\item (10 points, 5 points each) Give a recursive definition of the following:
\begin{enumerate}
\item the set of positive integers congruent to $4$ modulo $5$
\item the sequence defined by $a_n = n(n+1)$ for $n \geq 1$
\end{enumerate}
\item (15 points) Consider the subset $S$ of the set of ordered pairs of integers defined recursively as follows:
\begin{itemize}
\item Base case: $(0,0) \in S$
\item Recursive case: If $(a,b) \in S$, then  $(a+2, b+3)\in S$, and $(a+3, b+2) \in S$
\end{itemize}
Based on this definition:
\begin{enumerate}
\item (5 points) List the first five elements in $S$
\item (10 points) Use structural induction to show that $5|(a+b)$ for all $(a,b) \in S$
\end{enumerate}
\item (15 points) A bitstring is a string consisting of only $0$'s and $1$'s. Consider the following recursive definition 
of the function ``${\rm count}$'', which counts the number of $1$'s in the bitstring:
\begin{itemize}
\item Base case: ${\rm count}(\epsilon) = 0$
\item Recursive case 1: ${\rm count}(1 \cdot s) = 1 + {\rm count}(s)$ 
\item Recursive case 2: ${\rm count}(0 \cdot s) =  {\rm count}(s)$ 
\end{itemize}
Use structural induction to prove that ${\rm count}(st) = {\rm count}(s) + {\rm count}(t)$.
\end{enumerate}
\end{document}
