`person(1)` is packing `his(1)` bags for `his(1)` vacation. `He(1)` has

unique `NUM_THINGS``THING`, but only

fit in `NUM_TAKEN``his(1)` bag.

How many different groups of `NUM_TAKEN``THING` can `he(1)` take?

`ANSWER`

`person(1)` has

spaces for `NUM_TAKEN``his(1)` `THING`,
so let's fill them one by one.
At first, `person(1)` has

choices for what to put in the first space.
`NUM_THINGS`

For the second space, `he(1)` only has `NUM_THINGS-1``THING` left, so there are only

choices
of what to put in the second space. So far, it seems like there are `NUM_THINGS-1`

different unique choices `NUM_THINGS` \cdot `NUM_THINGS-1` =
`NUM_THINGS * (NUM_THINGS-1)``person(1)` could have made to fill the first two
spaces in `his(1)` bag. But that's not quite right.

Why? Because if `he(1)` picked `THING.substring(0,THING.length-1)` number 3, then
`THING.substring(0,THING.length-1)` number 1, that's the same situation as picking number 1 and then number 3. They both end up in the same bag.

So, if `person(1)` keeps filling the spaces in `his(1)` bag, making

decisions altogether, we've overcounted a bunch of groups.
`_.map(_.range(NUM_TAKEN), function(l){ return (NUM_THINGS - l);}).join("\\cdot")` = \dfrac{`NUM_THINGS`!}{(`NUM_THINGS`-`NUM_TAKEN`)!} = ` factorial(NUM_THINGS)/factorial(NUM_THINGS-NUM_TAKEN)`

How much have we overcounted? Well, for every group of

,
we've counted them as if the order we chose them in
matters, when really it doesn't. So, the number of times we've overcounted each group is the number of ways to order
`NUM_TAKEN`

things.
`NUM_TAKEN`

There are

ways of ordering `NUM_TAKEN`! = `factorial(NUM_TAKEN)`

things, so we've counted each group of `NUM_TAKEN``NUM_TAKEN``THING`

times.
`factorial(NUM_TAKEN)`

So, we have to divide the number of ways we could have filled the bag in order by number of times we've overcounted our groups.

` \dfrac{`

is the number
of groups of `NUM_THINGS`!}{(`NUM_THINGS` - `NUM_TAKEN`)!} \cdot \dfrac{1}{`NUM_TAKEN`!}`THING` `person(1)` can bring.

Another way to write this is ` \binom{`

,
or `NUM_THINGS`}{`NUM_TAKEN`}

choose `NUM_THINGS`

, which is `NUM_TAKEN`

.
`ANSWER`

You just got a free ticket for a boat ride, and you can bring along

friends!
Unfortunately, you have `SLOTS`

friends who want to come along.
`FRIENDS`

How many different groups of friends could you take with you?

`ANSWER`

There are

places for your friends on the boat, so let's fill those slots one by one.
For the first slot, we have `SLOTS`

different choices we can make (because `FRIENDS`

different friends could be in that slot).
`FRIENDS`

Once we've filled the first slot, there are

friends who could fill the second. So far, if we've
filled the first two slots, and it seems like there are `FRIENDS-1`

different choices we could have made. But that's not quite true.
`FRIENDS` \cdot `FRIENDS-1` = `FRIENDS * (
FRIENDS-1)`

Why? Because if we picked `person(1)`, then `person(2)`, that's the same thing as picking `person(2)`, then `person(1)`. They both get to be on the same boat.

So, if we continue filling the slots on our boat, making

decisions altogether, we've overcounted a bunch of groups.
`_.map(_.range(SLOTS), function(l){ return (FRIENDS - l);}).join("\\cdot")` = \dfrac{`FRIENDS`!}{`FRIENDS-SLOTS`!} = ` factorial(FRIENDS)/factorial(FRIENDS-SLOTS)`

How much have we overcounted? Well, for every group of

, we've counted them as if the order we chose
them in matters, when really it doesn't. So, the number of times we've overcounted each group is the number of ways to order `SLOTS````
```

things.
`SLOTS`

There are

ways of ordering `SLOTS`! = `factorial(SLOTS)`

things,
so we've counted each group of `SLOTS`

friends `SLOTS`

times.
`factorial(SLOTS)`

So, we have to divide the number of ways we could have filled the boat in order by number of times we've overcounted our groups:

` \dfrac{`

is the number of groups we can bring on the boat trip.
`FRIENDS`!}{`FRIENDS-SLOTS`!} \cdot \dfrac{1}{`SLOTS`!}

Another way to write this is ` \binom{`

, or `FRIENDS`}{`SLOTS`}

choose `FRIENDS`

, which is `SLOTS`

.
`ANSWER`