# Expectation/probability question (a bit like Craps, I think)

I'll try to be as brief as possible:

I have a number of events that can happen, say e1, e2...eN. N isn't particularly large. Each event has a probability of "failure". (Actually, there will likely be an overall rate, that will be converted to a weighted probability based on some properties of the e1, e2, etc, but that's probably not that important).

Upon a "failure", you have to start from the beginning, and incur a cost, c1, c2, cN, for failing on e1, e2, eN etc.

The entire process has a fixed cost for completion, C.

So, let's say you fail on the second event, your cost could be c2 + C.

If you failed on the third event, and then on the first, your cost would be c3 + c1 + C.

And so on...

My questions is this: What would be the closed form solution for the expectation on the cost of this system, for a large number of trials?

[I mentioned Craps because you can sort of think of the events as die rolls, with failures being crapping out, etc. Perhaps it's similar to asking what the expected number of rolls before a failure would be. Maybe it's not that similar, but it's the closest analogue I could think of.)

Thanks so much!

-

We can temporarily forget about $C$, since only one copy is tacked on at the end. We will assume something that may be quite unrealistic, that the various types of failures are independent. The possible unreasonableness of this assumption may make the result below useless.
Let $p_1,\dots,p_N$ be the probabilities of various kinds of failure. We need to assume that $\sum p_i\lt 1$.
If $E$ is the expected cost, then $$E=p_1(c_1+E)+p_2(c_2+E)+\cdots+p_N(c_N+E).$$ Solve this linear equation for $E$.
Let's try that again: Huh. Thanks for the response. Luckily, the probabilities (p_i) are so small, they probably don't sum anywhere near to one, but I don't know that they're independent. Putting that aside, it's quite possible my algebra is off but that seems...off? If we assume a simple toy example of 1/2 for p1, 4 for c1, and 1/4 for p2 and 8 for c2, we get: E = 1/2(4+E) + 1/4(8+E) -> 2 + E/2 + 2 + E/4 -> E = 4 + 3/4 E -> 1/4 E = 4 -> E = 16 From some back of the envelope tests, that seems too high. I feel like there's part of the puzzle I'm missing here. Any other thoughts? – user770901 Dec 26 '12 at 20:53