Mathematics for Computer Science
The key concepts of sequences, series, and the principle of mathematical induction taught by Coursera.
Sequences
The sequence is a collection of numbers that follows a pattern. For examples:
Generating even numbers:
First term:
2, 4, 6, 8…
Generating odd numbers:
Third term:
1, 3, 5, 7…
Other sequence examples:
Fourth term:
1, 4, 9, 16…
Third term:
1, 3, 7, 13…
Defining an Arithmetic Sequence
The arithmetic sequence is the sequence where the common difference remains constant between any two successive terms. And it’s entirely defined by two things:
-
The first term, we always call that
so if
-
The common difference
, it is the difference number in a list
How to find a and d when the question asks you to calculate for “1,3,5,… find 8th term”?
so for example 1,3,5,7,9,…, is 1 (base), is 2. To find the term:
The pattern:
First term:
Second term:
Third term:
Forth term:
and so on…
you will see why the first 1st and 2nd terms always wrote like that as you calculate on the paper…
(because it’s easier for the questions to solve the problems in the beginning)
Arithmetic Sequence, the term is always given by:
Arithmetic Sequence Example
Generating a sequence of arithmetic sequence by , .
The sequence: 3, -1, -5, -9, -13…
Defining a Geometric Sequence
Rather than adding the same amount every time the geometric sequence multiply by the same amount every time.
We use and (common ratio), not (common difference) anymore.
Terms:
Geometric Sequence, the term is always given by:
Geometric Sequence Example
Generating a sequence of geometric sequence by a = , r =
The sequence: 1, 2, 4, 8, 16, 32…
Divergent Series
if , it must be abf7f7a6;">divergent series as it goes infinite. For example, think of and you keep multiplying it. As it seems, it can be continued to infinity.
limit
Convergent Series
Take the sequence That is, the sequence which goes It is a convergent sequence, its limit is 1.
This is convergent:
limit
And, this is divergent:
limit
Recursion
Recursion is when a function calls itself and build up a sequence of numbers based on using that function repetitively.
Example
The example formula is given as follows:
- …
Fibonacci Sequence
Fibonacci sequence is one of examples that is used in recursions.
The course defined:
It’s originally defined as:
Mine defined:
The Fibonacci Sequence:
Golden Ratio
limit:
Sequences in the Tests
In the questions, sequences can be customised and they’ll ask for the term, like this:
Question 1, if , find .
Series
Think of generating natural numbers , and it goes like this 1,2,3,4,…
Assume we want to find the sum of these numbers and it’s simple:
Before that we want to sum for the first 4 numbers in this series, the Sigma Notation is used to represent the sum of a series of terms.
In sigma notation
- The number below represents the adccffa6;">starting index of the series.
- The number at the top represents the adccffa6;">ending index of the series.
- represents how much number you will be summing each numbers between the starting index and ending index of the series.
In the right-hand side
- It just shows the summation that can be also be calculated in this way on the paper.
Mathematical Induction
The purpose of mathematical induction is a method used to prove that a statement holds true for all natural numbers. There’re two important things:
- Base Case: Prove the statement is true for the first term (usually or ).
- Inductive Step: Assume the statement is true for (inductive hypothesis), and then prove it’s also true for .
In CS, inductive proofs are used to prove that the recursive algorithms work correctly.
It's just like "Domino Tiles"
you have a set of domino tiles, to make sure all the tiles fall down, you first have to knock the first one. Assume some domino tiles in the middle of a set, and . If you knock the tile to fall down, this falling down will knock also the tile .
Previously, we use this for a summation of natural numbers:
Seeing if it’s true for :
Which is true
Assume if it’s true for :
Remember, if this current one is true, you have to prove the next is also true, so,
Now, let’s prove it step by step :
Therefore, the formula holds true for
An Algebra Skill You Need to Remember
When you prove the statements by calculating expressions, you may need Quadratic Factoring.
Think of :
- Think of how can you get that by multiplying some numbers. So in this case, .
- Then, think of how can you get after multiplying. So now, add them .
- All good now, we will use .
- So, the answer will be:
, and will switch numbers to find the value of .
and , remember you get opposite value when you switch over the equal.
The simplified explanation:
The answer: