# Math Help - [SOLVED] Contradiction between expectation and MGF

1. ## [SOLVED] Contradiction between expectation and MGF

Sorry, it was a stupid question. You can ignore it. But it was a good LATEX practice for me though.

In the text, for
$

$
$P\left (X=x \right )=\binom{x-1}{r-1}p^r\left (1-p \right )^{x-r}; Supp\left (X \right )=\left \{r,r+1,r+2,... \right \}
$

We have
$E(X)=\frac{r}{p}$ and $Var(X)=\frac{r(1-P)}{p^2}$ ; therefore, $E(X^2)=\frac{r^2+r-rp}{p^2}$
I then did that transformation [tex]Y=X-r{/math] to obtain
$P\left (Y=y \right )=\binom{y+r-1}{r-1}p^r\left (1-p \right )^y; Supp\left (Y \right )=\left \{0,1,2,3,... \right \}
$

I then found the MGF to be:
$M_Y(t)=E(e^{tY})=\sum_{y=0}^{\infty }e^{ty}\binom{y+r-1}{r-1}p^r\left (1-p \right )^y=$ $\frac{p^r}{(1-(1-p)e^t)^r};t\neq -\ln (1-p)
$

I then tried us use the MGF to find $E(X)$ and $E(X^2)$

$E(Y)=\frac{d }{d x}M_Y(0)=\frac{r(1-p)}{p}$
and
$E(Y^2)=\frac{d^2 }{d x^2}M_Y(0)=\frac{r(1-p)[(r(1-p)+1]}{p^2}$
therefore
$Var(Y)=\frac{r(1-P)}{p^2}$

So here's my question:
Why does
$E(X)\neq E(Y)$
and
$E(X^2) \neq E(Y^2)$
but
Var(Y)=Var(X)?