\documentclass[12pt]{article}

\usepackage{natepaper,pgf,tikz}
\usetikzlibrary{shapes,arrows,automata}

\newboolean{solutions}
\setboolean{solutions}{true}

\def\gcolor{blue}

\hypersetup{
  pdftitle={STAT/MATH 395 B - Summer 2009B - Homework 1},
  pdfsubject={STAT/MATH 395 B Homework},
  pdfkeywords={STAT/MATH 395 B}
  }

\begin{document}

\nateHeading{STAT/MATH 395 B}{Homework 1 \ifthenelse{\boolean{solutions}}{Solutions}{}}{Derby}{Due August 3, 2009 at 8:30 am}

\ifthenelse{\boolean{solutions}}{}

\begin{enumerate}

\item Let $X \sim \B( 4, p)$.  Find the pmf of the following functions:

    \begin{enumerate}

    \item \textsl{(4 points)} $\frac{X-2}{2}$.

    \ifthenelse{\boolean{solutions}}{

    \begin{sol}

    PUT YOUR ANSWER HERE.
    \end{sol}

    \ }{}

    \item \textsl{(4 points)} $\left| \frac{X-2}{2} \right|$. That is, the absolute value of the random variable in part (a) above.

    \ifthenelse{\boolean{solutions}}{

    \begin{sol}

    PUT YOUR ANSWER HERE.
    \end{sol}

    \ }{}

    \item \textsl{(4 points)} $\left( \frac{X-2}{2} \right)^2$.

    \ifthenelse{\boolean{solutions}}{

    \begin{sol}

    PUT YOUR ANSWER HERE.
    \end{sol}

    \ }{}

    \end{enumerate}


\item Let $X$ have the pdf
    \begin{align*}
    f_X(x) = \begin{cases}
        \frac{4+x}{16} & x \in [-4,0] \\
        \frac{5-x}{25} & x \in (0,5] \\
        0 & \mbox{otherwise}
        \end{cases}.
    \end{align*}

    \begin{enumerate}

    \item \textsl{(4 points)} Find the pdf for $Y = X^2$.

    \ifthenelse{\boolean{solutions}}{

    \begin{sol}

    PUT YOUR ANSWER HERE.
    \end{sol}

    \ }{}

    \item \textsl{(4 points)} Find the pdf for $Y = X^3$.

    \ifthenelse{\boolean{solutions}}{

    \begin{sol}

    PUT YOUR ANSWER HERE.
    \end{sol}

    \ }{}

    \end{enumerate}

\item \textsl{(6 points)} Find the pdf of $X = \sin \theta$, where $\theta \sim \U( 0, \pi )$. Note that unlike in example 5.1.10, $\sin \theta$ is not a 1-1 function over this range of values of $\theta$.

    \ifthenelse{\boolean{solutions}}{

    \begin{sol}

    PUT YOUR ANSWER HERE.
    \end{sol}

    \ }{}

