Compute $m_Z (t)$. Verify that $m'_Z (0)$ = $E(Z)$ and $m''_Z(0) = E(Z^2)$ Let $Z$ be a discrete random variable with $P(Z = z)$ = $1/2^z$ for $z = 1, 2, 3,...$
(b) Compute $m_Z (t)$. Verify that $m'_Z (0)$ = $E(Z)$ and $m''_Z(0) = E(Z^2)$
$E(Z) = \sum_{z=1}^{\infty} z P(Z = z) =\sum_{z=1}^{\infty} \frac{z}{2^z}$ Not sure how to proceed. $z^2$ for $E(Z^2)$
$m_z(t) = E[e^{tz}] = \sum_{z=1}^{\infty} \frac{e^{tz}}{2^z} = \sum_{z=1}^{\infty} (2e)^{tz - z} = \sum_{z=1}^{\infty} (2e)^{z(t-1)} = \frac{(2e)^{t-1}}{1-2e}$
Not sure if above is right.
I know afterward, I would just take the derivative of $m_z(t)$ once and twice and set $t = 0$ to verify but having trouble simplifying.
 A: It is not true that
$$\frac{\exp(tz)}{2^z}=(2\text{e})^{tz-z}\,.$$
You can easily check that your version of $m_Z$ does not satisfy $m_Z(0)=1$.  The correct moment generating function should be $$m_Z(t)=\sum_{z=1}^\infty\,\frac{\exp({tz})}{2^z}=\sum_{z=1}^\infty\,\left(\frac{\exp(t)}{2}\right)^z=\frac{\left(\frac{\exp(t)}{2}\right)}{1-\left(\frac{\exp(t)}{2}\right)}=\frac{\exp(t)}{2-\exp(t)}\,.$$
It should be easy to find $m_Z'$ and $m_Z''$ now.  As for the calculations of $\mathbb{E}[Z]$ and $\mathbb{E}[Z^2]$, this link should be very useful: Proof of the equality $\sum\limits_{k=1}^{\infty} \frac{k^2}{2^k} = 6$.
A: The mistake is $$\frac{e^{tz}}{2^z} = (2e)^{tz - z}$$
Actually
$$\frac{e^{tz}}{2^z} = (\frac {e^t} 2)^z \tag{*}$$
Anyhoo, right off the bat, you might recall the form $\frac 1 {2^z}$. It's a term of a geometric sequence. Do you know of the geometric distribution?
Anyhoo, let's compute moments with mgf: $\forall |k| < 1$, we have
$$\frac 1 {1-k} = \sum_{z=0}^{\infty} k^z$$
$$\implies \frac{d}{dk} \frac 1 {1-k} = \frac{d}{dk} \sum_{z=0}^{\infty} k^z$$
$$\implies \frac{d}{dk} \frac 1 {1-k} = \sum_{z=0}^{\infty} \frac{d}{dk} k^z$$
$$\implies \frac 1 {(1-k)^2} = \sum_{z=0}^{\infty} zk^{z-1}$$
$$\implies \frac 1 {(1-k)^2} = \sum_{z=1}^{\infty} zk^{z-1}$$
$$\implies \frac k {(1-k)^2} = \sum_{z=1}^{\infty} zk^{z}$$
$$\implies \frac 1 2 {(1-\frac 1 2)^2} = \sum_{z=1}^{\infty} z(\frac 1 2)^{z} = E[Z]$$
What's the moral lesson? We recognise $$\sum_{z=1}^{\infty} z(\frac 1 2)^{z} = E[Z]$$ as having to do with the derivative or integral of a geometric series. Similarly for the second moment we have, $$\sum_{z=1}^{\infty} z^2(\frac 1 2)^{z} = E[Z^2],$$ where we compute as follows:
$$\frac{d}{dk} \frac k {(1-k)^2} = \frac{d}{dk} \sum_{z=1}^{\infty} zk^{z}$$
$$\implies \frac{d}{dk} \frac k {(1-k)^2} = \sum_{z=1}^{\infty} \frac{d}{dk} zk^{z}$$
$$ = \sum_{z=1}^{\infty} \frac{d}{dk} zk^{z} = \sum_{z=1}^{\infty} z^2k^{z-1}$$
$$\therefore, ([k][\frac{d}{dk} \frac k {(1-k)^2}])|_{k=\frac 1 2} = \sum_{z=1}^{\infty} z^2k^{z}|_{k=\frac 1 2} = E[Z^2]$$
Now, how do we do this the mgf way? Let's go back to $(*)$
$$M_Z(t) = \sum_{z=1}^{\infty} \frac{e^{tz}}{2^z} = \sum_{z=1}^{\infty} (\frac {e^t} 2)^z = \frac{\frac {e^t} 2}{1 - \frac {e^t} 2}$$
This agrees with the mgf for geometric on Wiki with $p=\frac 1 2$.
So just differentiate and plug in:
$$M_Z'(t) = \frac{d}{dt} \frac{\frac {e^t} 2}{1 - \frac {e^t} 2}$$
$$\therefore, M_Z'(0) = [\frac{d}{dt} \frac{\frac {e^t} 2}{1 - \frac {e^t} 2}]|_{t=0}$$
$$M_Z''(t) = \frac{d}{dt} \frac{d}{dt} \frac{\frac {e^t} 2}{1 - \frac {e^t} 2}$$
$$\therefore, M_Z''(0) = [\frac{d}{dt} \frac{d}{dt} \frac{\frac {e^t} 2}{1 - \frac {e^t} 2}]|_{t=0}$$
