19
TASK 4: Sequences, Mathematical Induction and Recursion

Task4 present

Embed Size (px)

Citation preview

Page 1: Task4 present

TASK 4:Sequences,

Mathematical Induction and Recursion

Page 2: Task4 present

Definition :

ordered set of mathematical objects.

SEQUENCES

Page 3: Task4 present

Find the sum of all the integers from 1 to 1000.

The sequence of integers starting from 1 to 1000 is given by 

1 , 2 , 3 , 4 , ... , 1000 

The above sequence has 1000 terms. The first term is 1 and the last term is 1000 and the common difference is equal to 1. We have the formula that gives the sum of the first n terms of an arithmetic sequence knowing the first and last term of the sequence and the number of terms (see formula above). 

s1000 = 1000 (1 + 1000) / 2 = 500500

EXAMPLE PROBLEM

Page 4: Task4 present

Sequeance

Arithmetic Sequences

Geometric Sequences

Special Integers

Sequence

TYPE OF SEQUENCE

Page 5: Task4 present

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

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

WHAT IS ARITHMETIC SEQUENCE

Page 6: Task4 present

In General you 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")

Page 7: Task4 present

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

In General you could 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")

Geometric Sequence

Page 8: Task4 present

• This Triangular Number Sequence is generated from a pattern of dots which form a triangle.

Triangular Numbers

• Square numbers, better known as perfect squares, are an integer which is the product of that integer with itself.

Square Numbers

• The Fibonacci Sequence is found by adding the two numbers before it together. 

Fibonacci Numbers

• A cube number sequence is a mathematical sequence consisting of a sequence in which the next term originates by multiplying the number 3 times with itself, or in other words, raising it to the power of three

Cube Numbers

SPECIAL INTEGER SEQUENCE

Page 9: Task4 present

An example of this type of number sequence could be the following:

1,   3,   6,   10,   15,   21,   28,   36,   45,   …

This sequence is generated from a pattern of dots which form a triangle. By adding another row of dots and counting all the dots we can find the next number of the sequence.

Triangular Numbers

Page 10: Task4 present

Continue….

Page 11: Task4 present

1,   4,   9,   16,   25,   36,   49,   64,   81,   …

The next number is made by squaring where it is in the pattern. 

The second number is 2 squared (22 or 2×2) 

The seventh number is 7 squared (72 or 7×7) etc

Square Numbers

Page 12: Task4 present

0,   1,   1,   2,   3,   5,   8,   13,   21,   34,   …

The Fibonacci Sequence is found by adding the two numbers before it together. 

The 2 is found by adding the two numbers before it (1+1) 

The 21 is found by adding the two numbers before it (8+13) 

The next number in the sequence above would be 55 (21+34)

Fibonacci Numbers

Page 13: Task4 present

1,   8,   27,   64,   125,   216,   343,   512,   729,   …

The next number is made by cubing where it is in the pattern. 

The second number is 2 cubed (23 or 2×2×2) 

The seventh number is 7 cubed (73 or 7×7×7) etc

Cube Numbers

Page 14: Task4 present

Give 1 example sequences use in computer programming

Sequence in computer programming is the default control structure, instructions are executed one after another. They might, for example, carry out a series of arithmetic operations, assigning results to variables

 

Example:-

Make a list number of 100 students that attend “seminar keusahawanan”.

 

Pseudocode

BEGIN

Declare a list as an array with 100 elements

for (int student = 0, student<100; student++){

list[student] = student + 1 (arithmetic operation)

print list[student]

}

END

Page 15: Task4 present

Answer:

No.Student = 0

Print list[student] = 1

No.Student = 1

Print list[student] = 2

.

.

.

.

Print list[student] = 99

No.Student = 100

Page 16: Task4 present

Source Code

public class sequences {

public static void main(String[] args) {

int list [] = new int[100];

for(int student = 0; student<100; student++) {

list[student] = student + 1;

System.out.println(list[student]);

}

}

 

}

Page 17: Task4 present

PRINCIPLE OF MATHEMATICAL INDUCTION

To prove that P(n) is true for all positive integers n, where P(n) is a propositional funtion

METHOD OF PROOF

1) BASIS STEP: We verify that P(1) is true.

2) INDUCTIVE STEP: We show that the conditional statement

P(k) → P(k + 1) is true for all positive

integers k.

PRINCIPLE OF MATHEMATICAL INDUCTION &

METHOD OF PROOF

Page 18: Task4 present

Problem1:

Show that if n is a positive integer, then

1 + 2 + ... + n = n(n + 1)/2.

BASIC STEP: P(1),

1 = 1(1 + 1)/2

1 =1 (RHS=LHS)

INDUCTIVE STEP: we assume that 1 + 2 + ... + k = k(k + 1)/2

it must be shown that P(k + 1) is true,

1 + 2 + ... + k + ( k +1) = (k + 1)[( k+ 1) (k +1) + 1] /2 = (k + 1)(k + 2)/ 2

Add k +1 to both sides of the equation P(k)

1 + 2 + ... + k + (k +1) = k(k +1) /2 + (k +1)

= k(k +1 ) + 2 (k +1 )/2

= (k + 1) (k + 2)/2

Page 19: Task4 present

Problem 2:

For all n≥0

= n(n+1)(2n+1)/6

Basis:

=0

Induction:

= [n+1][(n+1)+1][2(n+1)+1]/6

= (2n3 +3n +n)/6

= (2n3 +9n +13n+6)/6

() + (n+1) = (2n3 +9n +13n+6)/6

(2n3 +3n +n)/6 + n +2n+1 = (2n3 +9n +13n+6)/6