Some students have a list of processes to execute sequentially but the running of a process may fail during execution, so the probability that a process $x$ will be executed successfully is $Px$.
Assume that the execution takes one second to be run to compute the answer for each process, if the program crashes, it will take 3 seconds more for the students to re-run it and in this case, the execution should be re-run starting from the first process.
You are given the probability that each process will be executed successfully, What is the number of seconds expected to pass all processes without crushing ?
I couldn't figure out how to determine the expected value to run all the processes successfully. I know it is something like $E(x) = Px \times (1) + (1 - Px) \times (1 + 3 + E(x)) $ and I think it is depending on the previous process to be run successfully but I failed to get the right answer..
Let the expected number of seconds waited be $E(X)$. Then the expected value is given by $$E(X)=Px(1)+(1-Px)(3+E(Y)+E(X))$$ Where $Y$ is the amount of time taken for the process to crash. I assume that this is uniformly distributed between $0$ and $1$, so $E(Y)=0.5$. Solving this then gives $$E(X)=\frac{3.5-2.5Px}{Px}=\frac{7-5Px}{2Px}$$