It has been a long time since I've done probability so I am not sure which to do (if either are correct). Thank you for taking the time to look at my work.
Probability an event occurs is $70$%.
I'm looking for the probability our event occurs three times in a row for sample size $n$.
$(.7)^3=.343$ is the probability to occur three consecutive times
$1-.343=.657$ would be the chance to fail.
First idea:
For $n=3$ our success rate is $.343$
$n=4$ we have two opportunities for success, thus $1-(.657)^2=.568351$
$n=5$, three opportunities for success, thus $1-(.657)^3=.71640$…
Generalization: Probability for success: $$1 – (.657)^{n-2}$$
Second idea:
Probability when $n=3$ would be $(.7)^3$
At $n=4$ we'd have $(.7)^3+(.3)(.7)^3$
For $n=5$ we'd have $(.7)^3+(.3)(.7)^3+(.3)^2(.7)^3+(.3)(.7)^4$
I'm leaning towards the second idea…but I'm failing to see a generalization for it.
Please excuse my LaTeX it has been a long time since I've asked/answered any questions. Thank you.
Best Answer
We are looking for the words of length $n$ and their probability of occurrence which do not contain three or more consecutive $a$'s. The result is $1$ minus this probability.
The regular expression (1) generates all invalid words in a unique manner. In such cases we can use it to derive a generating function $$\sum_{n=0}^\infty a_n z^n$$ with $a_n$ giving the number of invalid words of length $n$.
In order to do so all we need to know is the geometric series expansion since the $star$ operator \begin{align*} a^*=\left(\varepsilon|a|a^2|a^3|\cdots\right)\qquad\text{ translates to }\qquad 1+z+z^2+z^3+\cdots=\frac{1}{1-z} \end{align*}
Accordingly $a^+=aa^*$ translates to $\frac{z}{1-z}$ and alternatives like $(\varepsilon|a|aa)$ can be written as $1+z+z^2$.
$$ $$
$$ $$
We denote with $[z^n]$ the coefficient of $z^n$ in a series.