# It has been too long since I've taken math. How do I calculate this?

**URL:** <https://boards.straightdope.com/t/it-has-been-too-long-since-ive-taken-math-how-do-i-calculate-this/233164>\
**Category:** Factual Questions\
**Created:** [March 8, 2004, 7:05pm UTC](https://boards.straightdope.com/t/it-has-been-too-long-since-ive-taken-math-how-do-i-calculate-this/233164 "2004-03-08T19:05:06Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kamino\_Neko](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/kamino_neko/32/34_2.png) [@Kamino\_Neko](https://boards.straightdope.com/u/Kamino_Neko)\
**Post date:** [March 8, 2004, 7:05pm UTC](https://boards.straightdope.com/t/it-has-been-too-long-since-ive-taken-math-how-do-i-calculate-this/233164/1 "2004-03-08T19:05:06Z")

</div>

OK. Background.

I’m trying to make a computer RPG. I wish to allow party switching. I figured out a way to do it, but I’m not sure if it’d be worth the effort. To figure this out I decided to calculate the number of possible parties. After doing it, I realised - I’d forgotten how to do that. The only way I could remember [n\*(n-1)\*(n-2)] gave a total that counted ABC and CBA (etc) as separate groups.

But, for my purposes, they’re identical.

Could somebody remind me of the formula to calculate that, which I’ve forgotten in the 7 years since I last took math?

---

<div class="post-metadata">

**Author:** ![daniel801](https://avatars.discourse-cdn.com/v4/letter/d/b2d939/32.png) [@daniel801](https://boards.straightdope.com/u/daniel801)\
**Post date:** [March 8, 2004, 7:14pm UTC](https://boards.straightdope.com/t/it-has-been-too-long-since-ive-taken-math-how-do-i-calculate-this/233164/2 "2004-03-08T19:14:13Z")

</div>

n!  
C(n,m) = -----------  
m! (n - m)!

---

<div class="post-metadata">

**Author:** ![Shade](https://avatars.discourse-cdn.com/v4/letter/s/2bfe46/32.png) [@Shade](https://boards.straightdope.com/u/Shade)\
**Post date:** [March 8, 2004, 7:17pm UTC](https://boards.straightdope.com/t/it-has-been-too-long-since-ive-taken-math-how-do-i-calculate-this/233164/3 "2004-03-08T19:17:30Z")

</div>

I don’t quite understand the background, but I think you’re asking “How many ways can I choose a group of 3 out of 10 (order doesn’t matter.)” Check out [http://mathworld.wolfram.com/BinomialCoefficient.html](http://mathworld.wolfram.com/BinomialCoefficient.html) which describes exactly this. Hopefully whatever you’re programming in will include a binomial function, if you need it.

---

<div class="post-metadata">

**Author:** ![Kamino\_Neko](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/kamino_neko/32/34_2.png) [@Kamino\_Neko](https://boards.straightdope.com/u/Kamino_Neko)\
**Post date:** [March 8, 2004, 7:33pm UTC](https://boards.straightdope.com/t/it-has-been-too-long-since-ive-taken-math-how-do-i-calculate-this/233164/4 "2004-03-08T19:33:54Z")

</div>

I’m afraid that’s not helping me any.

Talk to me like I’m an idiot - or at least doing this for the first time. It’s all gone.

My problem is thus:

I have 22 items (characters, in this case). At a given time you can choose 3.

I want to know how many unique groupings of those items I can make, assuming ABC and CBA are identical for all current intents and purposes.

---

<div class="post-metadata">

**Author:** ![Capt.Ridley\_s\_Shooting\_Party](https://avatars.discourse-cdn.com/v4/letter/c/cc9497/32.png) [@Capt.Ridley\_s\_Shooting\_Party](https://boards.straightdope.com/u/Capt.Ridley_s_Shooting_Party)\
**Post date:** [March 8, 2004, 7:43pm UTC](https://boards.straightdope.com/t/it-has-been-too-long-since-ive-taken-math-how-do-i-calculate-this/233164/5 "2004-03-08T19:43:24Z")

</div>

nCm = n! / m!(n-m)!

n! = 1x2x3x…xn

n in your case is 22  
m is 3

A scientific calculator should have an nCr button on it to make sure your results are right.

---

<div class="post-metadata">

**Author:** ![Sergio](https://avatars.discourse-cdn.com/v4/letter/s/b77776/32.png) [@Sergio](https://boards.straightdope.com/u/Sergio)\
**Post date:** [March 8, 2004, 7:43pm UTC](https://boards.straightdope.com/t/it-has-been-too-long-since-ive-taken-math-how-do-i-calculate-this/233164/6 "2004-03-08T19:43:43Z")

</div>

> [@Tengu](#):
>
> I’m afraid that’s not helping me any.
> 
> Talk to me like I’m an idiot - or at least doing this for the first time. It’s all gone.
> 
> My problem is thus:
> 
> I have 22 items (characters, in this case). At a given time you can choose 3.
> 
> I want to know how many unique groupings of those items I can make, assuming ABC and CBA are identical for all current intents and purposes.

You will have 22x21x20/(1x2x3) = 1540 different combinations.

---

<div class="post-metadata">

**Author:** ![pulykamell](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/pulykamell/32/3166_2.png) [@pulykamell](https://boards.straightdope.com/u/pulykamell)\
**Post date:** [March 8, 2004, 7:46pm UTC](https://boards.straightdope.com/t/it-has-been-too-long-since-ive-taken-math-how-do-i-calculate-this/233164/7 "2004-03-08T19:46:43Z")

</div>

Im getting 1540 possible combinations using a method I deduced myself. Can anyone confirm or deny?

What I’m doing isn’t efficient, but it works.

Let’s call each attribute one through twenty two.

1-2-x has 20 combinations  
1-3-x has 19 combinations (as 2 has been used up)  
1-4-x has 18

etc.

2-3-x has 19 combinations  
2-4-x has 18 combinations  
2-5-x has 17

3-4-x has 18 combos…  
and so on and so forth.

Add 'em all up, and you get 1540. I can work out a formula (which probably is what’s linked to), but this is faster for me for the moment.

---

<div class="post-metadata">

**Author:** ![Bambi\_Hassenpfeffer](https://avatars.discourse-cdn.com/v4/letter/b/bbe5ce/32.png) [@Bambi\_Hassenpfeffer](https://boards.straightdope.com/u/Bambi_Hassenpfeffer)\
**Post date:** [March 8, 2004, 7:48pm UTC](https://boards.straightdope.com/t/it-has-been-too-long-since-ive-taken-math-how-do-i-calculate-this/233164/8 "2004-03-08T19:48:53Z")

</div>

> [@Tengu](#):
>
> I have 22 items (characters, in this case). At a given time you can choose 3.

The number of combinations is given by 22! / ( 3! \* ( 22 - 3 )! ). ! is an operator called the factorial. I can’t think of how to word it, so I’ll show you:  
1! = 1  
2! = 2 \* 1  
3! = 3 \* 2 \* 1  
4! = 4 \* 3 \* 2 \* 1  
n! = n \* (n-1) \* (n-2) \* … \* 1

The formula is this:  
The number of combinations (where order is irrelevant) of _r_ elements selected from a set of _n_ units is given thus: [sub]n[/sub]C[sub]r[/sub] = n! ÷ ( r! \* ( n - r )! )

The number of permutations (where order is relevant) of _r_ elements selected from a set of _n_ units is given thus: [sub]n[/sub]P[sub]r[/sub] = n! ÷ ( n - r )!

---

<div class="post-metadata">

**Author:** ![pulykamell](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/pulykamell/32/3166_2.png) [@pulykamell](https://boards.straightdope.com/u/pulykamell)\
**Post date:** [March 8, 2004, 7:49pm UTC](https://boards.straightdope.com/t/it-has-been-too-long-since-ive-taken-math-how-do-i-calculate-this/233164/9 "2004-03-08T19:49:41Z")

</div>

Well, seems that Sergio beat me to the formula. But it was right. Cool.

---

<div class="post-metadata">

**Author:** ![Bambi\_Hassenpfeffer](https://avatars.discourse-cdn.com/v4/letter/b/bbe5ce/32.png) [@Bambi\_Hassenpfeffer](https://boards.straightdope.com/u/Bambi_Hassenpfeffer)\
**Post date:** [March 8, 2004, 7:53pm UTC](https://boards.straightdope.com/t/it-has-been-too-long-since-ive-taken-math-how-do-i-calculate-this/233164/10 "2004-03-08T19:53:51Z")

</div>

**+MDI** has the right formula; **Sérgio** and **pulykamell** have the right answer.

---

<div class="post-metadata">

**Author:** ![Kamino\_Neko](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/kamino_neko/32/34_2.png) [@Kamino\_Neko](https://boards.straightdope.com/u/Kamino_Neko)\
**Post date:** [March 8, 2004, 8:03pm UTC](https://boards.straightdope.com/t/it-has-been-too-long-since-ive-taken-math-how-do-i-calculate-this/233164/11 "2004-03-08T20:03:46Z")

</div>

Thank you all. That helped. I was even able to calculate a complication I forgot about earlier (the AB\_ and A\_\_ cases).

---

<div class="post-metadata">

**Author:** ![Sergio](https://avatars.discourse-cdn.com/v4/letter/s/b77776/32.png) [@Sergio](https://boards.straightdope.com/u/Sergio)\
**Post date:** [March 8, 2004, 8:18pm UTC](https://boards.straightdope.com/t/it-has-been-too-long-since-ive-taken-math-how-do-i-calculate-this/233164/12 "2004-03-08T20:18:20Z")

</div>

> [@Bambi Hassenpfeffer](#):
>
> **+MDI** has the right formula; **Sérgio** and **pulykamell** have the right answer.

I not only have the right answer, but the right formula. When deducing the formula for the number of combinations of n objects m-wise you have

C = n\*(n-1)_…_(n-m+1)/(1_2_…\*m)

Now, if you multiply the numerator and the denominator by (n-m)! = 1_2_…_(n-m), you get in the numerator n_(n-1)_…_(n-m+1)_(n-m)_…\*1 = n!

So the final formula is n!/[(n-m)!\*m!] , easier to remember, but involving much more calculations.

---

<div class="post-metadata">

**Author:** ![pulykamell](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/pulykamell/32/3166_2.png) [@pulykamell](https://boards.straightdope.com/u/pulykamell)\
**Post date:** [March 8, 2004, 8:43pm UTC](https://boards.straightdope.com/t/it-has-been-too-long-since-ive-taken-math-how-do-i-calculate-this/233164/13 "2004-03-08T20:43:53Z")

</div>

> [@Bambi Hassenpfeffer](#):
>
> **+MDI** has the right formula; **Sérgio** and **pulykamell** have the right answer.

As they say, there’s more than one way to skin a cat. As long as you arrive at the right answer through mathematically sound means.

---

<div class="post-metadata">

**Author:** ![Bambi\_Hassenpfeffer](https://avatars.discourse-cdn.com/v4/letter/b/bbe5ce/32.png) [@Bambi\_Hassenpfeffer](https://boards.straightdope.com/u/Bambi_Hassenpfeffer)\
**Post date:** [March 8, 2004, 8:53pm UTC](https://boards.straightdope.com/t/it-has-been-too-long-since-ive-taken-math-how-do-i-calculate-this/233164/14 "2004-03-08T20:53:47Z")

</div>

> [@Sérgio](#):
>
> I not only have the right answer, but the right formula.

I missed it down there. Sorry. No slight intended.

> [@pulykamell](#):
>
> As they say, there’s more than one way to skin a cat. As long as you arrive at the right answer through mathematically sound means.

And you are of course correct. I intended no slight on your method. It’s not something I would’ve deduced, as I am not particularly mathematically-inclined. I just wanted to provide him a way to have a computer or calculator figure it out.

---

<div class="post-metadata">

**Author:** ![pulykamell](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/pulykamell/32/3166_2.png) [@pulykamell](https://boards.straightdope.com/u/pulykamell)\
**Post date:** [March 8, 2004, 9:03pm UTC](https://boards.straightdope.com/t/it-has-been-too-long-since-ive-taken-math-how-do-i-calculate-this/233164/15 "2004-03-08T21:03:17Z")

</div>

Oh, no offense taken. It’s just that I too always forget these simple statistics formulas, so I write down a small group of numbers (in my case, I started with five) and wrote down the three-number combos possible from this. I noticed it went (3+2+1) + (2+1) + (1). So then I extrapolated.

Like I said, not the best method by any stretch, but reasonable if you’ve completely blanked on how to do it.
