Locked in a dungeon, you are faced with five doors. One of them leads to freedom. The other four will lead you back to the starting room disoriented and confused, so that you will not remember which of the doors you have already tried and have to start again.

How many attempts do you expect to make on the average (statistically) before making it out?

The intuitive answer is 5. More rigorously, though, the expected value is the sum of all possible values, weighted by their probability. The probability of making it out on the nth try is (4/5)^(n-1) * (1/5). The sum of all of these terms is (1/5) * [1 + 2x(4/5) + 3x(4/5)^2 + 4x(4/5)^3....]. Call this value E. Note that

Ex(4/5) = (1/5) * [(4/5) + 2x(4/5)^2 + 3x(4/5)^2...].

If you subtract Ex(4/5) from E and match up (4/5)^n terms, you get

Ex(1/5) = (1/5) * [1 + (4/5) + (4/5)^2 + (4/5)^3...]

which simplifies to

E = 1 + (4/5) + (4/5)^2 + (4/5)^3...

Multiply both sides by 4/5, and you get

(4/5)xE = (4/5) + (4/5)^2 + (4/5)^3...

Subtract these two equations from one other (again, matching up the (4/5)^n terms), and you get

(1/5)xE = 1, or E = 5.