Calculating the total number of possible combinations given two variables Say I have a bag with green and blue marbles. Sometimes the number of green/blue marbles is different - is there a formula that calculates how many possible combinations you may pick out in order? I found a permutation formula here: Permutation Formula
So for example, imagine there are 2 greens and 2 blue, then I could get:
GGBB, GBGB, GBBG, BGGB, BGBG and BBGG. Is there a simple way to generalise that? I didn't understand how to use the formula I've linked to.
I'm a non-mathematician so apologies in advance if I've used the wrong terms.
 A: One way to arrange Green and Blue balls is -
$\frac{\text{(Total no. of balls)!}}{\text{(Color repeating)!} \times \text{(Other color repeating)!} \times ...}$
So we have,
$\frac{4!}{2! \times 2!}$
Dividing by two as we have identical green and two blue balls.
= 6 ways
A: The formula you linked to is for the case where you have a bag full of ordered marbles, and are interested in the number of different sequences of a fixed length you can draw (eg $1234$ or $1543$).
Your problem (assuming I understood it correctly) is equivalent to wanting to choose $\#B$ slots out of $\#G+\#B$ for the blue marbles to go into (so if we have $1$ blue and $3$ green marbles, the sequence is determined knowing which of the $4$ positions the blue marble takes, and putting green in all the others; if we have $2$ blue and $2$ green, we need to know which $2$ positions have blue marbles in ect).
The formula for this is the combination formula, $${\#B+\#G \choose \#B} = \frac{(\#B+\#G)!}{\#B!\ \#G!}.$$
Deriving the formula works like this: 
First, we treat every marble as being different (so we might have marbles $B_1, B_2, B_3, G_1, G_2$), and count how many ways we could order them. If there are $n$ marbles, then we have $n$ different choices for the first marble we draw; then we have $n-1$ choices for the next since we've already picked one, and so on. In order to determine how many choices there are total, we multiply the number of choices at each stage. In this case we get $5!=5\times4\times3\times2\times1=120$.
Next, we divide by the number of different ways we could order the blue marbles, calculated as before (since $B_1B_2B_3$ and $B_3B_2B_1$ are the same for our purposes - when we look at the different orderings of blue marbles, it might as well be that the green marbles don't exist, so we ignore them). Similarly we also divide by the number of ways of ordering the green marbles. In this example, we have $3!=6$ ways of ordering blue marbles and $2!=2$ ways of ordering green marbles, giving a grand total of $10$ different ways to order $3$ blue and $2$ green marbles.
If we have more than $2$ colours, we can apply the same principle; first give each marble a different label and calculate the total number of orderings, and then divide by the number of ways of ordering the marbles of each individual colour.
