\documentclass[11pt]{exam}
\usepackage{graphicx}
\usepackage{anysize}
\usepackage{dsfont}
\usepackage{fullpage}
\usepackage{verbatim}
\usepackage{url,amsfonts, amsmath, amssymb, amsthm,color, enumerate, multicol}
\usepackage{placeins}

\printanswers
%\noprintanswers

\begin{document}

\title{ EECS 203: Discrete Mathematics \\
        Homework 1 (Winter 2016)}
\date{Due: May 5, 2016}
\author{Answer Key}

\maketitle

\begin{questions}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{\bf \item[] Textbook Questions:}
\question[3] Section 1.1 Problem 12 (c,d,e,f)\\
%%
\begin{solution}
\begin{enumerate}[a)]
\addtocounter{enumi}{2}
\item If you miss the final exam, then you do not pass the course.
\item You have the flu, or miss the final exam, or pass the course.
\item It is either the case that if you have the flu then you do not pass the course or the case that if you miss the final exam then you do not pass the course (or both, it is understood).
\item Either you have the flu and miss the final exam, or you do not miss the final exam and do pass the course.
\end{enumerate}
\end{solution}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\question[3] Section 1.1 Problem 24(a,d,g)\\
%%
\begin{solution}
\begin{enumerate}[a)]
\item If I am to remember to send you the address, then you will have to send me an e-mail message. (This has been slightly reworded so that the tenses make more sense.)
\addtocounter{enumi}{2}
\item If their goaltender plays well, then the Red Wings will win the Stanley Cup.
\addtocounter{enumi}{2}
\item If you log on to the server, then you have a valid password.
\end{enumerate}

\end{solution}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\question[3] Section 1.1 Problem 28\\
%%
\begin{solution}
\begin{enumerate}
\item Converse: If I stay home, then it will snow tonight. Contrapositive: If I do not stay at home, then it will not snow tonight. Inverse: If it does not snow tonight, then I will not stay home.
\item Converse: Whenever I go to the beach, it is a sunny summer day. Contrapositive: Whenever I do not go to the beach, it is not a sunny summer day. Inverse: Whenever it is not a sunny day, I do not go to the beach.
\item Converse: If I sleep until noon, then I stayed up late. Contrapositive: If I do not sleep until noon, then I did not stay up late. Inverse: If I don’t stay up late, then I don’t sleep until noon.
\end{enumerate}
\end{solution}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\question[3] Section 1.1 Problem 34 (a,d,f)\\
%%
\begin{solution}
\begin{enumerate}[a)]
\item\ \\
\begin{tabular}{|c|c|}
\hline
$p$&$p\oplus p$\\\hline
T&F\\\hline
F&F\\\hline
\end{tabular}
\addtocounter{enumi}{2}
\item\ \\
\begin{tabular}{|c|c|c|c|c|}
\hline
$p$ & $q$ & $\neg p$ & $\neg q$ & $\neg p\oplus\neg q$\\\hline
F & F & T & T & F\\\hline
F & T & T & F & T\\\hline
T & F & F & T & T\\\hline
T & T & F & F & F\\\hline
\end{tabular}
\addtocounter{enumi}{1}
\item\ \\
\begin{tabular}{|c|c|c|c|c|c|}
\hline
$p$ & $q$ & $\neg q$ & $p\oplus q$ & $p\oplus\neg q$ & $(p\oplus q)\wedge(p\oplus\neg q)$\\\hline
F & F & T & F & T & F\\\hline
F & T & F & T & F & F\\\hline
T & F & T & T & F & F\\\hline
T & T & F & F & T & F\\\hline
\end{tabular}
\end{enumerate}
\end{solution}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\question[3] Section 1.2 Problem 20\\
%%
\begin{solution}
If A is a knight, then her statement that both of them are knights is true, and both will be telling the truth. But that is impossible, because B is asserting otherwise (that A is a knave). If A is a knave, then B's assertion is true, so he must be a knight, and A's assertion is false, as it should be. Thus we conclude that A is a knave and B is a knight.
\end{solution}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\question[3] Section 1.2 Problem 26\\
%%
\begin{solution}
There is no solution, because neither a knight nor a knave would ever claim to be the knave.
\end{solution}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\question[3] Section 1.2 Problem 40\\
%%
\begin{solution}
\begin{enumerate}[a)]
\item Each of p and q is negated and fed to the OR gate. Therefore the output is $(\neg p)\vee(\neg q)$.
\item $\neg(p\vee((\neg p)\wedge q))$
\end{enumerate}
\end{solution}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\question[3] Section 1.3 Problem 6\\
%%
\begin{solution}
\ \\
\begin{tabular}{|c|c|c|c|c|c|c|}
\hline
$p$ & $q$ & $\neg p$ & $\neg q$ & $\neg p\vee \neg q$ & $p\wedge q$ & $\neg(p\wedge q)$\\\hline
F & F & T & T & T & F & T\\\hline
F & T & T & F & T & F & T\\\hline
T & F & F & T & T & F & T\\\hline
T & T & F & F & F & T & F\\\hline
\end{tabular}
\end{solution}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\question[3] Section 1.3 Problem 24\\
%%
\begin{solution}
We can solve this either by logical equivalence or by truth table:

