% 
% hw1.tex
%
%   This is a LaTeX template to get you started
%   making problem-set solutions
%
 
\documentclass[11pt]{article}
\usepackage{amsmath}
\setlength{\oddsidemargin}{0in}
\setlength{\evensidemargin}{0in}
\setlength{\textheight}{9.0in}
\setlength{\textwidth}{6.5in}
\setlength{\topmargin}{-0.5in}

% *** GRAPHICS RELATED PACKAGES ***
%

\usepackage[pdftex]{graphicx}
 \graphicspath{{./}}
 \DeclareGraphicsExtensions{.pdf,.jpeg,.png}
 
 \newcommand{\centerfig}[2]{%
\centerline{\includegraphics[#2]{#1}}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\title{\bf AI+X: Introduction to data science\\[2ex] 
       \rm\normalsize AIX0008  (Summer 2022)}
\date{\today}
\author{Patrice Koehl\\koehl@cs.ucdavis.edu}

\begin{document}
\maketitle
\section*{\underline{Homework 1 - For July 4th, 2022}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section*{Exercise 1 \emph{(10 points)}} 

There are 100 cats living in a barn, all are either brown or orange. There is at least one orange cat. For every two cats, at least one is brown. How many orange cats and how many brown cats are there? 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section*{Exercise 2 \emph{(10 points)}} 

You are on an island inhabited by two types of people: knights (always make true statements) and knaves (always make false statements).  You come across 2 people Adam and Ben.  They say the following:
\begin{itemize}
\item Adam: ``At least one of us a a knave"
\item Ben says nothing!
\end{itemize}
Determine which person is what or whether you do not have enough information.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section*{Exercise 3 \emph{(10 points)}} 

You are on an island inhabited by three types of people: knights (always make true statements), knaves (always make false statements) and normals (sometimes make true statements and sometimes make false statements). You come across 3 people Adam, Ben and Carl. You know that one is a knight, one is a knave and one is a normal. They say the following:
\begin{itemize}
\item Adam: ``Ben is a normal."
\item Ben: ``Carl is a normal."
\item Carl: ``Ben is a normal."
\end{itemize}
Determine which person is what or whether you do not have enough information.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section*{Exercise 4 \emph{(10 points)}} 

 Let us play a logical game. You find yourself in front of three rooms whose doors are closed. One of these rooms contains a Lady, another a Tiger and the third room in empty.  There is one sign on each door; you are told that the sign on the door of the room containing the Lady is true, the sign on the door of the room with the Tiger is false, and the sign on the door of the empty room could be either true or false.  Here are the signs:

\begin{figure}[hbt]
\centerfig{Figure_Rooms}{width=1.0\textwidth,clip=true}
\caption{The three rooms and their signs}
\end{figure}

Can you find what is behind each door?


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section*{Exercise 5 \emph{(4 questions, 5 points each; total 20 points)}} 

\begin{itemize}
\item What is the binary representation of the hexadecimal 7F?
\item What is the hexadecimal representation of the binary number 1100101?
\item How many bytes are there in one megabyte?
\item What is the largest  negative number (in magnitude) that can be stored in one byte?
\end{itemize}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section*{Exercise 6 \emph{(10 points)}} 

How much space would you need to store a 10 min song that has been sampled at 44.1 kHz, with each data point stored on 16 bits, in mono (i.e. a single speaker) (assume no compression).

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section*{Extra credit \emph{(5 points)}} 

You arrive in a country called Transylvania whose inhabitants are humans and vampires. Humans
always tell the truth, while vampires always lie. However, both humans and vampires can be sane
or insane. If an inhabitant is insane, she will believe that a truth statement is false, and a false
statement is true. Sane inhabitants believe that truth statements are true and false statements are
false. Thus sane humans and insane vampires make only true statements, while insane humans and
sane vampires make only false statements. You meet two inhabitants, A and B. You know that one
of them is a human, and the other is a vampire. A tells you: we are both insane, while B tells you
that at least one of us is sane. From this, can you find which one is the vampire?

\end{document}

