# Heads, Tails And Beans |S|=4

So far, we’ve looked at sets and how they contain information that we wish to count in some way. How the power set $$\wp(S)$$ can count all of the possible sub-sets of a given set and a look at the relevance of the empty set $$\emptyset$$. In this part we’ll take a look at how larger sets can be built and how we can use sets to think about probability.

### Variables

Algebra uses a lower case letter, in this case $$x$$, to represent some general calculable value:

$3x+1=10$

Combinatorics also uses lower case letters to represent the elements in a set. For example, if we have a set that contains a straight poker hand:

$S=\{J♣,8♦,10♦,Q♠,9♥\}$

We can represent any of those cards inside of the set with a letter, like this:

$x \in S$

Which reads, $$x$$ is an element inside of set $$S$$. If $$x=\{10♦\}$$, then $$x$$ is inside of set $$S$$. If $$x=\{A♣\}$$, then we would write:

$x \notin S$

Which reads element $$x$$ is not in set $$S$$.

### Building Larger Sets

The way we are building sets at the moment could be called a direct enumeration. This is fine for small sets and also for solving more complex problems through simplification. If I wanted a set of all of the integer numbers between 1 and 100 inclusive I’m not going to write out $$S=\{1,2,3,4,5,6,etc\}$$. A better way would be to write this:

$S=\{1,2,3,…,99,100\}$

The little dots are called an ellipsis and it makes the intention pretty clear. Wherever there is a logical sequence the ellipsis can be used. Another example, we can make a finite set of prime numbers:

$S=\{p_1,p_2,p_3,…,p_n\}$

Where $$p$$ is a prime number and the indexes (or more correctly indices) 1,2,3,n represent the order. If n is equal to 10 then set $$S$$ would look like this: $$S=\{2, 3, 5, 7, 11, 13, 17, 19, 23, 29\}$$.

Indices are useful where we have a single letter but need to represent many values. The letter $$p$$ is a prime number and the subscript allows us to identify each one, example $$p_5=11$$. This is also true for sets and subsets, as we’ll see with our lottery ticket formula.

Set $$A_i$$ represents the outcome from flipping a coin, either heads or tails. If the index $$i$$ is either $$0$$ or $$1$$, then:

$A_0=\{heads\}, A_1=\{tails\}$

This is very useful, otherwise we would quickly start to run out of the letters of the alphabet and we can use a number to separate related sets.

### Set Builder Notation

We can also use mathematical formulae to fill in a set. This notation can be quite complicated, but the general format looks like this:

$\text{A_Set}=\{\text{Things_to_go_into_the_set} : \text{Rules_for_those_things}\}$

The ‘:’ can be read as the word ‘given’. Example:

$S=\{x : x=1,2,3\}$

Therefore, set $$S=\{1,2,3\}$$. Read as set $$S$$ contains $$x$$ given $$x=1,2,3$$.

Here’s a way to build an infinite set of positive even numbers:

$S=\{2x : x \in \mathbb{N}\}$

Where $$\mathbb{N}$$ is a natural number. Or, an infinite set of negative odd numbers. I’ve added an extra rule, that $$x$$ must be less than zero and $$\mathbb{Z}$$ is an integer:

$S=\{2x+1 : x \in \mathbb{Z}, x<0\}$

It’s perfectly reasonable to use plain English. If set $$A=\{\text{Cat, Dog, Table, Chair}\}$$, then if:

$B=\{x \in A : x=\text{An article of furniture.}\}$

…set $$B=\{\text{Table, Chair}\}$$. Mathematics can be very accommodating, when it needs to be!

### Probability

Now that we’ve got a little set theory notation under our belts, let’s look at how we can use it to describe probability.

If you ask people what the chances are of winning a coin toss their answer would most likely be, “It’s 50/50”. What they mean is that there is a 50% chance that it is heads, and a 50% chance that it is tails. This is true, but how can we generalise this calculation?

Let’s take a single dice roll. There are six different numbers, therefore there are six different outcomes. If I roll a die, what is the chance, or probability, that I’ll roll the number five? Simple mathematics shows this:

${1 \over 6} \approx 0.17$

Which is equal to one divided by six, or a one in six chance. The two wavy lines mean ‘approximately equal to’. If we multiply the answer 0.17 by 100 we get the percentage (or probability) of winning. In this case approximately 17%, and this is true for any throw of a die.

Mathematically we could write it like this:

$\text{Probability} = {\text{Number Of Probable Outcomes} \over \text{Total Number Of Possible Outcomes}}$

…and with our new found knowledge of set theory we can also write it like this:

$P(A) = {|A| \over |S|}$

For a probability $$P$$ given set $$A$$. Where set $$A$$ contains the probable outcome(s), and set $$S$$ contains all of the possible outcomes. Set $$S$$ is called the sample space and set $$A$$ is called the event set which is a subset of $$S$$. An event is a single action, like flipping a coin or rolling dice.

Take a coin toss and, for example, if we choose heads:

$A=\{H\}, \; S=\{H,T\}$

$P(A) = {|A| \over |S|} = {1 \over 2} = 0.5$

…we have a $$0.5*100=50\%$$ chance of winning. Of course if my event set were $$A=\{H,T\}$$, then I would have a 100% chance of winning:

$P(A) = {|A| \over |S|} = {2 \over 2} = 1$

…and that leads us nicely to the sum of all of the probabilities. Which equals 1 (or 100%) for all of the probable outcomes. For a single dice:

${1 \over 6} + {1 \over 6} + {1 \over 6} + {1 \over 6} + {1 \over 6} + {1 \over 6} = 1$

The sum of the probabilities of throwing a 1, 2, 3, 4, 5, and 6. We can see that the probability of throwing an odd or an even number is the same as flipping a coin:

${1 \over 6} + {1 \over 6} + {1 \over 6} = 0.5$

…as the event set $$A$$ would contain either $$\{1, 3, 5\}$$ or $$\{2, 4, 6\}$$ and the cardinality of each set is three:

$S=\{1, 2, 3, 4, 5, 6\} {\; \;} |S|=6,$

$P(A) = {|A| \over |S|} = {3 \over 6} = 0.5$

Of course, that’s true for any three of the six possible outcomes.