\begin{tabular}{rll}
$(p\rightarrow q)\vee (p\rightarrow r)$ & $\equiv (\neg p\vee q)\vee (\neg p\vee r)$ & Definition of $\rightarrow$\\
&$\equiv (\neg p\vee \neg p)\vee(q\vee r)$&Commutative and Associative\\
&$\equiv \neg p\vee(q\vee r)$&Idempotent\\
&$\equiv p\rightarrow(q\vee r)$&Definition of $\rightarrow$
\end{tabular}

\begin{tabular}{|c|c|c|c|c|c|c|c|}
\hline
$p$ & $q$ & $r$ & $p\rightarrow q$ & $p\rightarrow r$ & $(p\rightarrow q)\vee(p\rightarrow r)$ & $q\vee r$ & $p\rightarrow(q\vee r)$\\\hline
F & F & F & T & T & T & F & T\\\hline
F & F & T & T & T & T & T & T\\\hline
F & T & F & T & T & T & T & T\\\hline
F & T & T & T & T & T & T & T\\\hline
T & F & F & F & F & F & F & F\\\hline
T & F & T & F & T & T & T & T\\\hline
T & T & F & T & F & T & T & T\\\hline
T & T & T & T & T & T & T & T\\\hline
\end{tabular}
\end{solution}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\question[3] Section 1.3 Problem 30
%%
\begin{solution}
Once again we can choose to use logical equivalence or truth tables to show this is always true.




$((p\vee q)\wedge (\neg p\vee r))\rightarrow(q\vee r)$\\
\begin{tabular}{ll}
$\equiv \neg((p\vee q)\wedge (\neg p\vee r))\vee (q\vee r)$ & Definition of $\rightarrow$\\
$\equiv\neg(p\vee q)\vee \neg(\neg p\vee r)\vee q\vee r$ & De Morgan's Law\\
$\equiv(\neg p\wedge\neg q)\vee (\neg\neg p\wedge \neg r)\vee q\vee r$ & De Morgan's Law (2)\\
$\equiv(\neg p\wedge\neg q)\vee (p\wedge\neg r)\vee q\vee r$ & Double Negation Law\\
$\equiv(\neg p\wedge\neg q)\vee q\vee(p\wedge\neg r)\vee r$ & Commutative and Associative\\
$\equiv((\neg p\vee q)\wedge(\neg q\vee q)) \vee((p\vee r)\wedge (\neg r\vee r))$ & Distributive (2)\\
$\equiv((\neg p\vee q)\wedge T)\vee((p\vee r)\wedge T)$ & Negation Law (2)\\
$\equiv(\neg p\vee q)\vee (p\vee r)$ & Identity Law (2)\\
$\equiv(\neg p\vee p)\vee (q\vee r)$ & Commutative and Associative\\
$\equiv T\vee (q\vee r)$ & Negation Law\\
$\equiv T$ & Domination





\end{tabular}

\begin{tabular}{|c|c|c|c|c|c|c|c|c|}
\hline




$p$ & $q$ & $r$ & $\neg p$ & $p\vee q$ & $\neg  p\vee r$ & $(p\vee q)\wedge(\neg p\vee r)$ & $q\vee r$ & $(p\vee q)\wedge(\neg p\vee r)\rightarrow(q\vee r)$\\\hline
F & F & F & T & F & T & F & F & T\\\hline
F & F & T & T & F & T & F & T & T\\\hline
F & T & F & T & T & T & T & T & T\\\hline
F & T & T & T & T & T & T & T & T\\\hline
T & F & F & F & T & F & F & F & T\\\hline
T & F & T & F & T & T & T & T & T\\\hline
T & T & F & F & T & F & F & T & T\\\hline
T & T & T & F & T & T & T & T & T\\\hline
\end{tabular}



\end{solution}


\end{questions}

\end{document}