% 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]{article} %
\usepackage[dvips]{graphicx,graphics,color}
\usepackage{times,amsmath,amsfonts}

\setlength{\textheight}{10in} \setlength{\textwidth}{6.875in}
\setlength{\columnsep}{0.3125in} \setlength{\topmargin}{-0.5in}
\setlength{\headheight}{0in} \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
\date{February 3, 2005}

% Make title bold and 14 pt font (Latex default is non-bold, 16pt)
\title{Stat 324: Lecture 06\\
Expectation}

% For single author (just remove % characters)
\author{Moo K. Chung\\
mchung@stat.wisc.edu}

% For two authors (default example)
\maketitle \thispagestyle{empty}
\begin{enumerate}

\item The {\em expected value} of a discrete random variable $X$
is defined as $$\mathbb{E} X = \sum xP(X=x)=\sum xp(x).$$

Problem. The expectation of the geometric distribution is $1/p$.

\item The expected value of function $Y=h(X)$ is
$$\mathbb{E} h(X) = \sum_{y} yP(h(X)=y) = \sum_{x} h(x)P(h(X)=h(x))
=\sum_{x} h(x)P(X=x)=\sum_{x} h(x)p(x).$$ Based on this fact, it can
be shown that $\mathbb{E} (aX + b) = a\mathbb{E} X + b$.

\item $\mathbb{V} X = \mathbb{E} X^2 - (\mathbb{E} X)^2$.
$\mathbb{V} (aX+b) = a^2 \mathbb{V} X$.

\item For $X \sim Bernoulli(p)$, $\mathbb{E} X = p$ and $\mathbb{V}
X = p$.

\item Consider an experiment that give only two outcomes $H$ or $T$.
Let $P(H)=p$ and $P(T)=1-p$. This is a Bernoulli experiment. Now
consider $n$ independent experiments where each experiment gives
only two outcomes. This is a {\em Binomial experiment}. Let $X$ be
the number of outcome $H$. This is called the {\em Binomial random
variable} with parameter $n$ and $p$. It will be denoted by $X \sim
Binomial(n,p)$. Note that if $X_i$ is the number of outcome $H$ in
the $i$-th experiment, $X=X_1 + X_2 + \cdots + X_n$.


\item {\em Problem.} Find a value $c$ that minimizes $\mathbb{E}(X-c)^2$ for a discrete random variable X.\\
{\it solution.} Let $f(c) = \mathbb{E}(X-c)^2 = c^2 -(2\mathbb{E}X)c
+ \mathbb{E}X^2$. Then $f(c)$ is minimum at a point where $f'(c)=0$.
$f'(c)=2c-2\mathbb{E}X=0$. So $c=\mathbb{E}X$ will give the minimum.
\item {\em Problem.} A man with $n$ keys wants to open his door and tries the keys at random.
Exactly one key will open the door. Find the mean and the variance of the number of trials if unsuccessful keys are eliminated.\\
{\it solution.} Let $X$ be the number of trials. Then $P(X=1) =
\frac{1}{n}, P(X=2) = \frac{n-1}{n}\frac{1}{n-1}=\frac{1}{n},\cdots,
P(X=n)=\frac{n-1}{n}\dots \frac{1}{2}=\frac{1}{n}.$ The random
varialble $X$ is said to be {\em uniformly} distributed (or a
discrete uniform random variable).
$$\mathbb{E}X=\sum_{x=1}^n \frac{x}{n} = \frac{1}{n}\sum_{x=1}^n x= \frac{1}{n}\frac{n(n+1)}{2}=\frac{n+1}{2}.$$
$$\mathbb{E}X^2 = \sum_{x=1}^n \frac{x^2}{n} =\frac{1}{n}\frac{n(n+1)(2n+1)}{6}.$$
So ${\bf Var} X = \frac{(n+1)(2n+1)}{6} - \frac{(n+1)^2}{4}.$
\item {\em Problem.} For $X \sim \text{Binomial}(n,p)$, compute $\mathbb{E}(X^3)$.\\
{\it Solution .} From p. 104 of your textbook, $\mathbb{E}X(X-1)=n(n-1)p^2$. Note that $\mathbb{E}X^3 = \mathbb{E}X(X-1)(X-2) -3\mathbb{E}X^2 + 2\mathbb{E} = n(n-1)(n-2)p^3$. \\
%{\it solution 2.} The moment generating function is defined as
%$M_X(t) = \sum_{x=0}^n e^{tx}{n \choose x}p^x(1-p)^{n-x}=
%[pe^t+1-p]^n$ using the Binomial expansion. Then
%$$M_X^{(2)}(t) = npe^t[pe^t+1-p]^{n-1}+n(n-1)p^2e^{2t}[pe^t+1-p]^{n-2}.$$
%$$\mathbb{E}(X^3) = M_X^{(3)}(0) = np + 3n(n-1)p^2 - n(n-1)(n-2)p^3$$
\end{enumerate}
{\bf Assigned Problems} Exercise 3.38., Exercise 3.50. Second
Homework due on Feb 10. 9:30AM. Submit solutions to assigned
problems from Lecture 4-7 (8 problems).


\end{document}
