\documentclass[letterpaper,11pt]{article}

\newcommand{\removefromfile}[1]{}

\usepackage{algorithm}
\usepackage[noend]{algpseudocode}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{enumitem}
\usepackage{hyperref}
\usepackage[most]{tcolorbox}
\renewcommand{\theenumi}{\alph{enumi}}
\providecommand{\Exp}{\mathbb{E}}
\providecommand{\Var}{\text{Var}}


\begin{document}
\title{{\bf Problem Set 6 Solutions}}
\author{Name: TODO}
\date{}
\maketitle

\section*{Collaborators}
\begin{tcolorbox}
List collaborators, if any.
\end{tcolorbox}

\section*{Use of 312 Learning Assistant}
\begin{tcolorbox}
List which problems you used the 312 Learning Assistant on.
\end{tcolorbox}

\newpage
\section{Gradescope Questions (69 points)}
Please do the questions on Gradescope.
\begin{tcolorbox}
Nothing to write for this question.
\end{tcolorbox}

\newpage
\section{Charging Up (8 points)}
Suppose you plug your electric vehicle into a public variable-rate charger to add exactly 180 miles of range. 
Suppose that the charging speed of this station (in miles of range added per hour) is uniformly distributed between 15 and 30 miles per hour. 
Let $T$ be the time it takes to finish adding the 180 miles of range. Use LOTUS to compute $\Exp[T]$.

\textit{Hint: Recall that the indefinite integral of $g(x) = x^{-1}$ is equal to $\ln(x) + C$, assuming $x > 0$.}

\begin{tcolorbox}
TODO: Your solution here.
\end{tcolorbox}

\newpage
\section{Alarms (11 points)}
Suppose that you set three alarms to make sure that you get up in time for class.
\begin{itemize}
\item Alarm A goes off after $X_A$ amount of time, where $X_A\sim \text{Exponential}(\lambda_A)$.
\item Alarm B goes off after $X_B$ amount of time, where $X_B\sim \text{Exponential}(\lambda_B)$.
\item Alarm C goes off after $X_C$ amount of time, where $X_C\sim \text{Exponential}(\lambda_C)$.
\end{itemize}
You may assume that each alarm is independent of one another.

\begin{enumerate}
    

\item (6 points) Let $T$ be the time until the first of the three alarms go off.
What is $\Pr(T \ge t)$? Use this to efficiently determine  $\Exp[T]$ and $\Var(T)$.

\begin{tcolorbox}
TODO: Your solution here.
\end{tcolorbox}

\item (5 points) What is the probability that Alarm A is the one that wakes you up?
That is, find $\Pr(X_A < X_B \cap X_A < X_C)$.
Use the law of total probability, conditioning on the value of $X_A$.

One form of the continuous law of total probability is the following: If 
$E$ is an event, and $X$ is a continuous random variable with density function $f_X(x)$.
\[\Pr(E)=\int_{-\infty}^\infty{\Pr(E \mid X=x)f_X(x)dx}\]

\begin{tcolorbox}
TODO: Your solution here.
\end{tcolorbox}
\end{enumerate}

\newpage
The next two problems will require lookups in the \href{https://courses.cs.washington.edu/courses/cse312/26sp/resources/z_table_accessible.html}{Z-table.}

\section{Data from outer space (10 points)}
Error-correcting codes are used in order to compensate for errors in transmission of messages (and in recovery of stored data from unreliable hardware).
%
You are on a mission to Mars and need to send regular updates to mission control. Most of the packets actually don't get through, but you are using an error-correcting code that can let mission control recover the original message you send as long as at least 128 packets are received (not erased). Suppose that each packet gets erased independently with probability 0.6. How many packets should you send such that you can recover the message with probability at least 99\% ?
\smallskip


Use the Central Limit Theorem to approximate the answer, using the continuity correction. Final answer should be
an integer number of packets and your intermediate calculations should be
correct to sufficient precision (e.g. 4 decimal places) to ensure a good approximation.


\begin{tcolorbox}
TODO: Your solution here.
\end{tcolorbox}



\newpage
\section{Distant Stars (15 points)}
An astronomer would like to measure the distance (in light years) from her observatory to a distant star. Each measurement is noisy, yielding only an estimate of the distance. Therefore, the astronomer plans to make a series of independent measurements and then use the average value of these measurements as her estimate of the actual distance. Suppose that each measurement has mean $D$  (the true distance) and a variance of 4 light years. How many measurements does she need to make to be 95\% confident that her estimate is accurate to within $\pm 0.5$ light years?

\begin{tcolorbox}
TODO: Your solution here.
\end{tcolorbox}
    

\end{document}