Tuesday, August 9, 2016

Combinations and Permutations

What's the Difference?

In English we use the word "combination" loosely, without thinking if the order of things is important. In other words:
"My fruit salad is a combination of apples, grapes and bananas" We don't care what order the fruits are in, they could also be "bananas, grapes and apples" or "grapes, apples and bananas", its the same fruit salad.
"The combination to the safe is 472". Now we do care about the order. "724" won't work, nor will "247". It has to be exactly 4-7-2.
So, in Mathematics we use more accurate language:
If the order doesn't matter, it is a Combination.
If the order does matter it is a Permutation.

So, we should really call this a "Permutation Lock"!
In other words:
A Permutation is an ordered Combination.

To help you to remember, think "Permutation ... Position"

Permutations

There are basically two types of permutation:
  1. Repetition is Allowed: such as the lock above. It could be "333".
  2. No Repetition: for example the first three people in a running race. You can't be first andsecond.

1. Permutations with Repetition

These are the easiest to calculate.
When we have n things to choose from ... we have n choices each time!
When choosing r of them, the permutations are:
n × n × ... (r times)
(In other words, there are n possibilities for the first choice, THEN there are n possibilites for the second choice, and so on, multplying each time.)
Which is easier to write down using an exponent of r:
n × n × ... (r times) = nr
Example: in the lock above, there are 10 numbers to choose from (0,1,...9) and we choose 3 of them:
10 × 10 × ... (3 times) = 103 = 1,000 permutations
So, the formula is simply:
nr
where n is the number of things to choose from, and we choose r of them
(Repetition allowed, order matters)

2. Permutations without Repetition

In this case, we have to reduce the number of available choices each time.
For example, what order could 16 pool balls be in?
After choosing, say, number "14" we can't choose it again.
So, our first choice has 16 possibilites, and our next choice has 15 possibilities, then 14, 13, etc. And the total permutations are:
16 × 15 × 14 × 13 × ... = 20,922,789,888,000
But maybe we don't want to choose them all, just 3 of them, so that is only:
16 × 15 × 14 = 3,360
In other words, there are 3,360 different ways that 3 pool balls could be arranged out of 16 balls.
Without repetition our choices get reduced each time.
But how do we write that mathematically? Answer: we use the "factorial function"
The factorial function (symbol: !) just means to multiply a series of descending natural numbers. Examples:
  • 4! = 4 × 3 × 2 × 1 = 24
  • 7! = 7 × 6 × 5 × 4 × 3 × 2 × 1 = 5,040
  • 1! = 1
Note: it is generally agreed that 0! = 1. It may seem funny that multiplying no numbers together gets us 1, but it helps simplify a lot of equations.
So, when we want to select all of the billiard balls the permutations are:
16! = 20,922,789,888,000
But when we want to select just 3 we don't want to multiply after 14. How do we do that? There is a neat trick ... we divide by 13! ...
16 × 15 × 14 × 13 × 12 ...
= 16 × 15 × 14 = 3,360
13 × 12 ...
Do you see? 16! / 13! = 16 × 15 × 14
The formula is written:
where n is the number of things to choose from, and we choose r of them
(No repetition, order matters)

Examples:

Our "order of 3 out of 16 pool balls example" is:
16! = 16! = 20,922,789,888,000 = 3,360
(16-3)!13!6,227,020,800
(which is just the same as: 16 × 15 × 14 = 3,360)
How many ways can first and second place be awarded to 10 people?
10! = 10! = 3,628,800 = 90
(10-2)!8!40,320
(which is just the same as: 10 × 9 = 90)

Notation

Instead of writing the whole formula, people use different notations such as these:
Example: P(10,2) = 90

Combinations

There are also two types of combinations (remember the order does not matter now):
  1. Repetition is Allowed: such as coins in your pocket (5,5,5,10,10)
  2. No Repetition: such as lottery numbers (2,14,15,27,30,33)

1. Combinations with Repetition

Actually, these are the hardest to explain, so we will come back to this later.

2. Combinations without Repetition

This is how lotteries work. The numbers are drawn one at a time, and if we have the lucky numbers (no matter what order) we win!
The easiest way to explain it is to:
  • assume that the order does matter (ie permutations),
  • then alter it so the order does not matter.
