Suppose that you have an infinite horizontal row of squares, each square of size $1\times1$ (like a row of squares in a grid of infinite size). The probability of square being white is $p$. Some white rectangles will be next to each other forming a white rectangle. What is the average width of white rectangles?
I mean, I can easily do some simulations assuming that the row has some big number of squares (on the order of millions) and come up with pretty good estimations with respect to $p$. And if all else fails, I'll certainly do that. But is it possibly to calculate the average width of white rectangles analytically?
$\endgroup$ 11 Answer
$\begingroup$Start at the first square of a white rectangle. The expected length of the rectangles is the expected number of squares until a black square turns up. We can think of this as a series of Bernoulli trials with probability of success $1-p$ The expected waiting time until the first success is $$\boxed{{1\over1-p}}$$
$\endgroup$