Sunday, July 10, 2016

Topic 10: Sets and Venn Diagrams

Ten Best Friends

You could have a set made up of your ten best friends:

{ alex, blair, casey, drew, erin, francis, glen, hunter, ira, jade }

Each friend is an "element" (or "member") of the set (it is normal to use lowercase letters for them.)

Now let's say that alex, casey, drew and hunter play Soccer:

Soccer = { alex, casey, drew, hunter }

(The Set "Soccer" is made up of the elements alex, casey, drew and hunter).



And casey, drew and jade play Tennis:

Tennis = { casey, drew, jade }


You could put their names in two separate circles:


Union

You can now list your friends that play Soccer OR Tennis.

This is called a "Union" of sets and has the special symbol ∪:

Soccer ∪ Tennis = { alex, casey, drew, hunter, jade }

Not everyone is in that set, only your friends that play
Soccer, Tennis or both).

We can also put it in a "Venn Diagram":


A Venn Diagram is clever because it shows lots of information:
  • Do you see that alex, casey, drew and hunter are in the "Soccer" set?
  • And that casey, drew and jade are in the "Tennis" set?
  • And here is the clever thing: casey and drew are in BOTH sets!
Intersection

"Intersection" is when you have to be in BOTH sets.

In our case that means they play
both Soccer AND Tennis, which is casey and drew.

The special symbol for Intersection is an upside down "U" like this:

And this is how we write it down:

Soccer ∩ Tennis = {casey, drew}

In a Venn Diagram:


Difference

You can also "subtract" one set from another.

For example; 
Taking Soccer and subtracting Tennis means people that play Soccer but NOT Tennis which is alex and hunter.

And this is how we write it down:

Soccer − Tennis = { alex, hunter }

In a Venn Diagram:

Summary So Far
  • ∪ is Union: is in either set
  • ∩ is Intersection: must be in both sets
  • − is Difference: in one set but not the other
Three Sets

You can also use Venn Diagrams for 3 sets.

Let us say the third set is
"Volleyball" which is drew, glen and jade play:

Volleyball = { drew, glen, jade }

But let's be more "mathematical" and use a Capital Letter for each set:
  • S means the set of Soccer players
  • T means the set of Tennis players
  • V means the set of Volleyball players
The Venn Diagram is now like this:

You can see (for example) that:
  • drew plays Soccer, Tennis and Volleyball
  • jade plays Tennis and Volleyball
  • alex and hunter play Soccer, but don't play Tennis or Volleyball
  • no-one plays only Tennis
We can now have some fun with Unions and Intersections.


S = { alex, casey, drew, hunter }

T ∪ V = { casey, drew, jade, glen }


S ∩ V = { drew }


And how about this
  • take the previous set S ∩ V
  • then subtract T:
(S ∩ V) − T = {}

Hey, there is nothing there!

That is OK, it is just the
"Empty Set". It is still a set, so we use the curly brackets with nothing inside: {}

The Empty Set has no elements: {}

Topic 9: Sets

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.




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:





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:
For 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.

Topic 8: Probability Tree Diagrams

Calculating probabilities can be hard, sometimes we add them, sometimes we multiply them, and often it is hard to figure out what to do... tree diagrams to the rescue!
Here is a tree diagram for the toss of a coin:

There are two "branches" (Heads and Tails)

  • The probability of each branch is written on the branch
  • The outcome is written at the end of the branch

We can extend the tree diagram to two tosses of a coin:










How do we calculate the overall probabilities?
  • We multiply probabilities along the branches
  • We add probabilities down columns



Now we can see such things as:

  • The probability of "Head, Head" is 0.5×0.5 = 0.25
  • All probabilities add to 1.0 (which is always a good check)
  • The probability of getting at least one Head from two tosses is 0.25+0.25+0.25 = 0.75
That was a simple example using independent events (each toss of a coin is independent of the previous toss), but tree diagrams are really wonderful for figuring out dependent events (where an event depends on what happens in the previous event).

For example: Soccer Game