Going back to our pool ball example, let's say we just want to know which 3 pool balls are chosen, not the order.
We already know that 3 out of 16 gave us 3,360 permutations.
But many of those are the same to us now, because we don't care what order!
For example, let us say balls 1, 2 and 3 are chosen. These are the possibilites:
Order does matterOrder doesn't matter
1 2 3
1 3 2
2 1 3
2 3 1
3 1 2
3 2 1
1 2 3
So, the permutations will have 6 times as many possibilites.
In fact there is an easy way to work out how many ways "1 2 3" could be placed in order, and we have already talked about it. The answer is:
3! = 3 × 2 × 1 = 6
(Another example: 4 things can be placed in 4! = 4 × 3 × 2 × 1 = 24 different ways, try it for yourself!)
So we adjust our permutations formula to reduce it by how many ways the objects could be in order (because we aren't interested in their order any more):
That formula is so important it is often just written in big parentheses like this:
where n is the number of things to choose from, and we choose r of them
(No repetition, order doesn't matter)
It is often called "n choose r" (such as "16 choose 3")
And is also known as the Binomial Coefficient.

Notation

As well as the "big parentheses", people also use these notations:

Just remember the formula:
n!
r!(n−r)!

Example

So, our pool ball example (now without order) is:
16! = 16! = 20,922,789,888,000 = 560
3!(16-3)!3!×13!6×6,227,020,800
Or we could do it this way:
16×15×14 = 3360 = 560
3×2×16


It is interesting to also note how this formula is nice and symmetrical:
In other words choosing 3 balls out of 16, or choosing 13 balls out of 16 have the same number of combinations.
16! = 16! = 16! = 560
3!(16-3)!13!(16-13)!3!×13!

Pascal's Triangle

We can also use Pascal's Triangle to find the values. Go down to row "n" (the top row is 0), and then along "r" places and the value there is our answer. Here is an extract showing row 16:
1    14    91    364  ...

1    15    105   455   1365  ...

1    16   120   560   1820  4368  ...

1. Combinations with Repetition

OK, now we can tackle this one ...
Let us say there are five flavors of icecream: banana, chocolate, lemon, strawberry and vanilla.
We can have three scoops. How many variations will there be?
Let's use letters for the flavors: {b, c, l, s, v}. Example selections include
  • {c, c, c} (3 scoops of chocolate)
  • {b, l, v} (one each of banana, lemon and vanilla)
  • {b, v, v} (one of banana, two of vanilla)
(And just to be clear: There are n=5 things to choose from, and we choose r=3 of them.
Order does not matter, and we can repeat!)
Now, I can't describe directly to you how to calculate this, but I can show you a special techniquethat lets you work it out.
Think about the ice cream being in boxes, we could say "move past the first box, then take 3 scoops, then move along 3 more boxes to the end" and we will have 3 scoops of chocolate!
So it is like we are ordering a robot to get our ice cream, but it doesn't change anything, we still get what we want.
We can write this down as  (arrow means move, circle means scoop).
In fact the three examples above can be written like this:
{c, c, c} (3 scoops of chocolate):
{b, l, v} (one each of banana, lemon and vanilla):
{b, v, v} (one of banana, two of vanilla):
OK, so instead of worrying about different flavors, we have a simpler question: "how many different ways can we arrange arrows and circles?"
Notice that there are always 3 circles (3 scoops of ice cream) and 4 arrows (we need to move 4 times to go from the 1st to 5th container).
So (being general here) there are r + (n−1) positions, and we want to choose r of them to have circles.
This is like saying "we have r + (n−1) pool balls and want to choose r of them". In other words it is now like the pool balls question, but with slightly changed numbers. And we can write it like this (note: r+(n−1) is the same as n+r−1):
where n is the number of things to choose from, and we choose r of them
(Repetition allowed, order doesn't matter)
Interestingly, we can look at the arrows instead of the circles, and say "we have r + (n−1)positions and want to choose (n−1) of them to have arrows", and the answer is the same:
So, what about our example, what is the answer?
(5+3−1)! = 7! = 5040 = 35
3!(5−1)!3!×4!6×24

In Conclusion

Phew, that was a lot to absorb, so maybe you could read it again to be sure!
But knowing how these formulas work is only half the battle. Figuring out how to interpret a real world situation can be quite hard.
But at least now you know how to calculate all 4 variations of "Order does/does not matter" and "Repeats are/are not allowed".

Question 1.
How many permutations of 3 different digits are there, chosen from the ten digits 0 to 9 inclusive?

(Such as drawing ten numbered marbles from a bag, without replacement)
A. 84             B.  120
C. 504           D. 720
Question 2.
How many permutations of 4 different letters are there, chosen from the twenty six letters of the alphabet?
A. 14, 950        B. 23,751
C. 358.800       D. 456.976
Question 3.
How many different committees of 5 people can be chosen from 10 people?
A. 252             B. 2,002
C. 30,240        C. 100,000

Probability


How likely something is to happen.
Many events can't be predicted with total certainty. The best we can say is how likely they are to happen, using the idea of probability.

Tossing a Coin 

When a coin is tossed, there are two possible outcomes:
  • heads (H) or
  • tails (T)
We say that the probability of the coin landing H is ½.
And the probability of the coin landing T is ½.
pair of dice

Throwing Dice 

When a single die is thrown, there are six possible outcomes: 1, 2, 3, 4, 5, 6.
The probability of any one of them is 1/6.

Probability 

In general:
Probability of an event happening = Number of ways it can happenTotal number of outcomes

Example: the chances of rolling a "4" with a die

Number of ways it can happen: 1 (there is only 1 face with a "4" on it)
Total number of outcomes: 6 (there are 6 faces altogether)
So the probability = 16

Example: there are 5 marbles in a bag: 4 are blue, and 1 is red. What is the probability that a blue marble gets picked?

Number of ways it can happen: 4 (there are 4 blues)
Total number of outcomes: 5 (there are 5 marbles in total)
So the probability = 45 = 0.8

Probability Line

We can show probability on a Probability Line:
Probability is always between 0 and 1

Probability is Just a Guide

Probability does not tell us exactly what will happen, it is just a guide

Example: toss a coin 100 times, how many Heads will come up?

Probability says that heads have a ½ chance, so we can expect 50 Heads.
But when we actually try it we might get 48 heads, or 55 heads ... or anything really, but in most cases it will be a number near 50.
Words
Some words have special meaning in Probability:
Experiment or Trial: an action where the result is uncertain.
Tossing a coin, throwing dice, seeing what pizza people choose are all examples of experiments.
Sample Space: all the possible outcomes of an experiment

Example: choosing a card from a deck

There are 52 cards in a deck (not including Jokers)
So the Sample Space is all 52 possible cards: {Ace of Hearts, 2 of Hearts, etc... }
The Sample Space is made up of Sample Points:
Sample Point: just one of the possible outcomes

Example: Deck of Cards

  • the 5 of Clubs is a sample point
  • the King of Hearts is a sample point
"King" is not a sample point. As there are 4 Kings that is 4 different sample points.

Event: a single result of an experiment

Example Events:

  • Getting a Tail when tossing a coin is an event
  • Rolling a "5" is an event.
An event can include one or more possible outcomes:
  • Choosing a "King" from a deck of cards (any of the 4 Kings) is an event
  • Rolling an "even number" (2, 4 or 6) is also an event

The Sample Space is all possible outcomes.
A Sample Point is just one possible outcome.
And an Event can be one or more of the possible outcomes.

Hey, let's use those words, so you get used to them:
pair of dice

Example: Alex wants to see how many times a "double" comes up when throwing 2 dice.

Each time Alex throws the 2 dice is an Experiment.
It is an Experiment because the result is uncertain.

The Event Alex is looking for is a "double", where both dice have the same number. It is made up of these 6 Sample Points:
{1,1} {2,2} {3,3} {4,4} {5,5} and {6,6}

The Sample Space is all possible outcomes (36 Sample Points):
{1,1} {1,2} {1,3} {1,4} ... {6,3} {6,4} {6,5} {6,6}

These are Alex's Results:
ExperimentIs it a Double?
{3,4}No
{5,1}No
{2,2}Yes
{6,3}No
......

After 100 Experiments, Alex has 19 "double" Events ... is that close to what you would expect?

Question 1.
A dice is thrown once. What is the probability that the score is a factor of 6?
A. 1/6                        B. 1/2
C. 2/3                        D. 1
Question 2.
Each of the letters of the word MISSISSIPPI are written on separate pieces of paper that are then folded, put in a hat, and mixed thoroughly. 

One piece of paper is chosen (without looking) from the hat. What is the probability it is an I?
A. 4/11                   B. 2/5
C. 1/3                     D. 1/4
Question 3.
A card is chosen at random from a deck of 52 playing cards. 

There are 4 Queens and 4 Kings in a deck of playing cards.

What is the probability the card chosen is a Queen or a King?
A. 1/13                B. 2/13
C. 1/8                  D. 2/11

Sets

Introduction to Sets

Forget everything you know about numbers.
In fact, forget you even know what a number is.
This is where mathematics starts.
Instead of math with numbers, we will now think about math with "things".

Definition

What is a set? Well, simply put, it's a collection.
First we specify a common property among "things" (this word will be defined later) and then we gather up all the "things" that have this common property.
For example, the items you wear: shoes, socks, hat, shirt, pants, and so on.
I'm sure you could come up with at least a hundred.
This is known as a set.
Or another example is types of fingers.
This set includes index, middle, ring, and pinky.
So it is just things grouped together with a certain property in common.

Notation

There is a fairly simple notation for sets. We simply list each element (or "member") separated by a comma, and then put some curly brackets around the whole thing:
Set
The curly brackets { } are sometimes called "set brackets" or "braces".
This is the notation for the two previous examples:
{socks, shoes, watches, shirts, ...}
{index, middle, ring, pinky}
Notice how the first example has the "..." (three dots together).
The three dots ... are called an ellipsis, and mean "continue on".
So that means the first example continues on ... for infinity.
(OK, there isn't really an infinite amount of things you could wear, but I'm not entirely sure about that! After an hour of thinking of different things, I'm still not sure. So let's just say it is infinite for this example.)
So:
  • The first set {socks, shoes, watches, shirts, ...} we call an infinite set,
  • the second set {index, middle, ring, pinky} we call a finite set.
But sometimes the "..." can be used in the middle to save writing long lists:
Example: the set of letters:
{a, b, c, ..., x, y, z}
In this case it is a finite set (there are only 26 letters, right?)

Numerical Sets

So what does this have to do with mathematics? When we define a set, all we have to specify is a common characteristic. Who says we can't do so with numbers?
Set of even numbers: {..., -4, -2, 0, 2, 4, ...}
Set of odd numbers: {..., -3, -1, 1, 3, ...}
Set of prime numbers: {2, 3, 5, 7, 11, 13, 17, ...}
Positive multiples of 3 that are less than 10: {3, 6, 9}
And the list goes on. We can come up with all different types of sets.
There can also be sets of numbers that have no common property, they are just defined that way. For example:
{2, 3, 6, 828, 3839, 8827}
{4, 5, 6, 10, 21}
{2, 949, 48282, 42882959, 119484203}
Are all sets that I just randomly banged on my keyboard to produce.

Why are Sets Important?

Sets are the fundamental property of mathematics. Now as a word of warning, sets, by themselves, seem pretty pointless. But it's only when we apply sets in different situations do they become the powerful building block of mathematics that they are.
Math can get amazingly complicated quite fast. Graph Theory, Abstract Algebra, Real Analysis, Complex Analysis, Linear Algebra, Number Theory, and the list goes on. But there is one thing that all of these share in common: Sets.

Universal Set

At the start we used the word "things" in quotes. We call this the universal set. It's a set that contains everything. Well, not exactly everything. Everything that is relevant to our question.
Then our sets included integers. The universal set for that would be all the integers. In fact, when doing Number Theory, this is almost always what the universal set is, as Number Theory is simply the study of integers.
However in Calculus (also known as real analysis), the universal set is almost always the real numbers. And in complex analysis, you guessed it, the universal set is the complex numbers.

Some More Notation

When talking about sets, it is fairly standard to use Capital Letters to represent the set, and lowercase letters to represent an element in that set.

So for example, A is a set, and a is an element in A. Same with B and b, and C and c.
Now you don't have to listen to the standard, you can use something like m to represent a set without breaking any mathematical laws (watch out, you can get π years in math jail for dividing by 0), but this notation is pretty nice and easy to follow, so why not?
Also, when we say an element a is in a set A, we use the symbol  to show it.
And if something is not in a set use .
Example: Set A is {1,2,3}. We can see that  A, but  A

Equality

Two sets are equal if they have precisely the same members. Now, at first glance they may not seem equal, so we may have to examine them closely!
Example: Are A and B equal where:
  • A is the set whose members are the first four positive whole numbers
  • B = {4, 2, 1, 3}
Let's check. They both contain 1. They both contain 2. And 3, And 4. And we have checked every element of both sets, so: Yes, they are equal!
And the equals sign (=) is used to show equality, so we write:
A = B

Subsets

When we define a set, if we take pieces of that set, we can form what is called a subset.
So for example, we have the set {1, 2, 3, 4, 5}. A subset of this is {1, 2, 3}. Another subset is {3, 4} or even another, {1}. However, {1, 6} is not a subset, since it contains an element (6) which is not in the parent set. In general:
A is a subset of B if and only if every element of A is in B.
So let's use this definition in some examples.

Is A a subset of B, where A = {1, 3, 4} and B = {1, 4, 3, 2}?

1 is in A, and 1 is in B as well. So far so good.
3 is in A and 3 is also in B.
4 is in A, and 4 is in B.
That's all the elements of A, and every single one is in B, so we're done.
Yes, A is a subset of B
Note that 2 is in B, but 2 is not in A. But remember, that doesn't matter, we only look at the elements in A.
Let's try a harder example.

Example: Let A be all multiples of 4 and B be all multiples of 2. Is A a subset of B? And is B a subset of A?

Well, we can't check every element in these sets, because they have an infinite number of elements. So we need to get an idea of what the elements look like in each, and then compare them.
The sets are:
  • A = {..., -8, -4, 0, 4, 8, ...}
  • B = {..., -8, -6, -4, -2, 0, 2, 4, 6, 8, ...}
By pairing off members of the two sets, we can see that every member of A is also a member of B, but every member of B is not a member of A:

pairing off A and B
So:
A is a subset of B, but B is not a subset of A

Proper Subsets

If we look at the defintion of subsets and let our mind wander a bit, we come to a weird conclusion.
Let A be a set. Is every element in A an element in A? (Yes, I wrote that correctly.)
Well, umm, yes of course, right?
So doesn't that mean that A is a subset of A?
This doesn't seem very proper, does it? We want our subsets to be proper. So we introduce (what else but) proper subsets.
A is a proper subset of B if and only if every element in A is also in B, and there exists at least one element in B that is not in A.
This little piece at the end is only there to make sure that A is not a proper subset of itself. Otherwise, a proper subset is exactly the same as a normal subset.

Example:

{1, 2, 3} is a subset of {1, 2, 3}, but is not a proper subset of {1, 2, 3}.

Example:

{1, 2, 3} is a proper subset of {1, 2, 3, 4} because the element 4 is not in the first set.
Notice that if A is a proper subset of B, then it is also a subset of B.

Even More Notation

When we say that A is a subset of B, we write A  B.
Or we can say that A is not a subset of B by A  B ("A is not a subset of B")
When we talk about proper subsets, we take out the line underneath and so it becomes A  B or if we want to say the opposite, A  B.

Empty (or Null) Set

This is probably the weirdest thing about sets.
As an example, think of the set of piano keys on a guitar.
"But wait!" you say, "There are no piano keys on a guitar!"
And right you are. It is a set with no elements.
This is known as the Empty Set (or Null Set).There aren't any elements in it. Not one. Zero.
It is represented by 
Or by {} (a set with no elements)
Some other examples of the empty set are the set of countries south of the south pole.
So what's so weird about the empty set? Well, that part comes next.

Empty Set and Subsets

So let's go back to our definition of subsets. We have a set A. We won't define it any more than that, it could be any set. Is the empty set a subset of A?
Going back to our definition of subsets, if every element in the empty set is also in A, then the empty set is a subset of A. But what if we have no elements?
It takes an introduction to logic to understand this, but this statement is one that is "vacuously" or "trivially" true.
A good way to think about it is: we can't find any elements in the empty set that aren't in A, so it must be that all elements in the empty set are in A.
So the answer to the posed question is a resounding yes.
The empty set is a subset of every set, including the empty set itself.

Order

No, not the order of the elements. In sets it does not matter what order the elements are in.
Example: {1,2,3,4} is the same set as {3,1,4,2}
When we say "order" in sets we mean the size of the set.
Just as there are finite and infinite sets, each has finite and infinite order.
For finite sets, we represent the order by a number, the number of elements.
Example, {10, 20, 30, 40} has an order of 4.
For infinite sets, all we can say is that the order is infinite. Oddly enough, we can say with sets that some infinities are larger than others, but this is a more advanced topic in sets.

Question 1. 

Which one of the following sets is infinite?

A. The set of whole numbers less than 10             B. The set of prime numbers less than 10

C. The set of integers less than 10                         D. The set of factors of 10


Question 2.

A is the set of factors of 12.
Which one of the following is not a member of A?


A. 3                 B. 4

C. 5                 D. 6

Question 3.

A is the set of factors of 6
B is the set of prime factors of 6
C is the set of proper factors of 6
D is the set of factors of 3
Which of the following is true?


A. A= B             B. A = C

B. B = C             D. C = D