# Thread: Sum of two independent binomial random variables.

1. ## Sum of two independent binomial random variables.

Hi guys,

Here's a description of the problem:

Suppose we have x apples and y oranges where each apple has a probability pa to rot and each orange has a probability po to rot, then what's the pdf of the total number of fruit z being rotten.

This pdf looks like a product of two binomial distributions on the surface. However, since z = x+y, x >= 0, y >= 0, then it is actually necessary to sum over all combinations of scenarios (i.e. 6 fruit rotten = 3 apples rotten + 3 oranges rotten or 6 fruits rotten = 1 apple rotten + 5 oranges rotten).

By intuition, I worked out the expectation to be x*pa + y *po and it appears to be correct when I manually tested my problem on a spreadsheet. However, I am not quite sure how that expectation can be derived from this messy pdf.

Any suggestions?

Thanks.

2. Originally Posted by ouiouiwewe
Hi guys,

Here's a description of the problem:

Suppose we have x apples and y oranges where each apple has a probability pa to rot and each orange has a probability po to rot, then what's the pdf of the total number of fruit z being rotten.

This pdf looks like a product of two binomial distributions on the surface. However, since z = x+y, x >= 0, y >= 0, then it is actually necessary to sum over all combinations of scenarios (i.e. 6 fruit rotten = 3 apples rotten + 3 oranges rotten or 6 fruits rotten = 1 apple rotten + 5 oranges rotten).

By intuition, I worked out the expectation to be x*pa + y *po and it appears to be correct when I manually tested my problem on a spreadsheet. However, I am not quite sure how that expectation can be derived from this messy pdf.

Any suggestions?

Thanks.
I have corrected the title of your post. In fact, the title now provides a perfect search string for Google ....

3. The sum of two indep binomials is only a binomial if the p's are the same.

4. Sorry, I am a bit confused. How is this a sum of two binomials?

For example, if we want the probability of having 2 rotten fruits, then this probability is:

prob of having 2 rotten apples * prob of having 0 rotten oranges
+
prob of having 1 rotten apple * prob of having 1 rotten orange
+
prob of having 0 rotten apples * prob of having 2 rotten oranges

That doesn't really look like a sum of two binomials or maybe I am misunderstanding something.

5. Originally Posted by ouiouiwewe
Sorry, I am a bit confused. How is this a sum of two binomials?

For example, if we want the probability of having 2 rotten fruits, then this probability is:

prob of having 2 rotten apples * prob of having 0 rotten oranges
+
prob of having 1 rotten apple * prob of having 1 rotten orange
+
prob of having 0 rotten apples * prob of having 2 rotten oranges

That doesn't really look like a sum of two binomials or maybe I am misunderstanding something.
The number of rotten fruit is the sum of the number of rotten apples and the number of rotten oranges.

The number of rotten apples is ~B(x,pa) and of rotten oranges ~B(y,po)

CB

6. I am confused...

The pdf of my rotten fruit distribution is the product of the pdf of the apple binomial pdf and the orange binomial pdf.

If it is instead a sum of the two pdfs, then wouldn't my rotten fruit distribution not be a well-formed distribution? For example, if there are one apple and one orange with their respective probability of rotting being both 1. Then the probability of having two rotten fruits would be 2 because we are summing their pdfs...

Sorry for sounding like an idiot, I am not very good with stats!

7. Originally Posted by ouiouiwewe
I am confused...

The pdf of my rotten fruit distribution is the product of the pdf of the apple binomial pdf and the orange binomial pdf.

If it is instead a sum of the two pdfs, then wouldn't my rotten fruit distribution not be a well-formed distribution? For example, if there are one apple and one orange with their respective probability of rotting being both 1. Then the probability of having two rotten fruits would be 2 because we are summing their pdfs...

Sorry for sounding like an idiot, I am not very good with stats!

No one said the pmf was the sum of two binomial pmf, but the RV was the sum of two binomial RVs

CB

8. I see.

So I can express my distribution in this form:
Fruit(x,y,pa,po) = Apple(x,pa) + Orange(y,po)

then E_Fruit(x+y) = E_Apple(x) + E_Orange(y)

and V_Fruit(x+y) = V_Apple(x) + V_Orange(y)

9. Originally Posted by ouiouiwewe
I see.

So I can express my distribution in this form:
Fruit(x,y,pa,po) = Apple(x,pa) + Orange(y,po)
No, because that is saying their pmf sum, when in fact they don't, but because they are independednt you can say:

Fruit(x,y,pa,po) = Apple(x,pa) Orange(y,po)

then E_Fruit(x+y) = E_Apple(x) + E_Orange(y)

and V_Fruit(x+y) = V_Apple(x) + V_Orange(y)
These are true.

CB

10. Thanks for the reply.

Hmm... so I suppose if Z is a distribution that is the sum of distributions X and Y, it is then expressed as Z = X*Y?

11. Originally Posted by ouiouiwewe
Thanks for the reply.

Hmm... so I suppose if Z is a distribution that is the sum of distributions X and Y, it is then expressed as Z = X*Y?
The density or mass function of a RV which is the sum of two RV is the convolution of the densities/mass functions of those two random variables. The joint distribution of the two RV's (if independent) is the product of their densities/mass functions.

CB