\documentclass[a4paper,12pt]{article}

\newcommand{\ds}{\displaystyle}
\begin{document}
\parindent=0pt

{\bf Question}

Suppose that $X$ has the pmf $f(x)=q^{x-1}p,\ x=1,2,3,...\ \
0<p<1,\ p+q=1$.  Find the pgf and the mgf of $X$. Find the mean
and the variance of $X$ using the pgf.

\medskip

{\bf Answer}

The mgf is

\begin{eqnarray*} M_X(t) & = & E(e^{tX})\\ & = &
\sum_{x=1}^{\infty} e^{tX}q^{x-1}p\\ & = & \frac{p}{q}
\sum_{x=1}^{\infty} (qe^t)^x\\ & = & \frac{p}{q}
\{qe^t+(qe^t)^2+(qe^t)^3+...\}\\ & = & \frac{p}{q}
\frac{qe^t}{1-qe^t}\ {\rm if}\ |qe^t|<1 \Leftrightarrow
e^t<\frac{1}{q} \Leftrightarrow t<-\log (1-p)\\ & = &
\frac{pe^t}{1-qe^t}\ {\rm if}\ t<-\log (1-p). \end{eqnarray*}

We can directly obtain the pgf similarly.

$H(t)=E(t^X)=\ds \frac{pt}{1-qt} \ \ \ {\rm if}\ t<\ds
\frac{1}{q}$

$\ds \frac{dH(t)}{dt}=p \ds \frac{1-qt+qt}{(1-qt)^2}=\ds
\frac{p}{(1-qt)^2}$

$\ds \frac{d^2H(t)}{dt^2}=\ds \frac{2pq}{(1-qt)^3}$

Therefore $E(x)=\left.\ds \frac{dH(t)}{dt}\right|_{t=1} = \ds
\frac{p}{(1-q)^2}=\ds \frac{p}{p^2}=\ds \frac{1}{p}$

$E\{X(X-1)\}=\left.\ds \frac{d^2H(t)}{dt^2}\right|_{t=1}= \ds
\frac{2pq}{(1-q)^3}=\ds \frac{2pq}{p^3}=\ds \frac{2q}{p^2}$

Therefore $E(X^2)-E(X)=\ds \frac{2q}{p^2}\Rightarrow E(X^2)=\ds
\frac{2q}{p^2}+\ds \frac{1}{p}.$


Therefore \begin{eqnarray*} var(X) & = & E(X^2)-\{E(X)\}^2\\ & = &
\ds \frac{2q}{p^2}+\ds \frac{1}{p}-\ds \frac{1}{p^2}\\ & = & \ds
\frac{2q+p-1}{p^2}\\ & = & \ds \frac{q+q+p-1}{p^2}\\ & = & \ds
\frac{q}{p^2} \end{eqnarray*}


\end{document}
