How to get Expectation and Variance of Geometric Distributions A random variable N follows a geometric distribution with the "Success Rate" = $\alpha$, so that $P [N=k] = \alpha (1-\alpha)^{k-1},$ for $k$ = 1,2,...
Random variables $(Y_1 , Y_2...)$ are independent replications of a random variable $(Y)$. Also assume that these replications are independent from $N$. The distribution of $Y$ is shown below: 
$P[Y=3] = \frac{1}{4} $ and $P[Y=-1]=\frac{3}{4}$.
Consider a random variable $Z$ defined as the sum of first $(N+1)$ variables, that is
$$Z = Y_1 + Y_2 + ... + Y_N + Y_{N+1}$$
A. What is the expectation of $Z$?
I dont understand how to apply the formula for expectation since what I know is $E[Z] = \int^\infty_{-\infty} xf_x(x)dx  $. How do I manipulate the information given to use this formula?
B. What is the variance of $Z$?
$var(Z) = E[Z^2] - E[Z]^2$ What am I not understanding?
 A: Condition on $N$ to have better knowledge on $Y_i$, $i=1,\dots,N$. Nevertheless, you can easily observe that $E[Y_i]=0$ for all $i$ so $E[Z]$ will eventually be zero as well. But you can do it as follows:
\begin{align*}
E[Z] &= E[E[Z|N]]= E[E[Y_1+\dots+Y_n+Y_{n+1}|N=n]]
\end{align*}
On the other hand, each $Y$ is Bernoulli taking values in $\{-1,3\}$. So
$$E[Y_i] = 3\frac{1}{4}-1\frac{3}{4} = 0.$$
Hence
$$E[Y_1+\cdots Y_n+Y_{n+1}|N=n] = 0*(n+1)=0.$$
Hence
$$E[Z]=0.$$
Since $E[Z]=0$ the variance is just $E[Z^2]$ and again using the same reasoning you get
\begin{align*}
E[Z^2] &= E[E[Z^2|N]]= E[E[(Y_1+\dots+Y_n+Y_{n+1})^2|N=n]]
\end{align*}
Now since all $Y_i$ are independent $E[Y_iY_j]=E[Y_i]E[Y_j]=0$ then
$$E[(Y_1+\cdots Y_{n+1})^2|N=n] = E[Y_1^2+\cdots Y_{n+1}^2|N=n]=(n+1)E[Y_i^2]=(n+1)(3^2\frac{1}{4}+(-1)^2\frac{3}{4})=3(n+1).$$
So altogether
$$E[Z] = 3E[N+1] = 3E[N] + 3 = \frac{3}{\alpha}+3$$
where I used that the expected value of a geometric distribution with parameter $\alpha$ is $1/\alpha$.