\item Let $X_1 \sim \U( 0, 4)$ be independent of $X_2 \sim \U( 0, 2)$.  Find the pdf of the following functions:

    \begin{enumerate}

    \item \textsl{(6 points)} $X_1 + X_2$.

    \ifthenelse{\boolean{solutions}}{

    \begin{sol}

    First of all, note that our joint pdf is
    \begin{align*}
    f_{X_1 X_2}(x_1, x_2 ) = f_{X_1}(x_1) f_{X_2}(x_2) = \fracs{1}{4} \cdot 1_{\left[ x_1 \in [0,4] \right]} \cdot \frac{1}{2} \cdot 1_{\left[ x_2 \in [0,2] \right]} = \fracs{1}{8} \mbox{ for } x_1 \in [0, 4], \ x_2 \in [0,2],
    \end{align*}
    so that $0 \leq X_1 \leq 4$ and $0 \leq X_2 \leq 2$.  If we make a graph of the points $( x_1, x_2 )$ that have positive (i.e., nonzero) probability, we see that it is a square from the origin to the point $( x_1, x_2 ) = (4,2)$. This is called our \emph{region of support}:

    \begin{center}
    \def\xscale{2}
    \def\yscale{2}
    \begin{tikzpicture}[>=latex']
      \fill[color=\gcolor!15] (0,0) -- (0,2*\yscale) -- (4*\xscale,2*\yscale) -- (4*\xscale,0) -- cycle;
      \draw[<->] (-0.25*\xscale,0) -- (4.75*\xscale,0) node[right] {$x_1$};
      \draw[<->] (0,-0.25*\yscale) -- (0,2.25*\yscale) node[above] {$x_2$};
      \foreach \x/\xtext in {1/1, 2/2, 3/3, 4/4} \draw[shift={(\x*\xscale,0)}] (0pt,0pt) -- (0pt,-2pt) node[below] {$\xtext$};
      \foreach \y/\ytext in {1/1, 2/2} \draw[shift={(0,\y*\yscale)}] (0pt,0pt) -- (-2pt,0pt) node[left] {$\ytext$};
      \draw[color=\gcolor,thick] (0,2*\yscale) -- (4*\xscale,2*\yscale) -- (4*\xscale,0);
    \end{tikzpicture}
    \end{center}

    We know that possible values of $Y = X_1 + X_2$ are between 0 and 6, inclusive.  To find the pdf, we first find $F_Y(y)$ and then take its derivative.  To start this process, we have
    \begin{align*}
    F_Y(y) = \P( Y \leq y ) = \P( X_1 + X_2 \leq y ) = \P( X_2 \leq y - X_1 ).
    \end{align*}
    If we graph this, out region is below the line $x_2 = y - x_1$. Figure \ref{fig.1} shows this region (in dark blue) for the case where $0 \leq y \leq 2$, $2 < y \leq 4$ and $4 < y \leq 6$. Here we see that these three different sets of values for $y$ gives us three different regions. We will set up our double integrals from these graphs.

    \begin{figure}[!tbp]
    \begin{center}
    \begin{tabular}{c}
    \def\xscale{2}
    \def\yscale{2}
    \begin{tikzpicture}[>=latex']
      \fill[color=\gcolor!15] (0,0) -- (0,2*\yscale) -- (4*\xscale,2*\yscale) -- (4*\xscale,0) -- cycle;
      \fill[color=\gcolor!30] (0,0) -- (0,1.6*\yscale) -- (1.6*\xscale,0) -- cycle;
      \draw[<->] (-0.25*\xscale,0) -- (4.75*\xscale,0) node[right] {$x_1$};
      \draw[<->] (0,-0.25*\yscale) -- (0,2.25*\yscale) node[above] {$x_2$};
      \foreach \x/\xtext in {1/1, 1.6/y, 2/2, 3/3, 4/4} \draw[shift={(\x*\xscale,0)}] (0pt,0pt) -- (0pt,-2pt) node[below] {$\xtext$};
      \foreach \y/\ytext in {1/1, 1.6/y, 2/2} \draw[shift={(0,\y*\yscale)}] (0pt,0pt) -- (-2pt,0pt) node[left] {$\ytext$};
      \draw[color=\gcolor,thick] (0,2*\yscale) -- (4*\xscale,2*\yscale) -- (4*\xscale,0);
      \draw[<->,color=\gcolor,thick] (-.2*\xscale,1.8*\yscale) -- (1.8*\xscale,-.2*\yscale);
      \draw (0.8*\xscale,0.8*\yscale) node[rotate=-45, above]{$x_2 = y - x_1$};
    \end{tikzpicture} \\
    $0 \leq y \leq 2$ \\ \\
    \def\xscale{2}
    \def\yscale{2}
    \begin{tikzpicture}[>=latex']
      \fill[color=\gcolor!15] (0,0) -- (0,2*\yscale) -- (4*\xscale,2*\yscale) -- (4*\xscale,0) -- cycle;
      \fill[color=\gcolor!30] (0,0) -- (0,2*\yscale) -- (1.4*\xscale,2*\yscale) -- (3.4*\xscale,0) -- cycle;
      \draw[<->] (-0.25*\xscale,0) -- (4.75*\xscale,0) node[right] {$x_1$};
      \draw[<->] (0,-0.25*\yscale) -- (0,2.25*\yscale) node[above] {$x_2$};
      \foreach \x/\xtext in {1/1, 2/2, 1.4/y-2, 3/3, 3.4/y, 4/4} \draw[shift={(\x*\xscale,0)}] (0pt,0pt) -- (0pt,-2pt) node[below] {$\xtext$};
      \foreach \y/\ytext in {1/1, 2/2} \draw[shift={(0,\y*\yscale)}] (0pt,0pt) -- (-2pt,0pt) node[left] {$\ytext$};
      \draw[color=\gcolor,thick] (0,2*\yscale) -- (4*\xscale,2*\yscale) -- (4*\xscale,0);
      \draw[dashed] (1.4*\xscale,0) -- (1.4*\xscale,2*\yscale);
      \draw[<->,color=\gcolor,thick] (1.2*\xscale,2.2*\yscale) -- (3.6*\xscale,-.2*\yscale);
      \draw (2.6*\xscale,0.8*\yscale) node[rotate=-45, above]{$x_2 = y - x_1$};
    \end{tikzpicture} \\
    $2 < y \leq 4$ \\ \\
    \def\xscale{2}
    \def\yscale{2}
    \begin{tikzpicture}[>=latex']
      \fill[color=\gcolor!15] (0,0) -- (0,2*\yscale) -- (4*\xscale,2*\yscale) -- (4*\xscale,0) -- cycle;
      \fill[color=\gcolor!30] (0,0) -- (0,2*\yscale) -- (2.4*\xscale,2*\yscale) -- (4*\xscale,0.4*\yscale) -- (4*\xscale,0) -- cycle;
      \draw[<->] (-0.25*\xscale,0) -- (4.75*\xscale,0) node[right] {$x_1$};
      \draw[<->] (0,-0.25*\yscale) -- (0,2.25*\yscale) node[above] {$x_2$};
      \foreach \x/\xtext in {1/1, 2/2, 2.4/y-2, 3/3, 3.4/y, 4/4} \draw[shift={(\x*\xscale,0)}] (0pt,0pt) -- (0pt,-2pt) node[below] {$\xtext$};
      \foreach \y/\ytext in {1/1, 2/2} \draw[shift={(0,\y*\yscale)}] (0pt,0pt) -- (-2pt,0pt) node[left] {$\ytext$};
      \draw[color=\gcolor,thick] (0,2*\yscale) -- (4*\xscale,2*\yscale) -- (4*\xscale,0);
      \draw[<->,color=\gcolor,thick] (2.2*\xscale,2.2*\yscale) -- (4.6*\xscale,-.2*\yscale);
      \draw[dashed] (2.4*\xscale,0) -- (2.4*\xscale,2*\yscale);
      \draw (3.3*\xscale,1.1*\yscale) node[rotate=-45, above]{$x_2 = y - x_1$};
    \end{tikzpicture} \\
    $4 < y \leq 6$ \\ \\
    \end{tabular}
    \end{center}
    \caption{The area (in dark blue) representing $X_1 + X_2 \leq y$, for $0 \leq y \leq 2$, $2 < y \leq 4$ and $4 < y \leq 6$.} \label{fig.1}
    \end{figure}

    \

    If $y \in [0,2]$, we can see by the graph on the top of Figure \ref{fig.1} that
    \begin{align*}
    F_Y(y) &= \P( X_2 \leq y - X_1 ) \\
    &= \intb_0^y \int_0^{y-x_1} \frac{1}{8} \ dx_2 dx_1 \\
    &= \frac{1}{8} \intb_0^y y-x_1 \ dx_1 \\
    &= \frac{1}{8} \left( y^2 - \fracb{y^2}{2} \right) \\
    &= \fracb{y^2}{16},
    \end{align*}

    so that $f_Y(y) = \frac{d}{dy}\left( \frac{y^2}{16} \right) = \frac{y}{8}$.

    ...
    \end{sol}

    \ }{}

    \item \textsl{(6 points)} $X_1 - X_2$.

    \ifthenelse{\boolean{solutions}}{

    \begin{sol}

    PUT YOUR ANSWER HERE.
    \end{sol}

    \ }{}

    \item \textsl{(6 points)} $\min( X_1, X_2 )$.

    \ifthenelse{\boolean{solutions}}{

    \begin{sol}

    PUT YOUR ANSWER HERE.
    \end{sol}

    \ }{}

    \item \textsl{(6 points)} $\max( X_1, X_2 )$.

    \ifthenelse{\boolean{solutions}}{

    \begin{sol}

    PUT YOUR ANSWER HERE.
    \end{sol}

    \ }{}

    \item \textsl{(6 points)} $X_1 X_2$.

    \ifthenelse{\boolean{solutions}}{

    \begin{sol}

    PUT YOUR ANSWER HERE.
    \end{sol}

    \ }{}

    \end{enumerate}

\item To beat the traffic, Nate decides to take the Amtrak train between his home in Seattle and his client in Olympia (the Sounder doesn't go to Olympia).  On the way back to Seattle at the end of the day, Nate's train makes a stop in Tacoma.  At around the same time, a Sounder train leaves Tacoma en route for Seattle. Since the Sounder and Amtrak share the same track, if the Sounder leaves first, Nate's Amtrak train is delayed by around 30 minutes, since the Amtrak is stuck behind the Sounder (which makes all local stops between Tacoma and Seattle).  What is the probability that Nate's Amtrak gets caught behind the Sounder if

    \begin{enumerate}

    \item \textsl{(4 points)} The times of Amtrak's and the Sounder's departure from Tacoma are independently distributed as U(5:10, 5:40) and U(5:17, 5:25), respectively?

    \ifthenelse{\boolean{solutions}}{

    \begin{sol}

    PUT YOUR ANSWER HERE.
    \end{sol}

    \ }{}

    \item \textsl{(4 points)} The times of Amtrak's and the Sounder's departure from Tacoma are independently distributed as N($\mu =$5:25, $\sigma = $10 minutes) and N($\mu =$5:21, $\sigma = $2 minutes), respectively?

    \ifthenelse{\boolean{solutions}}{

    \begin{sol}

    PUT YOUR ANSWER HERE.
    \end{sol}

    \ }{}

    \end{enumerate}

\item \textsl{(4 points)} Let $W$ denote the time of the last train leaving Tacoma for Seattle, measured in minutes past 5:00 pm.  Furthermore, assume that the last train is either an Amtrak [distributed as U(5:10, 5:40)] or a Sounder [distributed as U(5:17, 5:25)].  What is the pdf of $W$?

    \ifthenelse{\boolean{solutions}}{

    \begin{sol}

    PUT YOUR ANSWER HERE.
    \end{sol}

    \ }{}

\item \extra \textsl{(Google Interview Problem -- 10 points)} Someone is going to feed you a sequence of numbers of unknown length, one at a time.  Your job is to pick a random sample of exactly $n$ of them, such that every number has an equal probability of being picked.

    To clarify, you get one number at a time, and you know how many you have to pick -- but you have no idea how long the sequence will be.  You don't know if the one you just got was the last one, or if there are a million more to come.  At some point, you'll learn that there's no more input, and whatever you've chosen at that point is what you're stuck with. You need to be able to prove that each item in the sequence could have been picked with equal probability; it can't be that the first ones or last ones are even slightly more likely.

    \ifthenelse{\boolean{solutions}}{

    \begin{sol}

    PUT YOUR ANSWER HERE.
    \end{sol}

    \ }{}

\end{enumerate}

\end{document}
