0

For mathematically minded people, this is probably an easy one. Unfortunately, I am not one of those, and therefore I am too dumb to even know how to do an effective google search or searching already asked questions here. So, I am sorry if this was answered already.

My problem is: I have three variables; A,B,C. I want to know how many combinations of these exist when order does not matter, and I ignore single variables. So in the case of A,B,C there are 4 combinations: A:B, A:C, B:C and A:B:C.

How can I generalize that to n variables? I am looking for a formula where I can input the number of variables and get the number of combinations.

thal
  • 1
  • 1
    Technically, if you're talking about "all" combinations, then you have 8 possibilities. i.e: ${}, {A}, {B}, {C}, {A,B}, {A,C}, {B,C}, {A,B,C}$. In general, for n items, there are $2^n$ total combinations. If you don't want combinations containing $r$ items (like in your example you didn't include 0 items or 1 item) you can subtract those off like so: $$2^n - \sum_{r}\binom{n}{r}$$ Note that $\binom{n}{r}$ is the binomial coefficient – Sam Nov 10 '22 at 23:29
  • 1
    So in your example where u subtracted off combinations with 0 items and 1 item, you'd do $2^3 - \binom{3}{0} - \binom{3}{1} = 8 - 1 - 3 = 4$ – Sam Nov 10 '22 at 23:30
  • 1
    So the formula you're looking for is $$2^n - n - 1$$ – Sam Nov 10 '22 at 23:35
  • Yes. Thank you very much! – thal Nov 11 '22 at 11:17

0 Answers0