# Analytical solution to marble toss experiment

I am interested in the following problem:

Assume we have an infinitely large, homogeneous grid, where each grid point is connected to 8 neighboring grid points (top/bottom, left/right, diagonal). Now we perform a random experiment (marble toss) where we randomly fill $$\rho$$ percent of the grid's points with $$\rho_A$$ percent of marbles of type A and $$\rho_B$$ percent of marbles of type B. Now, If I pick a random marble from the grid, I would like to know the probability for this marble to have a marble of the opposite type within it's neighborhood (the 8 connected grid points).

I have already performed monte carlo simulations to retrieve probabilities for given $$\rho$$, $$\rho_A$$ and $$\rho_B$$, but I would be interested if there is an analytical solution for such problems.

Also, I would be interested in how you would search for such a problem in literature. I simply called this a marble-toss experiment, because this is the first analogy that came to my mind. However, I am an engineer, not a mathematician, so I do not know the correct terminology for such a problem and thus I have a hard time finding relevant literature.

• Each neighboring node can be either empty, type A, or type B. And you do know the corresponding probabilities. So, for each of the eight neighbors, you have a random trial with three possible outcomes and you want to compute the probability that at least one neighbor has the opposite type. This seems quite standard but I may be. missing something. Feb 21 at 9:27
• I think you are right. I must have been really thick here, for simulating this. Makes me feel kinda stupid now. I'll compute the probabilities as you suggested and compare them to my simulation. Would you post this as an answer so I can mark my question as answered? Feb 21 at 10:02

## 1 Answer

Given a node with a certain type, each neighboring node can be either empty, type A, or type B, and we do know the corresponding probabilities. So, for each of the eight neighbors, we have a random trial with three possible outcomes and we want to compute the probability that at least one neighbor has the opposite type.

We can even approach the problem with Bernoulli trials, since for each neighbor we are only interested in knowing if it has a certain type or not. For instance, if we are looking at the neighbors of a node with type $$A$$ and $$X_i$$ are Bernoulli random variables $$X_i \sim Ber(\rho \rho_b)$$, we want to get $$P(X \ge 1)$$, where $$X = \sum_{i=1}^8 X_i$$ has a binomial distribution,i.e.

$$P(X \ge 1) = 1 - P(X=0) = 1 - (1-\rho \rho_B)^8$$

Similarly, if you start with a node with type $$B$$, you end up with a probability of $$1- (1-\rho \rho_A)^8$$ of having at leas one neighbor with the opposite type.

Unless I'm missing something, this seems quite standard, but it would still be interesting to compare your simulation results with the "exact" probabilities.