Probability question - time to escape prison A criminal was arrested and he has to pass $10$ lie detector tests successfully to get out of the jail.
$0, \frac12, \frac23, \frac34, \frac45, \frac56, \frac67, \frac78, \frac89, \frac9{10}$ are the respective probabilities of the lie detectors to detect whether the person is telling a lie or not.
If a lie detector says that the criminal is telling a lie then he has to test again from the first detector. The criminal can’t speak the truth so he’ll always lie and one lie detector test takes 1 second.
The criminal is sent out from the jail if he passes all tests in continuously (in other words, if he passes the last detector). Find the expected time in seconds that the criminal will get out of the jail.
How do I approach this type of problem? I'm totally clueless about how to solve it.
Additional Details: I encountered this question in a CTF (Capture the Flag) event which I participated in, a few days ago under the logic section.
 A: Let $X$ be the number of lie detector tests the criminal has to take before getting out of jail. If the criminal passes all $10$ lie detector tests on the first try, which happens with probability $\frac{1}{10!}$, he escapes and $X = 10$; otherwise, with probability $\frac{k-1}{k!}$, the criminal passes the first $(k-1)$ lie detector tests and then fails lie detector test $k$, for some $2 \leq k \leq 10$, and the process starts over fresh. Therefore we have $$\Bbb{E}[X] = \frac{1}{10!}*10 + \sum_{k=2}^{10} \frac{k-1}{k!} (\Bbb{E}[X]+k),$$
and solving this linear equation in $\Bbb{E}[X]$, we find
\begin{align*}
\left( 1 - \sum_{k=2}^{10} \left(\frac{1}{(k-1)!} - \frac{1}{k!} \right) \right) \Bbb{E}[X] &= \frac{1}{9!} + \sum_{k=2}^{10} \frac{k-1}{k!}*k \\
\left( 1 - \frac{1}{1!} + \frac{1}{10!} \right) \Bbb{E}[X] &= \frac{1}{9!} + \sum_{k=2}^{10} \frac{k-1}{k!}*k = \frac{1}{9!} + \sum_{k=2}^{10} \frac{1}{(k-2)!} \\
\frac{1}{10!}\Bbb{E}[X] &= \frac{1}{0!} + \frac{1}{1!} + ... + \frac{1}{8!} + \frac{1}{9!} \\
 \Bbb{E}[X] &= \sum_{k=0}^9 (_{10} P_{10-k}) \\
 \Bbb{E}[X] &= 9,864,100 \
\end{align*}
as the criminal's expected number of lie-detector tests.
A: When the criminal starts a "run" through the 10 lie detectors, there are 2 possible outcomes: Either he fools all 10 of them and gets free, which takes 10 seconds, or he is detected at telling a lie, and the whole procedure starts again from the beginning with the next "run".
This recursive procedure makes it possible to consider the whole problem as a series of "runs", that all have identical starting/ending conditions, so each run has the same rules and needs to be analyzed only once.
Then the problem simplifies to the following: A criminal is doing runs to try to get out of jail. Each run has probability $p_{success}$ to succeed, and will need an expected time $t_{success}$ to do so. So the run has probability $1-p_{success}$ to fail, and will need an expected time $t_{fail}$ to do so. How long will be the expected cumulative time until the first run succeeds?
Now each run is a Bernoulli Trial, and the number of trials needed to reach the first success is a random variable distributed according to the the geometric distribution. Most importantly, the number of expected trials until the first success is simply $\frac1{p_{success}}$.
If we know the number $r$ of runs taken until "freedom", we also know the corresponding expected time: All but the last run failed, and the last one succeeded, resulting in an exptected time of $E_t(r)=(r-1)t_{fail}+t_{success}=rt_{fail}+(t_{success}-t_{fail})$.
Since $r$ itself is geometrically distributed (see above), the expected value of time over all possible values of $r$ is
$$
\begin{eqnarray}
\mathbb E(E_t(r))  & = &\mathbb E(r) t_{fail}+(t_{success}-t_{fail}) = \frac1{p_{success}} t_{fail}+(t_{success}-t_{fail})\\
& = & \frac{1-p_{success}}{p_{success}}t_{fail}+t_{success}. \tag1 \label{exp}
\end{eqnarray}
$$

Now "all" we need to do is determine those values $p_{success}, t_{success}$ and $t_{fail}$.
The first two of them are very simple. In order to succeed, the criminal must fool all $10$ lie detectors, which has probability
$$p_{success}=\frac11\frac12\frac13\ldots\frac1{10}=\frac1{10!}, \tag2 \label{psucc}$$
and it will take him $10$s to do so:
$$t_{success} = 10. \tag3 \label{tsucc}$$
To calculate expected failure time, we need to find out the probabilities that he fails after exactly $k$ lie detector tests ($k=1,2,\ldots,10)$.
For that to happen, he must have won the first $k-1$ tests, while the $k$-th test was a failure (for him), the probability for that is
$$p_{fail}(k)=\frac11\frac12\ldots\frac1{k-1}\frac{k-1}k=\frac{k-1}{k!}$$
So the expected time for failure is
$$t = \sum_{k=1}^{10} k\frac{k-1}{k!} = \sum_{k=1}^{10} \frac{k-1}{(k-1)!} = \sum_{k=2}^{10} \frac1{(k-2)!} = \sum_{k=0}^{8} \frac1{k!}.$$
Now this is the expected time for failure under no conditions. What we need is the expected time for failure under the condition that we know that we'll fail (just like $t_{success}=10$ holds only under the condition that we know we'll succeed.)
So we get
$$t_{failure}=\frac t{1-p_{success}} = \frac{1}{1-p_{success}}\sum_{k=0}^{8} \frac1{k!}. \tag4 \label{tfail}$$

Now we have all the data we need, we can see that the $1-p_{success}$ term in \eqref{tfail} cancels with the same term in \eqref{exp} and we get
$$\mathbb E(E_t(r)) =10!\sum_{k=0}^{8} \frac1{k!} + 10 = 9864100,$$
so this needs a few hours more than 114 days. A tiring procedure for everyone involved.
