We have a coin, which has probability of heads, P(heads) = p, and probability of tails P(tails) = 1 − p = q. We flip a coin until we get the first head, or until we get three times tails. Write the probability function and the cumulative function of the number of tosses.
First I thought of doing it like this:
case 1 Until we have the first face.
$P(heads) = q^{k-1} \cdot p$ where k is the number of launches.
case 2 Until we have 3 crowns in a row.
$P(tails) = p^{k-1} \cdot p \cdot p \cdot p$
P = P(heads) + P(tails)
Or should I do it using Bernoulli?
The problem is that I don't have i $p(i) = \binom{k}{i}p^î(1-p)^{k-1} = \binom{k}{i}p^î(q )^{k-1}$
And to calculate the cumulative function don't I need an i too?
Thanks for any help.
The only possible outcomes are $\{H, TH, TTH, TTT\}.$ Let $X$ be the number of tosses, so $X\in\{1,2,3\}.$ Assuming the tosses are independent, the probability function for $X$ is then given by
$$\begin{align} P(X=1)&=P(H)=p,\\ P(X=2)&=P(TH)=qp,\\ P(X=3)&=P(TTH\text{ or }TTT)=qqp+qqq=q^2(p+q)=q^2\\ \end{align}$$ and the CDF is $$\begin{align} P(X\le x)=\begin{cases} 0,&-\infty<x<1.\\ p,&1\le x< 2\\ p+qp,&2\le x< 3\\ p+qp+q^2=1,&3\le x< \infty\\\end{cases} \end{align}$$