Counting
Last updated
Last updated
If you're reading this, I think it's safe to assume you already know how to count... (1, 2, 3, whatever) so what's the big deal about counting?
When we say counting in this context, we mean counting sequences of decisions. For example, we might want to get the total number of ways to choose toppings on a pizza or something.
There are two main types of problems: those where order matters and those where it doesn't.
Here's a sample problem: let's try to figure out the total number of unique 5-character strings we can make with the letters 'A' through 'E'. For instance, 'ABCDE' and 'DABBA' are both valid.
Lots of these types of problems can be visualized using slots, where each slot is one character or option:
To get the total number of ways to fill the slots, we can multiply the number of ways each individual slot can be filled together.
So for the problem above, we get that there are 5 ways to fill each slot, and 5 slots in total. So, strings.
In order to tackle these types of problems, we'll need to introduce the combinatorial . When you see this, it means "the number of ways we can choose things from total elements if order doesn't matter".
When we need to split items into groups, it's sometimes nice to add bars that separate the items. This is great if there are particular classes of items rather than unique ones (if they're unique, just use slots.)
How this works is that we can treat each item as a star, and the stars are separated by bars that designate one group from another.
This means that if there are stars and groups, then there must be total ways to split the stars into groups.
One application of this is to get the total number of equations for a fixed . We can think of there being number of ones (our stars), and number of plus signs (our bars). There can also be an empty group (representing ), which bumps us up to groups. By the Stars and Bars principle, there are such equations for non-negative numbers.
Used to calculate the probability of the union of events.
http://prob140.org/textbook/content/Chapter_05/02_Inclusion_Exclusion.html