# Is a random variable Bernoulli? Is a proof available?

Suppose a die is tossed twelve times and each outcome is represented by a random variable $X_{i}$. Further define $Y_{i}$ for $i=2,...,12$ to take the value $1$ if $X_i=X_{i-1}$ and $0$ otherwise. Intuitively it seems to me that $Y_{i}\sim \text{Bernoulli}(1/6)$ but I'm not sure how you would prove such a thing.

After determining $Y_i$ I need to describe $N=\sum_{i=2}^{12}Y_i$ but if $Y_i\sim \text{Bernoulli}(1/6)$ then I know $N\sim \text{Binomial}(11,1/6)$.

• Is this school work? If so, please add the "self-study" tag. Mar 23 '15 at 0:51
• What is your definition of a Bernoulli variable? Any proof ultimately will have to rely on some definition ... . Be careful with that last line: $N$ will be binomial provided the $Y_i$ are independent. Are you sure they are?
– whuber
Mar 23 '15 at 0:57
• @whuber I take a Bernoulli to be a r.v. such that $P(X=1)=p$ and $P(X=0)=1-p$. As for independence, I guess I'm not clear about that. Intuitively I would think it is, since I wouldn't think $Y_i=1$ would change the probability that $Y_j=1$--you're still just looking for the probability that the next r.v. is equal to the last. I wouldn't think the random variable before that one would matter. Mar 23 '15 at 1:02
• Those are exactly the kinds of things you should be reasoning about, Addem. If you were ultra-careful you would also consider the possibility that $\Pr(Y_i=1)$ varies with $i$, but that's equally easy to resolve. What, then, would constitute a "proof" for you? What do you think you might have left out of your reasoning?
– whuber
Mar 23 '15 at 1:07
• You have 6 variables $X_1$, ..., $X_6$ in your question, but then you also use $X_7$, ..., $X_{12}$ in your definition of the $Y_i$, $i=2,\ldots,12$. That does not compute. Mar 23 '15 at 1:34

A formal mathematical proof might be impossible because we are discussing a model for tosses of a die. However, conditional upon the applicability of the model we certainly can prove things about derived quantities like $$Y_i$$.

The only reason to do this is to help learn the definitions (of probability spaces, random variables, distributions, Bernoulli variables, and independence). As you will see, everything in this setting becomes utterly trivial--because the definitions have been honed over time to make it so. What makes it of some value to study is that the same considerations apply in much more complicated settings. Having seen how the definitions work, and how they capture our intuition about elementary things like dice, it becomes possible to understand the more sophisticated and abstract mathematical arguments that are sometimes made.

Let us consider tosses of a die.

### The sample space$$\Omega$$

The set of possible outcomes of one toss is the set $$F$$ of faces of the die. For $$n$$ such tosses, such as the $$n=12$$ of the question, the set of outcomes therefore is the Cartesian product

$$\Omega = F^n = F\times F\times \cdots \times F = \{(f_1,f_2,\ldots,f_n)\,|\, f_i\in F\}.$$

I will use the generic symbol $$\omega = (f_1,f_2, \ldots, f_n)$$ for a sequence of $$n$$ tosses of the die. The sample space consists of all possible sequences of outcomes.

### The (sigma) algebra of measurable events

Next, we need to describe the kinds of events--subsets of $$\Omega$$--we wish to model probabilistically. In this case, as well as with most situations where $$\Omega$$ is finite, we will allow any subset of $$\Omega$$ to have a probability: these are the measurable sets,

$$\mathcal{P}(\Omega)= \{E\,|\,E\subset \Omega\}.$$

(It is not actually necessary in this particular problem to allow all subsets of $$\Omega$$ to be measurable. A careful reading of the rest of this post will show that only certain kinds of (relatively large) subsets need to have well-defined probabilities.)

### The probability measure $$p$$

To complete the mathematical model we need to provide a probability measure for $$(\Omega, \mathcal{P})$$. Since the atoms $$\{\omega\},\omega\in\Omega$$ are measurable and any subset $$E\subset\Omega$$ is the disjoint union of atoms,

$$E = \cup_{\omega\in E}\{\omega\},$$

it suffices to give the probabilities of these atoms, $$p(\{\omega\})$$. At this juncture the simplest examples are obtained by stipulating that the tosses of the die are independent. Independence is not necessary for carrying out the following demonstrations--it merely makes the calculations extremely easy, because all atoms will have the same probabilities rather than varying probabilities.

(Although we can test any dataset for lack of independence, and although we can justify the independence on physical grounds, it will be impossible to prove these assumptions. The interesting part of the exercise concerns how much can be derived from them.)