You are off to soccer, and love being the Goalkeeper, but that depends who is the Coach today:


  • with Coach Sam the probability of being Goalkeeper is 0.5
  • with Coach Alex the probability of being Goalkeeper is 0.3
    Sam is Coach more often... about 6 out of every 10 games (a probability of 0.6).
    So, what is the probability you will be a Goalkeeper today? 

    Let's build the tree diagram. First we show the two possible coaches: Sam or Alex:

    The probability of getting Sam is 0.6, so the probability of Alex must be 0.4 (together the probability is 1)
    Now, if you get Sam, there is 0.5 probability of being Goalie (and 0.5 of not being Goalie):
     If you get Alex, there is 0.3 probability of being Goalie (and 0.7 not):

    The tree diagram is complete, now let's calculate the overall probabilities. This is done by multiplying each probability along the "branches" of the tree.

    Here is how to do it for the "Sam, Yes" branch:




    (When we take the 0.6 chance of Sam being coach and include the 0.5 chance that Sam will let you be Goalkeeper we end up with an 0.3 chance)

    But we are not done yet! We haven't included Alex as Coach:


    An 0.4 chance of Alex as Coach, followed by an 0.3 chance gives 0.12.

    Now we add the column:


    0.3 + 0.12 = 0.42 probability of being a Goalkeeper today


    (That is a 42% chance)

    Check

    One final step: complete the calculations and make sure they add to 1:


    Topic 7: 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 ½.

    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 happen
                                                              Total number of outcomes

    For 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 = 1
                                     6

    Probability Line

    We can show probability on a Probability Line:



    Probability is Just a Guide

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

    For 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.

    Topic 6: Geometric Sequence and Sums

    Geometric Sequence

    In a Geometric Sequence each term is found by multiplying the previous term by a constant.

    For example;

    2, 4, 8, 16, 32, 64, 128, 256, ...

    This sequence has a factor of 2 between each number.

    Each term except the first term is found by multiplying the previous term by 2.

    In General we write a Geometric Sequence like this:

    {a, ar, ar2, ar3, ... }

    where:

    • a is the first term, and
    • r is the factor between the terms (called the "common ratio")

    For example: 

    { 1, 2, 4, 8, ... }

    The sequence starts at 1 and doubles each time, so


    • a=1 (the first term)
    • r=2 (the "common ratio" between terms is a doubling)
    And we get:


    { a, ar, ar2, ar3, ... }

    { 1, 1×2, 1×22, 1×23, ... }

    { 1, 2, 4, 8, ... }

    But be careful, r should not be 0:

    When
    r=0, we get the sequence { a, 0, 0, ... } which is not geometric

    Rule

    We can also calculate any term using the Rule:


    xn = ar(n-1)

    We use "n-1" because aris for the 1st term

    For example:


    10, 30, 90, 270, 810, 2430, ...

    This sequence has a factor of 3 between each number.
    The values of a and r are:
    • a = 10 (the first term)
    • r = 3 (the "common ratio")

    The Rule for any term is:


    xn = 10 × 3(n-1)

    So, the 4th term is:


    x4 = 10 × 3(4-1) = 10 × 33 = 10 × 27 = 270

    And the 10th term is:


    x10 = 10 × 3(10-1) = 10 × 39 = 10 × 19683 = 196830
    A Geometric Sequence can also have smaller and smaller values:
    For example:


    4, 2, 1, 0.5, 0.25, ...

    This sequence has a factor of 0.5 (a half) between each number.

    Its Rule is xn = 4 × (0.5)n-1

    Why "Geometric" Sequence?

    Because it is like increasing the dimensions in geometry:



    Geometric Sequences
    are sometimes called Geometric Progressions.


    Summing a Geometric Series

    When we need to sum a Geometric Sequence, there is a handy formula.

    To sum:

    a + ar + ar2 + ... + ar(n-1)

    Each term is ark, where k starts at 0 and goes up to n-1

    Use this formula:


    • a is the first term 
    • r is the "common ratio" between terms 
    • n is the number of terms
    The formula is easy to use, just "plug in" the values of a, r and n
    For example: Sum the first 4 terms of

    10, 30, 90, 270, 810, 2430, ...

    This sequence has a factor of 3 between each number.

    The values of
    a, r and n are:


    • a = 10 (the first term)
    • r = 3 (the "common ratio")
    • n = 4 (we want to sum the first 4 terms)
    So:

    Becomes:


    You can check it yourself:

    10 + 30 + 90 + 270 = 400

    And yes, it is easier to just add them in this example, as there are only 4 terms. But imagine adding 50 terms... then the formula is much easier.

    Using the Formula

    Let's see the formula in action:

    For example:
    Grains of Rice on a Chess Board


    When we place rice on a chess board:


    • 1 grain on the first square,
    • 2 grains on the second square,
    • 4 grains on the third and so on,
    • ...

    doubling the grains of rice on each square.

    how many grains of rice in total?

    So we have:


    • a = 1 (the first term)
    • r = 2 (doubles each time)
    • n = 64 (64 squares on a chess board)
    So:


    Becomes:



    = (1-264) / (-1) = 264 - 1

    = 18, 446, 744, 073, 709, 551, 615

    Why Does the Formula Work?
    Let's see why the formula works, because we get to use an interesting "trick" which is worth knowing.

    First, call the whole sum "S":

    S = a + ar + ar2 + ... + ar(n-2) + ar(n-1)

    Next, multiply S by r:

    × r = ar + ar2 + ar3 + ... + ar(n-1) + arn

    Notice that S and S × r are similar?

    Now subtract them!



    All the terms in the middle neatly cancel out. 

    By subtracting S × r from S we get a simple result:

    S − S × r = a − arn

    Let's rearrange it to find S:


    Factor out S and a: 

    S(1− r) = a(1− rn

    Divide by (1-r):

    S = a(1−rn)/(1−r)

    Which is our formula:


    Monday, July 4, 2016

    Topic 5: Arithmetice Sequence and Sums

    Arithmetic Sequence

    In an Arithmetic Sequence the difference between one term and the next is a constant.

    In other words, we just add the same value each time infinitely.

    For example;



    1, 4, 7, 10, 13, 16, 19, 22, 25, ...

    This sequence has a difference of 3 between each number.

    In general we could write an arithmetic sequence like this:

    { a, a+d, a+2d, a+3d, ... }

    Where:
    • a is the first term, and
    • d is the difference between the terms (called the "common difference")

    For example; (Continued)

    1, 4, 7, 10, 13, 16, 19, 22, 25, ...

    Has:
    • a = 1 (First term), and
    • d = 3 (The "common difference" between terms)
    and we get:

    { a, a + d, a + 2d, a + 3d, ... }
    { 1, 1 + 3, 1 + 2 × 3, 1 + 3 × 3, ... }
    { 1, 4, 7, 10, ... }

    Rule

    We can write an Arithmetic Sequence as a rule:


    xn = a + d(n-1)

    We use "n-1" because d is not used in the 1st term.

    For example: Write the Rule, and calculate the 4th term for


    3, 8, 13, 18, 23, 28, 33, 38, ...
    This sequence has a difference of 5 between each number.
    The values of a and d are:
    • a = 3 (the first term)
    • d = 5 (the "common difference")
    The Rule can be calculated:
    xn = a + d(n-1)
    3 + 5(n-1)
    3 + 5n - 5
    5n - 2

    So, the 4th term is:


    x4 = 5×4 - 2 = 18

    Arithmetic Sequences are sometimes called Arithmetic Progressions.


    Summing an Arithmetic Series

    To sum up the terms of this arithmetic sequence:



    a + (a+d) + (a+2d) + (a+3d) + ...

    use this formula:



    What is that funny symbol? It is called Sigma Notation


     (called Sigma) means "sum up"

    And below and above it are shown the starting and ending values:



    It says "Sum up n where n goes from 1 to 4. Answer = 10"

    Here is how to use it:


    For example: Add up the first 10 terms of the arithmetic sequence


    { 1, 4, 7, 10, 13, ... }
    The values of ad and n are:
    • a = 1 (the first term)
    • d = 3 (the "common difference" between terms)
    • n = 10 (how many terms to add up)
    So:



    Becomes:



    = 5(2 + 9 × 3) = 5(29) = 145

    Why Does the Formula Work?

    Let's see why the formula works, because we get to use an interesting "trick" which is worth knowing.


    First, we will call the whole sum "S":


    S = a + (a + d) + ... + (a + (n-2)d) + (a + (n-1)d)

    Next, rewrite S in reverse order:


    S = (a + (n-1)d) + (a + (n-2)d) + ... + (a + d) + a

    Now add those two, term by term:


    S = a + (a+d) + ... + (a + (n-2)d) + (a + (n-1)d) 

    S = (a + (n-1)d) + (a + (n-2)d) + ... + (a + d) + a

    2S = (2a + (n-1)d) + (2a + (n-1)d) + ... + (2a + (n-1)d) + (2a + (n-1)d)

    Each term is the same! And there are "n" of them so...


    2S = n × (2a + (n-1)d)

    Now, just divide by 2 and we get:


    S = (n/2) × (2a + (n-1)d)
    Which is our formula: