Wednesday, 13 July 2016

Sequence & Number Pattern Part 2

Sequences - Finding a Rule
To find a missing number in a Sequence, first we must have a Rule
Finding Missing Numbers
To find a missing number, first find a Rule behind the Sequence.
Sometimes we can just look at the numbers and see a pattern:
Example: 1, 4, 9, 16, ?
Answer: they are Squares (12=1, 22=4, 32=9, 42=16, ...)
Rule: xn = n2
Sequence: 1, 4, 9, 16, 25, 36, 49, ...
Did you see how we wrote that rule using "x" and "n" ?
xn means "term number n", so term 3 is written x3
And we also used "n" in the formula, so the formula for term 3 is 32 = 9. This could be written
x3 = 32 = 9
Once we have a Rule we can use it to find any term. For example, the 25th term can be found by "plugging in" 25 wherever n is.
x25 = 252 = 625
How about another example:
Example: 3, 5, 8, 13, 21, ?
After 3 and 5 all the rest are the sum of the two numbers before, that is 3 + 5 = 8, 5 + 8 = 13 and so on (it is actually part of the Fibonacci sequence):
Rule: xn = xn-1 + xn-2
Sequence: 3, 5, 8, 13, 21, 34, 55, 89, ...
Now what does xn-1 mean? It just means "the previous term" because the term number (n) is 1 less (n-1).
So, if n was 6, then xn = x6 (the 6th term) and xn-1 = x6-1 = x5 (the 5th term)
So, let's apply that Rule to the 6th term:
x6 = x6-1 + x6-2
x6 = x5 + x4
We already know the 4th term is 13, and the 5th is 21, so the answer is:
x6 = 21 + 13 = 34
Pretty simple, just put numbers instead of "n"
Many Rules
One of the troubles with finding "the next number" in a sequence is that mathematics is so powerful we can find more than one Rule that works.
What is the next number in the sequence 1, 2, 4, 7, ?
Here are three solutions (there can be more!):

Solution 1: Add 1, then add 2, 3, 4, ...
So, 1+1=2, 2+2=4, 4+3=7, 7+4=11, etc...
Rule: xn = n(n-1)/2 + 1
Sequence: 1, 2, 4, 7, 11, 16, 22, ...
(That rule looks a bit complicated, but it works)

Solution 2: After 1 and 2, add the two previous numbers, plus 1:
Rule: xn = xn-1 + xn-2 + 1
Sequence: 1, 2, 4, 7, 12, 20, 33, ...

Solution 3: After 1, 2 and 4, add the three previous numbers
Rule: xn = xn-1 + xn-2 + xn-3
Sequence: 1, 2, 4, 7, 13, 24, 44, ...
So, we have three perfectly reasonable solutions, and they create totally different sequences.
Which is right? They are all right.

And there are other solutions it may be a list of the winners' numbers so the next number could be anything!

Simplest Rule
When in doubt choose the simplest rule that makes sense, but also mention that there are other solutions.
Finding Differences
Sometimes it helps to find the differences between each pair of numbers ... this can often reveal an underlying pattern.
Here is a simple case:
The differences are always 2, so we can guess that "2n" is part of the answer.

Let us try 2n:
n:
1
2
3
4
5
Terms (xn):
7
9
11
13
15
2n:
2
4
6
8
10
Wrong by:
5
5
5
5
5
The last row shows that we are always wrong by 5, so just add 5 and we are done:
Rule: xn = 2n + 5
OK, we could have worked out "2n+5" by just playing around with the numbers a bit, but we want a systematic way to do it, for when the sequences get more complicated.
Second Differences
In the sequence {1, 2, 4, 7, 11, 16, 22, ...} we need to find the differences and then find the differences of those (called second differences), like this:
The second differences in this case are 1.
With second differences we multiply by "n2 / 2".
 In our case the difference is 1, so let us try n2 / 2:
n:
1
2
3
4
5
Terms (xn):
1
2
4
7
11
n2:
1
4
9
16
25
n2 / 2:
0.5
2
4.5
8
12.5
Wrong by:
0.5
0
-0.5
-1
-1.5
We are close, but seem to be drifting by 0.5, so let us try: n2 / 2 - n/2
n2 / 2 - n/2:
0
1
3
6
10
Wrong by:
1
1
1
1
1
Wrong by 1 now, so let us add 1:
n2 / 2 - n/2 + 1:
1
2
4
7
11
Wrong by:
0
0
0
0
0
The formula n2 / 2 - n/2 + 1 can be simplified to n(n-1)/2 + 1
So by "trial-and-error" we discovered a rule that works:
Rule: xn = n(n-1)/2 + 1
Sequence: 1, 2, 4, 7, 11, 16, 22, 29, 37, ...

 Reference:

Sequence & Number Pattern Part 1

Sequences

What is a Sequence?

A Sequence is a list of things (usually numbers) that are in order.


Infinite or Finite
When the sequence goes on forever it is called an infinite sequence, otherwise it is a finite sequence
Examples:
{1, 2, 3, 4, ...} is a very simple sequence (and it is an infinite sequence)
{20, 25, 30, 35, ...} is also an infinite sequence
{1, 3, 5, 7} is the sequence of the first 4 odd numbers (and is a finite sequence)
{4, 3, 2, 1} is 4 to 1 backwards
{1, 2, 4, 8, 16, 32, ...} is an infinite sequence where every term doubles
{a, b, c, d, e} is the sequence of the first 5 letters alphabetically
{f, r, e, d} is the sequence of letters in the name "fred"
{0, 1, 0, 1, 0, 1, ...} is the sequence of alternating 0s and 1s (yes they are in order, it is an alternating order in this case)

In Order
When we say the terms are "in order", we are free to define what order that is! They could go forwards, backwards ... or they could alternate ... or any type of order we want!

Like a Set
A Sequence is like a Set, except:
  • the terms are in order (with Sets the order does not matter)
  •   the same value can appear many times (only once in Sets)

Example: {0, 1, 0, 1, 0, 1, ...} is the sequence of alternating 0s and 1s.
The set is just {0,1}


Notation
Sequences also use the same notation as sets:
list each element, separated by a comma,
and then put curly brackets around the whole thing.
{3, 5, 7, ...}

The curly brackets { } are sometimes called "set brackets" or "braces".


A Rule
A Sequence usually has a Rule, which is a way to find the value of each term.

Example: the sequence {3, 5, 7, 9, ...} starts at 3 and jumps 2 every time:


As a Formula
Saying "starts at 3 and jumps 2 every time" is fine, but it doesn't help us calculate the:
·         10th term,
·         100th term, or
·         nth term, where n could be any term number we want.
So, we want a formula with "n" in it (where n is any term number).
So, What Can A Rule For {3, 5, 7, 9, ...} Be?
Firstly, we can see the sequence goes up 2 every time, so we can guess that a Rule is something like "2 times n" (where "n" is the term number). Let's test it out:
Test Rule: 2n
n
Term
Test Rule
1
3
2n = 2×1 = 2
2
5
2n = 2×2 = 4
3
7
2n = 2×3 = 6
That nearly worked ... but it is too low by 1 every time, so let us try changing it to:
Test Rule: 2n+1
n
Term
Test Rule
1
3
2n+1 = 2×1 + 1 = 3
2
5
2n+1 = 2×+ 1 = 5
3
7
2n+1 = 2×3 + 1 = 7
That Works!
So instead of saying "starts at 3 and jumps 2 every time" we write this:
2n+1
Now we can calculate, for example, the 100th term:
2 × 100 + 1 = 201


Many Rules
But mathematics is so powerful we can find more than one Rule that works for any sequence.
Example: the sequence {3, 5, 7, 9, ...}
We have just shown a Rule for {3, 5, 7, 9, ...} is: 2n+1
And so we get: {3, 5, 7, 9, 11, 13, ...}
But can we find another rule?
How about "odd numbers without a 1 in them":
And we get: {3, 5, 7, 9, 23, 25, ...}
A completely different sequence!
And we could find more rules that match {3, 5, 7, 9, ...}. Really we could.
 So it is best to say "A Rule" rather then "The Rule" (unless we know it is the right Rule).

Notation
To make it easier to use rules, we often use this special style:
·         xn is the term
·         n is the term number

Example: to mention the "5th term" we write: x5
So a rule for {3, 5, 7, 9, ...} can be written as an equation like this:
xn = 2n+1
And to calculate the 10th term we can write:
x10 = 2n+1 = 2×10+1 = 21
Can you calculate x50 (the 50th term) doing this?
Here is another example:
Example: Calculate the first 4 terms of this sequence:
{an} = { (-1/n)n }
Calculations:
·         a1 = (-1/1)1 = -1
·         a2 = (-1/2)2 = 1/4
·         a3 = (-1/3)3 = -1/27
·         a4 = (-1/4)4 = 1/256
Answer:
{an} = { -1, 1/4, -1/27, 1/256, ... }

Reference;