# Sum of Probabilities of combinations

• Aug 10th 2012, 11:30 PM
rikari
Sum of Probabilities of combinations
Hi,

I'm thinking if you can help me think of a better way to solve this.
Here's the situation

I have probabilities of the number of bags I can sell in a day

2 - 30 %
3 - 28%
4 - 20%
5 - 16%
6 - 6%

Now, I want to know the probability of selling, for example, 8 bags after 3 days.
What I did so far is this,

I get all the permutations of 3 numbers out of {2, 3, 4, 5, 6}, where the sum is 8, so I have the following with their respective probabilities

2,2,4 = .30*.30*.20 = .018
2,3,3 = .30*.28*.28 = .02352
2,4,2 = .30*.20*.30 = .018
3,2,3 = .28*.30*.28 = .02352
3,3,2 = .28*.28*.30 = .02352
4,2,2 = .20*.30*.30 = .018

thus, the probability of selling 8 bags after 3 days is .018+.02352+.018+.02352+.02352+.018 = .12456

My problem is, I need to get all the possible number of bags sold in 3 days with their probabilities of occurring. Is there a way that I can compute for that easily? The true situation is working with more than 5 possible number of bags in a day.
• Aug 11th 2012, 06:18 AM
awkward
Re: Sum of Probabilities of combinations
Quote:

Originally Posted by rikari
Hi,

I'm thinking if you can help me think of a better way to solve this.
Here's the situation

I have probabilities of the number of bags I can sell in a day

2 - 30 %
3 - 28%
4 - 20%
5 - 16%
6 - 6%

Now, I want to know the probability of selling, for example, 8 bags after 3 days.
What I did so far is this,

I get all the permutations of 3 numbers out of {2, 3, 4, 5, 6}, where the sum is 8, so I have the following with their respective probabilities

2,2,4 = .30*.30*.20 = .018
2,3,3 = .30*.28*.28 = .02352
2,4,2 = .30*.20*.30 = .018
3,2,3 = .28*.30*.28 = .02352
3,3,2 = .28*.28*.30 = .02352
4,2,2 = .20*.30*.30 = .018

thus, the probability of selling 8 bags after 3 days is .018+.02352+.018+.02352+.02352+.018 = .12456

My problem is, I need to get all the possible number of bags sold in 3 days with their probabilities of occurring. Is there a way that I can compute for that easily? The true situation is working with more than 5 possible number of bags in a day.

It depends on your definition of "easy". The easiest way I know of to solve this problem is to use a generating function. In this case, the generating function is

\$\displaystyle f(x) = 0.3 x^2 + 0.28 x^3 + 0.2 x^4 + 0.16 x^5 + 0.06 x^6\$

I think you can see how the function is derived from your data. Then if you want to know the probability of selling exactly 8 bags in 3 days, the steps are
1. Expand \$\displaystyle (f(x))^3\$. This is easy if you have a computer algebra program, or you can just use Wolfram alpha.
2. Extract the coefficient of \$\displaystyle x^8\$ in the result. You will see in this case, that the coefficient is 0.12456, as you said.

If you would like to see the complete result of the expansion, go to Wolfram alpha
Wolfram|Alpha: Computational Knowledge Engine
and enter
expand (0.3 x^2 + 0.28 x^3 + 0.2 x^4 + 0.16 x^5 + 0.06 x^6)^3
• Aug 11th 2012, 06:33 AM
rikari
Re: Sum of Probabilities of combinations
Thanks for the response.
I didn't think of using the generating functions, haven't thought of it yet, but surely a bit easy than what I'm currently doing.
A huge thanks :)