Expression for the sum of two iid bernoulli random variables

binomial distributionprobability distributions

The Bernoulli distribution pmf can be written $f(x)=p^x(1-p)^{1-x}$; when x is 0, this evaluates to 1-p, and when x is 1, it is p.

Suppose $X, Y\sim Ber(p)$ and are iid. Can the pmf of their sum $f(x,y)=\left[(1-p)^2\right]^{1\{x+y=0\}}\left[2p(1-p)\right]^{1\{x+y=1\}}\left[p^2\right]^{1\{x_1+x_2=2\}}$ be written with exponents that are functions of x, y (that aren't indicators)? In other words, three separate expressions are needed

$$(1)1 \text{ when x=y=0 and 0 for x or y=1}\\
(2)1 \text{when x=1 or y=1, and 0 for x=y=0 or x=y=1}\\
(3)1 \text {when x=y=1 and 0 for x or y=0}$$

E.g. for (1) you need $g(0,0)=1, g(0,1)=g(1,0)=g(1,1)=0$

Best Answer

First of all, I think you started using $x_1$ and $x_2$ when you were using $x$ and $y$.

Note that the PMF you wrote is expressible in terms of a third variable, say $z = x+y$, that takes on values in $\{0, 1, 2\}$. As such you do not need to handle separate cases for the outcomes of $x$ and $y$, only whether the sum $z$ equals $0$, $1$, or $2$. So your mass function reduces to

$$f(z) = ((1-p)^2)^{\mathbb 1(z = 0)} (2p(1-p))^{\mathbb 1 (z = 1)} (p^2)^{\mathbb 1(z = 2)}.$$ You could certainly leave it this way, but it is worth noticing that there is a nice relationship between the exponents of $p$ in each case, and the value of $z$. Specifically, the exponent of $p$ is equal to the value of $z$, and the exponent of $1-p$ is equal to $2-z$. So we may write this as $$f(z) = (\mathbb 1 (z = 1) + 1) p^z (1-p)^{2-z}.$$ Notice that we had to use a little trick to make sure that the factor of $2$ is correctly accounted for when $z = 1$, but everything else works out neatly.

Is there a better way to write this constant factor? After all, when there are more than $2$ IID Bernoulli random variables, the number of distinct outcomes to handle becomes larger and this approach is not illuminating. You will find that the PMF for the sum of three IID Bernoulli random variables, written your way, looks like this: $$f(z) = \begin{cases}(1-p)^3, & z = 0 \\ 3p(1-p)^2, & z = 1 \\ 3p^2(1-p), & z = 2 \\ p^3, & z = 3. \end{cases}$$ So what we really need instead of $\mathbb 1 (z = 1) + 1$ is the binomial coefficient $$\binom{2}{z} = \frac{2!}{z! (2-z)!} = \begin{cases}1, & z = 0 \\ 2, & z = 1 \\ 1, & z = 2. \end{cases}.$$ This gives us the PMF $$f(z) = \binom{2}{z} p^z (1-p)^{2-z}, \quad z \in \{0, 1, 2\}.$$