Coin probability problem I tag these questions as homework, as they are older exam questions and every year

Can you try to solve/explain how to solve with a method some of these?

If something is answered in an old post please post the link.



1. We toss a fair coin until we get either two heads either two tails. If the probability getting head is $p$, find the expected number or tosses

Important update: We assume that we stop after $2$ consecutive rolls that bring the same result(e.g. HTHTHTHTHTHTHTHH,THTHTHTHTT). The given probability is for getting ONE head. 



To community: I'm familiar with many terms of probability theory so with a good analysis I think I might understand your answers.

Reminder:Their diffictulty may seem easy to medium but not everyone is great at this.
\begin{align}
X&amp;:= \# \text{ tosses required} \\
\Pr(X\geq 1) &amp;= 1 \\
(\forall n\geq 1) \hspace{20pt}\Pr(X\geq n+1) &amp;= \Pr(\underbrace{HTHT\cdots HT}_{n \text{ times}}) + \Pr(THTH\cdots TH) \\
&amp;= \begin{cases}
2[p(1-p)]^{n/2}, &amp;n \text{ even}\\
[p(1-p)]^{(n-1)/2}, &amp;n \text{ odd}
\end{cases}\\\\
\implies E[X] &amp;= \sum_{i=1}^\infty \Pr(X\geq i) \\
&amp;= 1 + \sum_{n=1}^\infty \Pr(X\geq 2n) + \sum_{n=1}^\infty \Pr(X\geq 2n+1) \\
&amp;= 1 + \sum_{n=1}^\infty \Pr(X\geq (2n-1)+1) + \sum_{n=1}^\infty \Pr(X\geq (2n)+1) \\
&amp;= 1 + \sum_{n=1}^\infty [p(1-p)]^{n-1} + \sum_{n=1}^\infty 2[p(1-p)]^{n} \\
&amp;= 1 + 1+ \sum_{n=1}^\infty [p(1-p)]^{n} + 2\sum_{n=1}^\infty [p(1-p)]^{n} \\
&amp;= 2+ 3\sum_{n=1}^\infty [p(1-p)]^{n}\\
&amp;= 2+ \frac {3p(1-p)} {1-p(1-p)} \\
&amp;= \frac {3} {1-p(1-p)} -1 \\
\end{align}

I've assumed independence. I might have made an algebraic error somewhere, but a sanity check is to notice that $\displaystyle{ \lim_{p\to 0}E[X] = \lim_{p\to 1}E[X] = 2}$, which is to be expected (mind the pun). Also, the result is symmetrical around $p=1/2$.
$$P(T=2k)=p^{k+1}(1-p)^{k-1}+p^{k-1}(1-p)^{k+1}=\{p(1-p)\}^{k-1}$$
for events $HTHTHT\cdots HTHH~\text{and}~~THTHTH\cdots THTT$
$$P(T=2k+1)=(1-p)^{k}p^{k+1}+(1-p)^{k+1}p^k=\{p(1-p)\}^k$$
for events $THTHTH\cdots THTHH$ and $HTHTHT\cdots HTHTT$

Given the probabilities calculate the expectation of $T$.