# Characteristic function of sum of random number of first success distributed random variables

The random variables $$X_1,...,X_n,...,$$ are i.i.d. and have the p.m.f. $$p_X(-1)=\frac{1}{4}$$, $$p_X(0)=\frac{1}{2}$$, and $$p_X(1)=\frac{1}{4}$$.

We define the random variable $$N$$ by $$N=\mathrm{min}(n|X_n=0)$$.

I have successfully proven that $$N\in \mathrm{Fs}(1/2)$$.

Now I want to show that the characteristic function of $$S_N=\sum_{k=1}^{N}X_k$$ is $$\phi_{S_N}(t)=\frac{1}{2-\mathrm{cos}(t)}$$.

My first thought was to use $$\phi_{S_N}(t)=g_N(\phi_{X}(t))$$, but this composition formula requires that $$N$$ is independent of $$X_k\forall k\geq 1$$.

But since $$N$$ is dependent on the $$X$$'s I don't know how to proceed. Any recommendations?

We have \begin{align*} \mathbb{E}\exp(it S_N) & = \sum_{n=1}^{\infty} \mathbb{E}(1_{\{N=n\}} \exp(itS_n)) \\ &= \sum_{n=1}^{\infty} \mathbb{E} \left(e^{it X_n} 1_{\{X_n=0\}} \prod_{k=1}^{n-1} 1_{\{X_k \neq 0\}} \exp(itX_k)\right). \end{align*}
$$\mathbb{E}\exp(it S_N) =\sum_{n=1}^{\infty} \underbrace{\mathbb{P}(X_n=0)}_{1/2} \prod_{k=1}^{n-1} \underbrace{\mathbb{E}(\exp(it X_k) 1_{\{X_k \neq 0\}})}_{=\frac{1}{2} \cos(t)} = \frac{1}{2} \sum_{n=1}^{\infty} \left( \frac{\cos(t)}{2} \right)^{n-1}.$$