The axioms of probability easily imply that $$p(\{\omega\})\ge 0$$ and $$\sum_{\omega\in\Omega}p(\{\omega\})=1$$. By assuming a "fair" die, the independence assumption implies that all probabilities are identical. (If you like, you can sidestep both considerations of fairness and independence and simply assume all atomic probabilities are equal: it's all the same thing in the end. In any practical application this assumption can be tested.) Thus,

$$p(\{\omega\}) = p(\{(f_1,f_2,\ldots,f_n)\}) = |F|^{-n}$$

where $$|F|$$ is the number of faces of the die (six in the question).

### The random variables $$Y_i$$

In this model with a probability space $$(\Omega, \mathcal{P}(\Omega), p)$$, the functions $$Y_i$$ ($$i=2,3,\ldots,n$$) can be defined as

$$Y_i(\omega) = Y_i((f_1,f_2,\ldots,f_n)) = I(f_i = f_{i-1})$$

by means of the indicator function $$I(\text{true})=1$$, $$I(\text{false})=0$$.

If we want to ascribe a probability distribution to $$Y_i$$, we first have to prove it is measurable. This means that for all Borel subsets $$B\subset\mathbb{R}$$,

$$Y_i^{-1}(B) \subset \mathcal{P}(\Omega).$$

This is trivially true because $$\mathcal{P}(\Omega)$$ contains every subset of $$\Omega$$ and $$Y_i^{-1}(B)$$ issome subset of $$\Omega$$. Consequently, each $$Y_i$$ is a measurable function $$Y_i:\Omega\to\mathbb{R}$$ whose only possible values are in $$\{0,1\}$$. That is the full definition of a Bernoulli variable.

### The distributions of the $$Y_i$$

We can now address the question of which Bernoulli distribution $$Y_i$$ has. It is determined by $$p(Y_i = 1)$$, since it establishes the other probability $$p(Y_i=0) = 1 - p(Y_i=1)$$. The event $$Y_i=1$$ consists of all sequences of tosses of the form

$$E_i = \{(f_1,f_2,\ldots,f_{i-1}, f_i, \ldots, f_n)\,|\, f_i=f_{i-1}\}.$$

We therefore compute

$$p(E_i) = \sum_{\omega\in E_i} p(\{\omega\}) = |D|^{-n}\sum_{\omega\in E_i} = \frac{|E_i|}{|F|^n} = \frac{|F|^{n-1}}{|F|} = \frac{1}{|F|}.$$

(The calculation for independent tosses of an unfair die, with chances $$q_f$$ for each face $$f\in F$$, would be carried out the same way, but its result would be the more general formula $$p(E_i)=\sum_{f\in F} q_f^2$$.)

### Independence of $$Y_i$$ and $$Y_j$$

The independence of $$Y_i$$ and $$Y_j$$ for $$i\ne j$$ can be formally resolved by means of similar calculations. The most general definition is in terms of the sub-algebras of $$\mathcal{P}(\Omega)$$ generated by $$Y_i$$ and $$Y_j$$. The sub-algebra generated by $$Y_i$$ contains only two sets in addition to $$\emptyset$$ and $$\Omega$$ itself:

$$B_i(1)=Y_i^{-1}(\{1\}) = \{(f_1,\ldots,f_{i-2},f,f,f_{i+1},\ldots,f_n)\}$$

and

$$B_i(0)=Y_i^{-1}(\{0\}) = \{(f_1,\ldots,f_{i-2},f,g,f_{i+1},\ldots,f_n)\,|\,f \ne g\}.$$

Independence means $$p(B_i(x)\cap B_j(y)) = p(B_i(x))p(B_j(y))$$ for all $$x,y\in\{0,1\}$$. When $$x=y=1$$, $$B_i(x)\cap B_j(y)$$ is the set of all sequences in which the values at tosses $$i-1$$ and $$i$$ agree and they agree at tosses $$j-1$$ and $$j$$. Provided $$i\ne j$$, an easy counting argument shows there are $$|F|^{n-2}$$ elements in this event, making its probability $$p(B_i(x)\cap B_j(y)) = |F|^{-2} = |F|^{-1}|F|^{-1} = p(B_i(1))p(B_j(1)).$$ A similar calculation applies to the other three possible combinations of $$x$$ and $$y$$, confirming independence.

The variables $Y_i$ are without doubt Bernoulli variables because they can only have two values, in this case 0 and 1. Also, your intuition that $\mathrm{Prob}[Y_i=1]=\mathrm{E}[Y_i]=1/6$ is absolutely correct.

My first idea was that the $Y_i$, even though they have the same distribution, are not independent because they rely on what number was thrown in the previous toss. But the probability of throwing the same number in the next toss does not depend on that number. So the $Y_i$ are also independent and their sum is indeed binomial$(11,1/6)$. The story would be entirely different if you had an unfair die. Then $N$ would not be binomial.