% This is a simple LaTex sample document that gives a submission format
%   for IEEE PAMI-TC conference submissions.  Use at your own risk.

% Make two column format for LaTex 2e.


\documentclass[11pt,twocolumn]{article} %
\usepackage[dvips]{graphicx,graphics,color}
\usepackage{times,amsmath,amsfonts}
%\usepackage{pancyhdr}
\setlength{\textheight}{10.5in} \setlength{\textwidth}{7in}
\setlength{\columnsep}{0.3in} \setlength{\topmargin}{-0.5in}
\setlength{\headheight}{-0.2in} \setlength{\headsep}{0in}
\setlength{\parindent}{1pc}
\setlength{\oddsidemargin}{-.2in}  % Centers text.
\setlength{\evensidemargin}{-.2in}

% Add the period after section numbers.  Adjust spacing.
\newcommand{\Section}[1]{\vspace{-8pt}\section{\hskip -1em.~~#1}\vspace{-3pt}}
\newcommand{\SubSection}[1]{\vspace{-3pt}\subsection{\hskip -1em.~~#1}
        \vspace{-3pt}}


\newcommand{\bqn}{\begin{eqnarray}}
\newcommand{\eqn}{\end{eqnarray}}
\newcommand{\bq}{\begin{eqnarray*}}
\newcommand{\eq}{\end{eqnarray*}}


\begin{document}

% Don't want date printed
% Make title bold and 14 pt font (Latex default is non-bold, 16pt)

\title{Stat 311-Lecture 05, Random Variables}
% For single author (just remove % characters)
%\author{\Large Probability}
\vspace{-2cm}
\date{ }
% For two authors (default example)
\maketitle \thispagestyle{empty}

Sept 20, 2005


\begin{enumerate}


\item Given a sample space $S$, a {\em random variable} $X$ is a function that
that maps an element in $S$ to a real number, i.e. $X:S \to
\mathbb{R}$. A random variable is {\em discrete} if the number of
elements in a sample space is {\em countable}. The probability
(mass) function $p$ of $X$ is
$$p(a) = P(X=a).$$
Note $\sum_{a \in S} p(a) = \sum_{a \in S} P(X = a) = 1.$

\item {\em Bernoulli random variable} $X$ is a Bernoulli random variable with parameter $p$ if $P(X=1)=p$
and $P(X=0)=1-p$. It will be denoted by $X \sim Bernoulli(p)$. The
distribution can be written as $p(x)=(1-p)^{1-x}p^x$.

\item {\em Problem.} Toss a coin until the first head is obtained. Let $X$ be the
number of tosses. Find the probability
distribution of $X$.\\
{\em Solution.} $P(X=x) = (1-p)^{x-1}p$. This is called the
geometric distribution.



\item Toss a coin $n$ times and let $X$ be the number of heads. If
$X_i$ is the number of heads in the $i$-th toss, $X=X_1 + X_2 +
\cdots + X_n$. This is called the {\em Binomial random variable}
with parameter $n$ and $p$. It will be denoted by $X \sim
Binomial(n,p)$. The distribution is given by $$P(X=x) = {n \choose
x}p^x(1-p)^{n-x}.$$
%$$\mathbb{E}X=np, \mathbb{V}X=np(1-p).$$
%\begin{verbatim}
%> plot(dbinom(0:10,10,0.5),type="s")
%> plot(pbinom(0:10,10,0.5),type="s")
%\end{verbatim}

\begin{figure}[h]
\centering
\includegraphics[width=50mm]{324.07.02.ps}
%\includegraphics[width=50mm]{324.07.01.ps}
\caption{Probability mass function of $Binomial(10,0.5)$}
% Right: cdf of
%$Binomial(10,0.5)$}\label{fig:hist}
\end{figure}

\item Two factory workers produced 5 items each. When there are 4
defective products found, what is the probability that the first
worker is responsible for the half of the defection? Assume the probability of
producing a defective item is $p$.\\
{\em Solution.} Let $X_i$ be the number of defective products for
the $i$-th worker. Then $X_1,X_2 \sim \mbox{Binomial}(5,p)$. Note
that $X_1 +X_2 \sim \mbox{Binomial}(10,p)$. Hence
\bq & & P(X_1=2|X_1+X_2=4)\\
 &=& \frac{P(X_1=2,X_2=2)}{P(X_1+X_2=4)} \\
&=& \frac{P(X_1=2)P(X_2=2)}{P(X_1+X_2=4)} \\
&=& \frac{{5 \choose 2} p^2(1-p)^3{5 \choose 2}p^2(1-p)^3}{{10
\choose 4}p^4(1-p)^6} =\frac{{5 \choose 2} {5 \choose 2}}{{10
\choose 4}} = 0.48.\eq
%{\em Solution 2.} One bright student
%suggested me the following solution. Exactly two defective regultors
%must come from line I and two from line II. Hence the probability
%can be computed using a hypergeometric distribution, i.e. $\frac{{5
%\choose 2} {5 \choose 2}}{{10 \choose 4}}=0.48$.


%\item The {\em cumulative distribution function} (cdf) of a discrete random
%variable $X$ is is defined as $$F(x) = P(X \leq x)= \sum_{y \leq x}
%p(y).$$
%\item Find cdf of the geometric distribution.\\
%{\em Solution.} For positive integer $x$, $F(x) = 1 - (1-p)^x$.


%\item {\em Problem.} Two players $A$ and $B$ flip a biased coin alternately and the first player
%to obtain a head wins. The probability of obtaining a head is $p >
%0$ at each toss.
% If $A$ flips first, find the probability that $A$ wins the game.\\
%{\it solution.} Let $X$ be the number of tosses $A$ makes until he
%gets head.
%\bq P(A \mbox{ wins }) &=& P(X=1)+P(X=2)+P(X=3) + \cdots \\
%&=& p + (1-p)^2p + (1-p)^4p + \dots\\
%&=& \frac{p}{1-(1-p)^2} \eq

\end{enumerate}

{\bf Homework 2.} Due October 6 (Thursday) 8:00am. Solve the
following 8 problems in Chapter 3: Problems 6, 20, 32, 53, 67, 82,
84. Theoretical Exercises 2.


\end{document}
