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.
 A: \begin{align}
X&:= \# \text{ tosses required} \\
\Pr(X\geq 1) &= 1 \\
(\forall n\geq 1) \hspace{20pt}\Pr(X\geq n+1) &= \Pr(\underbrace{HTHT\cdots HT}_{n \text{ times}}) + \Pr(THTH\cdots TH) \\
&= \begin{cases}
2[p(1-p)]^{n/2}, &n \text{ even}\\
[p(1-p)]^{(n-1)/2}, &n \text{ odd}
\end{cases}\\\\
\implies E[X] &= \sum_{i=1}^\infty \Pr(X\geq i) \\
&= 1 + \sum_{n=1}^\infty \Pr(X\geq 2n) + \sum_{n=1}^\infty \Pr(X\geq 2n+1) \\
&= 1 + \sum_{n=1}^\infty \Pr(X\geq (2n-1)+1) + \sum_{n=1}^\infty \Pr(X\geq (2n)+1) \\
&= 1 + \sum_{n=1}^\infty [p(1-p)]^{n-1} + \sum_{n=1}^\infty 2[p(1-p)]^{n} \\
&= 1 + 1+ \sum_{n=1}^\infty [p(1-p)]^{n} + 2\sum_{n=1}^\infty [p(1-p)]^{n} \\
&= 2+ 3\sum_{n=1}^\infty [p(1-p)]^{n}\\
&= 2+ \frac {3p(1-p)} {1-p(1-p)} \\
&= \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$.
A: Let $X$ denote the number of tosses needed to get a $HH$ or a $TT$.  Then,
$$\begin{align}
P\{X > 0\} &= 1\\
P\{X > 1\} &= 1\\
P\{X > 2\} &= P\{HT\} + P\{TH\} = 2p(1-p)\\
P\{X > 3\} &= P\{HTH\} + P\{THT\} = p^2(1-p) + (1-p)^2p = p(1-p)\\
P\{X > 4\} &= P\{HTHT\} + P\{THTH\} = 2p^2(1-p)^2\\
\vdots\qquad &= \qquad \vdots\\
P\{X = 2k\} &= P\{HTHT\cdots HT\} + P\{THTH\cdots TH\} = 2p^k(1-p)^k\\
P\{X = 2k+1\} &= P\{HTHT\cdots HTH\} + P\{THTH\cdots THT\}=p^{k+1}(1-p)^k+p^k(1-p)^{k+1}\\
&= p^k(1-p)^k\\
\vdots\qquad &= \qquad \vdots
\end{align}$$
So, since $E[X] = \sum_{k=0}^\infty P\{X > k\}$ we have that
$$\begin{align}
E[X] &= \sum_{k=0}^\infty P\{X > k\}\\
&= \sum_{n=0}^\infty 2[p(1-p)]^n + \sum_{n=1}^\infty [p(1-p)]^{n}\\
&= \frac{2}{1-p(1-p)} + \frac{p(1-p)}{1-p(1-p)}\\
&= \frac{2+p-p^2}{1-p + p^2}
\end{align}$$
A: Look at your possibilities
$$HH,TT,HTH,HTT,THT,THH$$
Let $T$ denote the random variable denoting the number of times the coin has to be tossed to get the desired result.
$$P(T=2)=p^2+(1-p)^2$$
$$P(T=3)=2p^2(1-p)+2(1-p)^2p$$
Then the expected number of tosses is
$$2(p^2+(1-p)^2)+6p(1-p)=2(1+p-p^2)$$
A: $$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$.
