Bernoulli trial: probability of even times of sum of $7$. 
We throw a pair of dice unlimited number of times. For any $n\in \Bbb N$,
  let $$E_n=\text{"at the first n trials, the number of time we get sum of $7$ is even"}$$
  Also let $P_n=P(E_n)$. We need to calculate $P_n$ (in terms of $n$).



*

*So I have used a recurrence relation (for $n>1$): $$P_n=\frac56 P_{n-1}+\frac16(1-P_{n-1})$$ and got $P_n=1/2\cdot(2/3)^n+1/2$, for $P_1=30/36=5/6$.

*Now, I need to to calculate $P_n$ in Bernoulli trial.


Here's a solution with generating functions. Let $p(x)=5/6+x/6$ be the generating function for the number of sevens when you throw the dice once. If you throw the dice $n$ times, the generating function is $p(x)^n.$ To extract the even powers only, you consider ${p(x)^n+p(-x)^n\over 2}$, and to get the required probability you set $x=1$. The answer is therefore $$P_n= {p(1)^n+p(-1)^n\over 2}={1\over 2}\left( 1+\left({2\over 3}\right)^n\right).$$ 
