80
Outline Functions, Domain, Codomain, Range One-to-one and Onto function Composition function and Inverse function Mathematical function Sequence and Summation Recursively defined functions Algorithms and Function Cardinality Functions and Algorithms Math 301 Dr. Nahid Sultana October 5, 2012 Math 301 Functions and Algorithms

Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

Embed Size (px)

Citation preview

Page 1: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

Functions and Algorithms

Math 301

Dr. Nahid Sultana

October 5, 2012

Math 301 Functions and Algorithms

Page 2: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

Functions, Domain, Codomain, Range

One-to-one and Onto function

Composition function and Inverse function

Mathematical functionFloor and ceiling functionInteger remainderExponential and logarithmic functions

Sequence and SummationSequenceSummationIndexed collection of sets

Recursively defined functions

Algorithms and Function

Cardinality

Math 301 Functions and Algorithms

Page 3: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I Definition: A function is a rule that for every input assign aspecific output.

I Think function as a machine in which each input producesexactly one output.

I Suppose A and B are two sets. A function f : A→ B is a rulethat for every element a ∈ A assign a single value f (a) from B.

I A is called the domain of the function f .

I B is called the codomain of the function f .

I f (a) is called the image of a.

I the set of all image values is called the range of f .

Math 301 Functions and Algorithms

Page 4: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I Definition: A function is a rule that for every input assign aspecific output.

I Think function as a machine in which each input producesexactly one output.

I Suppose A and B are two sets. A function f : A→ B is a rulethat for every element a ∈ A assign a single value f (a) from B.

I A is called the domain of the function f .

I B is called the codomain of the function f .

I f (a) is called the image of a.

I the set of all image values is called the range of f .

Math 301 Functions and Algorithms

Page 5: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I Definition: A function is a rule that for every input assign aspecific output.

I Think function as a machine in which each input producesexactly one output.

I Suppose A and B are two sets. A function f : A→ B is a rulethat for every element a ∈ A assign a single value f (a) from B.

I A is called the domain of the function f .

I B is called the codomain of the function f .

I f (a) is called the image of a.

I the set of all image values is called the range of f .

Math 301 Functions and Algorithms

Page 6: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I Definition: A function is a rule that for every input assign aspecific output.

I Think function as a machine in which each input producesexactly one output.

I Suppose A and B are two sets. A function f : A→ B is a rulethat for every element a ∈ A assign a single value f (a) from B.

I A is called the domain of the function f .

I B is called the codomain of the function f .

I f (a) is called the image of a.

I the set of all image values is called the range of f .

Math 301 Functions and Algorithms

Page 7: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I Definition: A function is a rule that for every input assign aspecific output.

I Think function as a machine in which each input producesexactly one output.

I Suppose A and B are two sets. A function f : A→ B is a rulethat for every element a ∈ A assign a single value f (a) from B.

I A is called the domain of the function f .

I B is called the codomain of the function f .

I f (a) is called the image of a.

I the set of all image values is called the range of f .

Math 301 Functions and Algorithms

Page 8: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I Definition: A function is a rule that for every input assign aspecific output.

I Think function as a machine in which each input producesexactly one output.

I Suppose A and B are two sets. A function f : A→ B is a rulethat for every element a ∈ A assign a single value f (a) from B.

I A is called the domain of the function f .

I B is called the codomain of the function f .

I f (a) is called the image of a.

I the set of all image values is called the range of f .

Math 301 Functions and Algorithms

Page 9: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I Functions as relations: A function f : A→ B is a relationfrom A to B such that each a ∈ A belongs to unique orderedpair (a, b) in f .

I Example: A = {1, 2, 3} and B = {x , y , z ,w}

f1 = {(1, y), (2,w), (3, y)}

f2 = {(1, x), (2, x), (3, y), (2, z)}

f3 = {(1, z), (3, x)}

I Example: f (x) = 3x − 4.

I Two functions f : A→ B and g : A→ B will be equal iff (a) = g(a) for all a ∈ A.

Math 301 Functions and Algorithms

Page 10: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I Functions as relations: A function f : A→ B is a relationfrom A to B such that each a ∈ A belongs to unique orderedpair (a, b) in f .

I Example: A = {1, 2, 3} and B = {x , y , z ,w}

f1 = {(1, y), (2,w), (3, y)}

f2 = {(1, x), (2, x), (3, y), (2, z)}

f3 = {(1, z), (3, x)}

I Example: f (x) = 3x − 4.

I Two functions f : A→ B and g : A→ B will be equal iff (a) = g(a) for all a ∈ A.

Math 301 Functions and Algorithms

Page 11: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I Functions as relations: A function f : A→ B is a relationfrom A to B such that each a ∈ A belongs to unique orderedpair (a, b) in f .

I Example: A = {1, 2, 3} and B = {x , y , z ,w}

f1 = {(1, y), (2,w), (3, y)}

f2 = {(1, x), (2, x), (3, y), (2, z)}

f3 = {(1, z), (3, x)}

I Example: f (x) = 3x − 4.

I Two functions f : A→ B and g : A→ B will be equal iff (a) = g(a) for all a ∈ A.

Math 301 Functions and Algorithms

Page 12: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I Functions as relations: A function f : A→ B is a relationfrom A to B such that each a ∈ A belongs to unique orderedpair (a, b) in f .

I Example: A = {1, 2, 3} and B = {x , y , z ,w}

f1 = {(1, y), (2,w), (3, y)}

f2 = {(1, x), (2, x), (3, y), (2, z)}

f3 = {(1, z), (3, x)}

I Example: f (x) = 3x − 4.

I Two functions f : A→ B and g : A→ B will be equal iff (a) = g(a) for all a ∈ A.

Math 301 Functions and Algorithms

Page 13: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I A function is said to be one-to-one (injective) if differentelements in the domain have distinct images.

I A function f : A→ B is said to be one-to-one iff (a1) = f (a2) implies a1 = a2.

I Graphical Example.I Example: f (x) = x2 and f (x) = x3.I Example: f (x) = 3x − 5 is one-to-one.I Onto: Each element of the codomain is the output/image of

some element of the domain.I A function f : A→ B is onto (surjective) if the range of f is

the entire codomain. i.e. if f (A) = B.I The function f is called one-to-one correspondence (or

bijective) if it is both one-to-one and onto.I Graphical Examples.

Math 301 Functions and Algorithms

Page 14: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I A function is said to be one-to-one (injective) if differentelements in the domain have distinct images.

I A function f : A→ B is said to be one-to-one iff (a1) = f (a2) implies a1 = a2.

I Graphical Example.I Example: f (x) = x2 and f (x) = x3.I Example: f (x) = 3x − 5 is one-to-one.I Onto: Each element of the codomain is the output/image of

some element of the domain.I A function f : A→ B is onto (surjective) if the range of f is

the entire codomain. i.e. if f (A) = B.I The function f is called one-to-one correspondence (or

bijective) if it is both one-to-one and onto.I Graphical Examples.

Math 301 Functions and Algorithms

Page 15: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I A function is said to be one-to-one (injective) if differentelements in the domain have distinct images.

I A function f : A→ B is said to be one-to-one iff (a1) = f (a2) implies a1 = a2.

I Graphical Example.I Example: f (x) = x2 and f (x) = x3.

I Example: f (x) = 3x − 5 is one-to-one.I Onto: Each element of the codomain is the output/image of

some element of the domain.I A function f : A→ B is onto (surjective) if the range of f is

the entire codomain. i.e. if f (A) = B.I The function f is called one-to-one correspondence (or

bijective) if it is both one-to-one and onto.I Graphical Examples.

Math 301 Functions and Algorithms

Page 16: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I A function is said to be one-to-one (injective) if differentelements in the domain have distinct images.

I A function f : A→ B is said to be one-to-one iff (a1) = f (a2) implies a1 = a2.

I Graphical Example.I Example: f (x) = x2 and f (x) = x3.I Example: f (x) = 3x − 5 is one-to-one.

I Onto: Each element of the codomain is the output/image ofsome element of the domain.

I A function f : A→ B is onto (surjective) if the range of f isthe entire codomain. i.e. if f (A) = B.

I The function f is called one-to-one correspondence (orbijective) if it is both one-to-one and onto.

I Graphical Examples.

Math 301 Functions and Algorithms

Page 17: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I A function is said to be one-to-one (injective) if differentelements in the domain have distinct images.

I A function f : A→ B is said to be one-to-one iff (a1) = f (a2) implies a1 = a2.

I Graphical Example.I Example: f (x) = x2 and f (x) = x3.I Example: f (x) = 3x − 5 is one-to-one.I Onto: Each element of the codomain is the output/image of

some element of the domain.

I A function f : A→ B is onto (surjective) if the range of f isthe entire codomain. i.e. if f (A) = B.

I The function f is called one-to-one correspondence (orbijective) if it is both one-to-one and onto.

I Graphical Examples.

Math 301 Functions and Algorithms

Page 18: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I A function is said to be one-to-one (injective) if differentelements in the domain have distinct images.

I A function f : A→ B is said to be one-to-one iff (a1) = f (a2) implies a1 = a2.

I Graphical Example.I Example: f (x) = x2 and f (x) = x3.I Example: f (x) = 3x − 5 is one-to-one.I Onto: Each element of the codomain is the output/image of

some element of the domain.I A function f : A→ B is onto (surjective) if the range of f is

the entire codomain. i.e. if f (A) = B.

I The function f is called one-to-one correspondence (orbijective) if it is both one-to-one and onto.

I Graphical Examples.

Math 301 Functions and Algorithms

Page 19: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I A function is said to be one-to-one (injective) if differentelements in the domain have distinct images.

I A function f : A→ B is said to be one-to-one iff (a1) = f (a2) implies a1 = a2.

I Graphical Example.I Example: f (x) = x2 and f (x) = x3.I Example: f (x) = 3x − 5 is one-to-one.I Onto: Each element of the codomain is the output/image of

some element of the domain.I A function f : A→ B is onto (surjective) if the range of f is

the entire codomain. i.e. if f (A) = B.I The function f is called one-to-one correspondence (or

bijective) if it is both one-to-one and onto.

I Graphical Examples.

Math 301 Functions and Algorithms

Page 20: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I A function is said to be one-to-one (injective) if differentelements in the domain have distinct images.

I A function f : A→ B is said to be one-to-one iff (a1) = f (a2) implies a1 = a2.

I Graphical Example.I Example: f (x) = x2 and f (x) = x3.I Example: f (x) = 3x − 5 is one-to-one.I Onto: Each element of the codomain is the output/image of

some element of the domain.I A function f : A→ B is onto (surjective) if the range of f is

the entire codomain. i.e. if f (A) = B.I The function f is called one-to-one correspondence (or

bijective) if it is both one-to-one and onto.I Graphical Examples.

Math 301 Functions and Algorithms

Page 21: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I A composition function can be thought of as combination oftwo functions.

I The composition of two given function f and g is denoted byf ◦ g and written as

(f ◦ g)(x) = f (g(x))

I Example: f (x) = 2x − 1 and g(x) = x3 − 5, Find (f ◦ g)(3).

Math 301 Functions and Algorithms

Page 22: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I A composition function can be thought of as combination oftwo functions.

I The composition of two given function f and g is denoted byf ◦ g and written as

(f ◦ g)(x) = f (g(x))

I Example: f (x) = 2x − 1 and g(x) = x3 − 5, Find (f ◦ g)(3).

Math 301 Functions and Algorithms

Page 23: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I A composition function can be thought of as combination oftwo functions.

I The composition of two given function f and g is denoted byf ◦ g and written as

(f ◦ g)(x) = f (g(x))

I Example: f (x) = 2x − 1 and g(x) = x3 − 5, Find (f ◦ g)(3).

Math 301 Functions and Algorithms

Page 24: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I Suppose f (x) and g(x) are two bijective functions. If(f ◦ g)(x) = x and (g ◦ f )(x) = x , then we say that f (x) andg(x) are inverse of each other. i.e

f (x) = g−1(x) and g(x) = f −1(x)

I A function that has an inverse is called invertible.

I Theorem: A function f : A→ B is invertible iff f is abijective function.

I Notes:I f(x) must be bijectiveI f −1(x) does not mean 1

f (x)

I Domain of f −1 = Range of fI Range of f −1 = Domain of f

Math 301 Functions and Algorithms

Page 25: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I Suppose f (x) and g(x) are two bijective functions. If(f ◦ g)(x) = x and (g ◦ f )(x) = x , then we say that f (x) andg(x) are inverse of each other. i.e

f (x) = g−1(x) and g(x) = f −1(x)

I A function that has an inverse is called invertible.

I Theorem: A function f : A→ B is invertible iff f is abijective function.

I Notes:I f(x) must be bijectiveI f −1(x) does not mean 1

f (x)

I Domain of f −1 = Range of fI Range of f −1 = Domain of f

Math 301 Functions and Algorithms

Page 26: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I Suppose f (x) and g(x) are two bijective functions. If(f ◦ g)(x) = x and (g ◦ f )(x) = x , then we say that f (x) andg(x) are inverse of each other. i.e

f (x) = g−1(x) and g(x) = f −1(x)

I A function that has an inverse is called invertible.

I Theorem: A function f : A→ B is invertible iff f is abijective function.

I Notes:I f(x) must be bijectiveI f −1(x) does not mean 1

f (x)

I Domain of f −1 = Range of fI Range of f −1 = Domain of f

Math 301 Functions and Algorithms

Page 27: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I Suppose f (x) and g(x) are two bijective functions. If(f ◦ g)(x) = x and (g ◦ f )(x) = x , then we say that f (x) andg(x) are inverse of each other. i.e

f (x) = g−1(x) and g(x) = f −1(x)

I A function that has an inverse is called invertible.

I Theorem: A function f : A→ B is invertible iff f is abijective function.

I Notes:I f(x) must be bijectiveI f −1(x) does not mean 1

f (x)

I Domain of f −1 = Range of fI Range of f −1 = Domain of f

Math 301 Functions and Algorithms

Page 28: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I Example: Is f (x) = x2 is invertible.

I Example: Find the inverse function of f (x) = 3x − 7.

Math 301 Functions and Algorithms

Page 29: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I Example: Is f (x) = x2 is invertible.

I Example: Find the inverse function of f (x) = 3x − 7.

Math 301 Functions and Algorithms

Page 30: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

Floor and ceiling functionInteger remainderExponential and logarithmic functions

I Definition: The floor of a real number x is the biggestinteger which is smaller or equal to x , is denoted by bxc.

I Example: 3.14, -8.5

I Definition: The ceiling of a real number x is the smallestinteger which is greater or equal to x , is denoted by dxe.

I Example: 3.14, -8.5

I Definition: The integer value of a real number x converts xinto an integer by deleting the fractional part of the number,Written as INT(x).

I Example: 3.14, -8.5, 7

I The absolute value of a real number x , written as ABS(x) |x |I Example: -15, 7, -3.33

Math 301 Functions and Algorithms

Page 31: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

Floor and ceiling functionInteger remainderExponential and logarithmic functions

I Definition: The floor of a real number x is the biggestinteger which is smaller or equal to x , is denoted by bxc.

I Example: 3.14, -8.5

I Definition: The ceiling of a real number x is the smallestinteger which is greater or equal to x , is denoted by dxe.

I Example: 3.14, -8.5

I Definition: The integer value of a real number x converts xinto an integer by deleting the fractional part of the number,Written as INT(x).

I Example: 3.14, -8.5, 7

I The absolute value of a real number x , written as ABS(x) |x |I Example: -15, 7, -3.33

Math 301 Functions and Algorithms

Page 32: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

Floor and ceiling functionInteger remainderExponential and logarithmic functions

I Definition: The floor of a real number x is the biggestinteger which is smaller or equal to x , is denoted by bxc.

I Example: 3.14, -8.5

I Definition: The ceiling of a real number x is the smallestinteger which is greater or equal to x , is denoted by dxe.

I Example: 3.14, -8.5

I Definition: The integer value of a real number x converts xinto an integer by deleting the fractional part of the number,Written as INT(x).

I Example: 3.14, -8.5, 7

I The absolute value of a real number x , written as ABS(x) |x |I Example: -15, 7, -3.33

Math 301 Functions and Algorithms

Page 33: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

Floor and ceiling functionInteger remainderExponential and logarithmic functions

I Definition: The floor of a real number x is the biggestinteger which is smaller or equal to x , is denoted by bxc.

I Example: 3.14, -8.5

I Definition: The ceiling of a real number x is the smallestinteger which is greater or equal to x , is denoted by dxe.

I Example: 3.14, -8.5

I Definition: The integer value of a real number x converts xinto an integer by deleting the fractional part of the number,Written as INT(x).

I Example: 3.14, -8.5, 7

I The absolute value of a real number x , written as ABS(x) |x |I Example: -15, 7, -3.33

Math 301 Functions and Algorithms

Page 34: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

Floor and ceiling functionInteger remainderExponential and logarithmic functions

I Let k be any integer and M be a positive integer then

k(mod M)

denote the integer remainder when k is divided by M.

I Example: 25(mod 7), 25(mod 5)

I If k is negative then k(mod M) = M − r ′, where r ′ is theremainder when |k | is divided by M.

I Example: −26(mod 7)

Math 301 Functions and Algorithms

Page 35: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

Floor and ceiling functionInteger remainderExponential and logarithmic functions

I Let k be any integer and M be a positive integer then

k(mod M)

denote the integer remainder when k is divided by M.

I Example: 25(mod 7), 25(mod 5)

I If k is negative then k(mod M) = M − r ′, where r ′ is theremainder when |k | is divided by M.

I Example: −26(mod 7)

Math 301 Functions and Algorithms

Page 36: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

Floor and ceiling functionInteger remainderExponential and logarithmic functions

I Let k be any integer and M be a positive integer then

k(mod M)

denote the integer remainder when k is divided by M.

I Example: 25(mod 7), 25(mod 5)

I If k is negative then k(mod M) = M − r ′, where r ′ is theremainder when |k | is divided by M.

I Example: −26(mod 7)

Math 301 Functions and Algorithms

Page 37: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

Floor and ceiling functionInteger remainderExponential and logarithmic functions

I Let k be any integer and M be a positive integer then

k(mod M)

denote the integer remainder when k is divided by M.

I Example: 25(mod 7), 25(mod 5)

I If k is negative then k(mod M) = M − r ′, where r ′ is theremainder when |k | is divided by M.

I Example: −26(mod 7)

Math 301 Functions and Algorithms

Page 38: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

Floor and ceiling functionInteger remainderExponential and logarithmic functions

I Integer exponents

a.a.a.....a︸ ︷︷ ︸n times

= an, where a and n are both positive integers

I Exponential function

f (x) = ax , where a is positive integer and x is real number

I Logarithmic function: The logarithm of any positive numberx to base b is written as

logbx

I Natural logarithm is the logarithm to the base e

logex or ln(x)

I Exponential and logarithmic functions are inverse of eachother

e ln(x) = x and ln(ex) = x if x > 0

Math 301 Functions and Algorithms

Page 39: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

Floor and ceiling functionInteger remainderExponential and logarithmic functions

I Integer exponents

a.a.a.....a︸ ︷︷ ︸n times

= an, where a and n are both positive integers

I Exponential function

f (x) = ax , where a is positive integer and x is real number

I Logarithmic function: The logarithm of any positive numberx to base b is written as

logbx

I Natural logarithm is the logarithm to the base e

logex or ln(x)

I Exponential and logarithmic functions are inverse of eachother

e ln(x) = x and ln(ex) = x if x > 0

Math 301 Functions and Algorithms

Page 40: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

Floor and ceiling functionInteger remainderExponential and logarithmic functions

I Integer exponents

a.a.a.....a︸ ︷︷ ︸n times

= an, where a and n are both positive integers

I Exponential function

f (x) = ax , where a is positive integer and x is real number

I Logarithmic function: The logarithm of any positive numberx to base b is written as

logbx

I Natural logarithm is the logarithm to the base e

logex or ln(x)

I Exponential and logarithmic functions are inverse of eachother

e ln(x) = x and ln(ex) = x if x > 0

Math 301 Functions and Algorithms

Page 41: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

Floor and ceiling functionInteger remainderExponential and logarithmic functions

I Integer exponents

a.a.a.....a︸ ︷︷ ︸n times

= an, where a and n are both positive integers

I Exponential function

f (x) = ax , where a is positive integer and x is real number

I Logarithmic function: The logarithm of any positive numberx to base b is written as

logbx

I Natural logarithm is the logarithm to the base e

logex or ln(x)

I Exponential and logarithmic functions are inverse of eachother

e ln(x) = x and ln(ex) = x if x > 0

Math 301 Functions and Algorithms

Page 42: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

Floor and ceiling functionInteger remainderExponential and logarithmic functions

I Integer exponents

a.a.a.....a︸ ︷︷ ︸n times

= an, where a and n are both positive integers

I Exponential function

f (x) = ax , where a is positive integer and x is real number

I Logarithmic function: The logarithm of any positive numberx to base b is written as

logbx

I Natural logarithm is the logarithm to the base e

logex or ln(x)

I Exponential and logarithmic functions are inverse of eachother

e ln(x) = x and ln(ex) = x if x > 0Math 301 Functions and Algorithms

Page 43: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

SequenceSummationIndexed collection of sets

I A sequence is a discrete structure used to represent anordered list.

I A sequence is a function f : N→ A.

I A sequence is usually denoted by

a1, a2, a3, .... or {an} or {an}∞n=1

I a1, a2, a3, ...an, finite sequence

I Example: {an}, where an = 1/n.

I Example: 3, 8, 13, 18, .....

I A formula that refers to previous terms to define the nextterm is called recursive.

I Example: 1, 4, 9, 16, 25, .....

Math 301 Functions and Algorithms

Page 44: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

SequenceSummationIndexed collection of sets

I A sequence is a discrete structure used to represent anordered list.

I A sequence is a function f : N→ A.

I A sequence is usually denoted by

a1, a2, a3, .... or {an} or {an}∞n=1

I a1, a2, a3, ...an, finite sequence

I Example: {an}, where an = 1/n.

I Example: 3, 8, 13, 18, .....

I A formula that refers to previous terms to define the nextterm is called recursive.

I Example: 1, 4, 9, 16, 25, .....

Math 301 Functions and Algorithms

Page 45: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

SequenceSummationIndexed collection of sets

I A sequence is a discrete structure used to represent anordered list.

I A sequence is a function f : N→ A.

I A sequence is usually denoted by

a1, a2, a3, .... or {an} or {an}∞n=1

I a1, a2, a3, ...an, finite sequence

I Example: {an}, where an = 1/n.

I Example: 3, 8, 13, 18, .....

I A formula that refers to previous terms to define the nextterm is called recursive.

I Example: 1, 4, 9, 16, 25, .....

Math 301 Functions and Algorithms

Page 46: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

SequenceSummationIndexed collection of sets

I A sequence is a discrete structure used to represent anordered list.

I A sequence is a function f : N→ A.

I A sequence is usually denoted by

a1, a2, a3, .... or {an} or {an}∞n=1

I a1, a2, a3, ...an, finite sequence

I Example: {an}, where an = 1/n.

I Example: 3, 8, 13, 18, .....

I A formula that refers to previous terms to define the nextterm is called recursive.

I Example: 1, 4, 9, 16, 25, .....

Math 301 Functions and Algorithms

Page 47: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

SequenceSummationIndexed collection of sets

I A sequence is a discrete structure used to represent anordered list.

I A sequence is a function f : N→ A.

I A sequence is usually denoted by

a1, a2, a3, .... or {an} or {an}∞n=1

I a1, a2, a3, ...an, finite sequence

I Example: {an}, where an = 1/n.

I Example: 3, 8, 13, 18, .....

I A formula that refers to previous terms to define the nextterm is called recursive.

I Example: 1, 4, 9, 16, 25, .....

Math 301 Functions and Algorithms

Page 48: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

SequenceSummationIndexed collection of sets

I A sequence is a discrete structure used to represent anordered list.

I A sequence is a function f : N→ A.

I A sequence is usually denoted by

a1, a2, a3, .... or {an} or {an}∞n=1

I a1, a2, a3, ...an, finite sequence

I Example: {an}, where an = 1/n.

I Example: 3, 8, 13, 18, .....

I A formula that refers to previous terms to define the nextterm is called recursive.

I Example: 1, 4, 9, 16, 25, .....

Math 301 Functions and Algorithms

Page 49: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

SequenceSummationIndexed collection of sets

I A sequence is a discrete structure used to represent anordered list.

I A sequence is a function f : N→ A.

I A sequence is usually denoted by

a1, a2, a3, .... or {an} or {an}∞n=1

I a1, a2, a3, ...an, finite sequence

I Example: {an}, where an = 1/n.

I Example: 3, 8, 13, 18, .....

I A formula that refers to previous terms to define the nextterm is called recursive.

I Example: 1, 4, 9, 16, 25, .....

Math 301 Functions and Algorithms

Page 50: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

SequenceSummationIndexed collection of sets

I Summation:

n∑j=1

aj = a1 + a2 + a3 + ....+ an

n∑j=m

aj = am + am+1 + am+2 + ....+ an

Here j is called the dummy index of summation.

I Example: What is the value of∑5

j=1 j2.

Math 301 Functions and Algorithms

Page 51: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

SequenceSummationIndexed collection of sets

I Summation:

n∑j=1

aj = a1 + a2 + a3 + ....+ an

n∑j=m

aj = am + am+1 + am+2 + ....+ an

Here j is called the dummy index of summation.

I Example: What is the value of∑5

j=1 j2.

Math 301 Functions and Algorithms

Page 52: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

SequenceSummationIndexed collection of sets

I A non empty set I , called an index set, is used to select thesets we want to consider.

I {Sα}α∈I describe the collection of all sets Sα, called theindexed collection of sets.

I The union of the sets in {Sα}α∈I is defined as⋃α∈I

Sα = {x |x ∈ Sα for some α ∈ I}

I The intersection of the sets in {Sα}α∈I is defined as⋂α∈I

Sα = {x |x ∈ Sα for all α ∈ I}

I Example: Suppose Sn = {n, 2n}, where n is a positiveinteger. Compute

⋃α∈I Sα, where I = {1, 2, 4}.

Math 301 Functions and Algorithms

Page 53: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

SequenceSummationIndexed collection of sets

I A non empty set I , called an index set, is used to select thesets we want to consider.

I {Sα}α∈I describe the collection of all sets Sα, called theindexed collection of sets.

I The union of the sets in {Sα}α∈I is defined as⋃α∈I

Sα = {x |x ∈ Sα for some α ∈ I}

I The intersection of the sets in {Sα}α∈I is defined as⋂α∈I

Sα = {x |x ∈ Sα for all α ∈ I}

I Example: Suppose Sn = {n, 2n}, where n is a positiveinteger. Compute

⋃α∈I Sα, where I = {1, 2, 4}.

Math 301 Functions and Algorithms

Page 54: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

SequenceSummationIndexed collection of sets

I A non empty set I , called an index set, is used to select thesets we want to consider.

I {Sα}α∈I describe the collection of all sets Sα, called theindexed collection of sets.

I The union of the sets in {Sα}α∈I is defined as⋃α∈I

Sα = {x |x ∈ Sα for some α ∈ I}

I The intersection of the sets in {Sα}α∈I is defined as⋂α∈I

Sα = {x |x ∈ Sα for all α ∈ I}

I Example: Suppose Sn = {n, 2n}, where n is a positiveinteger. Compute

⋃α∈I Sα, where I = {1, 2, 4}.

Math 301 Functions and Algorithms

Page 55: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

SequenceSummationIndexed collection of sets

I A non empty set I , called an index set, is used to select thesets we want to consider.

I {Sα}α∈I describe the collection of all sets Sα, called theindexed collection of sets.

I The union of the sets in {Sα}α∈I is defined as⋃α∈I

Sα = {x |x ∈ Sα for some α ∈ I}

I The intersection of the sets in {Sα}α∈I is defined as⋂α∈I

Sα = {x |x ∈ Sα for all α ∈ I}

I Example: Suppose Sn = {n, 2n}, where n is a positiveinteger. Compute

⋃α∈I Sα, where I = {1, 2, 4}.

Math 301 Functions and Algorithms

Page 56: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

SequenceSummationIndexed collection of sets

I A non empty set I , called an index set, is used to select thesets we want to consider.

I {Sα}α∈I describe the collection of all sets Sα, called theindexed collection of sets.

I The union of the sets in {Sα}α∈I is defined as⋃α∈I

Sα = {x |x ∈ Sα for some α ∈ I}

I The intersection of the sets in {Sα}α∈I is defined as⋂α∈I

Sα = {x |x ∈ Sα for all α ∈ I}

I Example: Suppose Sn = {n, 2n}, where n is a positiveinteger. Compute

⋃α∈I Sα, where I = {1, 2, 4}.

Math 301 Functions and Algorithms

Page 57: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

Math 301 Functions and Algorithms

Page 58: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I Factorial function:1. If n = 0, then n! = 12. If n > 0, then n! = n.(n − 1)!

I Example: Calculate 4!.

I Fibonacci Sequence:1. If n = 0 or n = 1, then Fn = n2. If n > 1, then Fn = Fn−2 + Fn−1

I 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, .......I Ackermann function:

1. If m = 0, then A(m, n) = n + 12. If m 6= 0 but n = 0, then A(m, n) = A(m − 1, 1)3. If m 6= 0 and n 6= 0, then A(m, n) = A(m − 1,A(m, n − 1))

I Find A(1, 3).

Math 301 Functions and Algorithms

Page 59: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I Factorial function:1. If n = 0, then n! = 12. If n > 0, then n! = n.(n − 1)!

I Example: Calculate 4!.I Fibonacci Sequence:

1. If n = 0 or n = 1, then Fn = n2. If n > 1, then Fn = Fn−2 + Fn−1

I 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, .......

I Ackermann function:1. If m = 0, then A(m, n) = n + 12. If m 6= 0 but n = 0, then A(m, n) = A(m − 1, 1)3. If m 6= 0 and n 6= 0, then A(m, n) = A(m − 1,A(m, n − 1))

I Find A(1, 3).

Math 301 Functions and Algorithms

Page 60: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I Factorial function:1. If n = 0, then n! = 12. If n > 0, then n! = n.(n − 1)!

I Example: Calculate 4!.I Fibonacci Sequence:

1. If n = 0 or n = 1, then Fn = n2. If n > 1, then Fn = Fn−2 + Fn−1

I 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, .......I Ackermann function:

1. If m = 0, then A(m, n) = n + 12. If m 6= 0 but n = 0, then A(m, n) = A(m − 1, 1)3. If m 6= 0 and n 6= 0, then A(m, n) = A(m − 1,A(m, n − 1))

I Find A(1, 3).

Math 301 Functions and Algorithms

Page 61: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I An algorithm is a finite step-by-step list of well-definedinstructions for solving a particular problem.

I Example: (Polynomial evaluation)

f (x) = 2x3 − 7x2 + 4x − 15 .

Compute f (5).I There are two methods:

1. Direct method.( n(n+1)2 multiplication and n addition )

2. Synthetic division. ( n multiplication and n addition )

I Synthetic division method is more efficient than the directmethod.

Math 301 Functions and Algorithms

Page 62: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I An algorithm is a finite step-by-step list of well-definedinstructions for solving a particular problem.

I Example: (Polynomial evaluation)

f (x) = 2x3 − 7x2 + 4x − 15 .

Compute f (5).

I There are two methods:

1. Direct method.( n(n+1)2 multiplication and n addition )

2. Synthetic division. ( n multiplication and n addition )

I Synthetic division method is more efficient than the directmethod.

Math 301 Functions and Algorithms

Page 63: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I An algorithm is a finite step-by-step list of well-definedinstructions for solving a particular problem.

I Example: (Polynomial evaluation)

f (x) = 2x3 − 7x2 + 4x − 15 .

Compute f (5).I There are two methods:

1. Direct method.( n(n+1)2 multiplication and n addition )

2. Synthetic division. ( n multiplication and n addition )

I Synthetic division method is more efficient than the directmethod.

Math 301 Functions and Algorithms

Page 64: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I An algorithm is a finite step-by-step list of well-definedinstructions for solving a particular problem.

I Example: (Polynomial evaluation)

f (x) = 2x3 − 7x2 + 4x − 15 .

Compute f (5).I There are two methods:

1. Direct method.( n(n+1)2 multiplication and n addition )

2. Synthetic division. ( n multiplication and n addition )

I Synthetic division method is more efficient than the directmethod.

Math 301 Functions and Algorithms

Page 65: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I “Big O” notation: Suppose p(x) is a polynomial of degreem,then

p(x) = O(xm) .

I Example: 7x2 − 9x + 4 = O(x2)

Math 301 Functions and Algorithms

Page 66: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I “Big O” notation: Suppose p(x) is a polynomial of degreem,then

p(x) = O(xm) .

I Example: 7x2 − 9x + 4 = O(x2)

Math 301 Functions and Algorithms

Page 67: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I A set is finite if it has n ∈ N distinct elements.

I The cardinality of a finite set A is the number of elements inA, it is denoted by |A| or n(A) or card(A).

I Two sets A = {a, b, c} and B = {1, 2, 3} have samecardinality.

I A set A is said to be infinite if it is not finite.

I Two sets A and B (finite or infinite) have same cardinality ifthere is a bijective function f : A→ B.

I Two sets having same cardinality are also called asnumerically equivalent sets.

Math 301 Functions and Algorithms

Page 68: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I A set is finite if it has n ∈ N distinct elements.

I The cardinality of a finite set A is the number of elements inA, it is denoted by |A| or n(A) or card(A).

I Two sets A = {a, b, c} and B = {1, 2, 3} have samecardinality.

I A set A is said to be infinite if it is not finite.

I Two sets A and B (finite or infinite) have same cardinality ifthere is a bijective function f : A→ B.

I Two sets having same cardinality are also called asnumerically equivalent sets.

Math 301 Functions and Algorithms

Page 69: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I A set is finite if it has n ∈ N distinct elements.

I The cardinality of a finite set A is the number of elements inA, it is denoted by |A| or n(A) or card(A).

I Two sets A = {a, b, c} and B = {1, 2, 3} have samecardinality.

I A set A is said to be infinite if it is not finite.

I Two sets A and B (finite or infinite) have same cardinality ifthere is a bijective function f : A→ B.

I Two sets having same cardinality are also called asnumerically equivalent sets.

Math 301 Functions and Algorithms

Page 70: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I A set is finite if it has n ∈ N distinct elements.

I The cardinality of a finite set A is the number of elements inA, it is denoted by |A| or n(A) or card(A).

I Two sets A = {a, b, c} and B = {1, 2, 3} have samecardinality.

I A set A is said to be infinite if it is not finite.

I Two sets A and B (finite or infinite) have same cardinality ifthere is a bijective function f : A→ B.

I Two sets having same cardinality are also called asnumerically equivalent sets.

Math 301 Functions and Algorithms

Page 71: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I A set is finite if it has n ∈ N distinct elements.

I The cardinality of a finite set A is the number of elements inA, it is denoted by |A| or n(A) or card(A).

I Two sets A = {a, b, c} and B = {1, 2, 3} have samecardinality.

I A set A is said to be infinite if it is not finite.

I Two sets A and B (finite or infinite) have same cardinality ifthere is a bijective function f : A→ B.

I Two sets having same cardinality are also called asnumerically equivalent sets.

Math 301 Functions and Algorithms

Page 72: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I A set is finite if it has n ∈ N distinct elements.

I The cardinality of a finite set A is the number of elements inA, it is denoted by |A| or n(A) or card(A).

I Two sets A = {a, b, c} and B = {1, 2, 3} have samecardinality.

I A set A is said to be infinite if it is not finite.

I Two sets A and B (finite or infinite) have same cardinality ifthere is a bijective function f : A→ B.

I Two sets having same cardinality are also called asnumerically equivalent sets.

Math 301 Functions and Algorithms

Page 73: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I A set A is called denumerable (or countably infinite) if|A| = |N|.

I A set which is finite and denumerable is said to be countable.

I A set that is not countable is called uncountable.

I Theorem: A countable union of countable sets is countable.

I For any sets A and B, we define |A| ≤ |B| if there exist aone-to-one function f : A→ B.

I |A| < |B| if |A| ≤ |B| but |A| 6= |B|.I Theorem: (Cantor) For any set A, we have|A| < |power(A)|.

I Theorem: If |A| ≤ |B| and |B| ≤ |A| then |A| = |B|.

Math 301 Functions and Algorithms

Page 74: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I A set A is called denumerable (or countably infinite) if|A| = |N|.

I A set which is finite and denumerable is said to be countable.

I A set that is not countable is called uncountable.

I Theorem: A countable union of countable sets is countable.

I For any sets A and B, we define |A| ≤ |B| if there exist aone-to-one function f : A→ B.

I |A| < |B| if |A| ≤ |B| but |A| 6= |B|.I Theorem: (Cantor) For any set A, we have|A| < |power(A)|.

I Theorem: If |A| ≤ |B| and |B| ≤ |A| then |A| = |B|.

Math 301 Functions and Algorithms

Page 75: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I A set A is called denumerable (or countably infinite) if|A| = |N|.

I A set which is finite and denumerable is said to be countable.

I A set that is not countable is called uncountable.

I Theorem: A countable union of countable sets is countable.

I For any sets A and B, we define |A| ≤ |B| if there exist aone-to-one function f : A→ B.

I |A| < |B| if |A| ≤ |B| but |A| 6= |B|.I Theorem: (Cantor) For any set A, we have|A| < |power(A)|.

I Theorem: If |A| ≤ |B| and |B| ≤ |A| then |A| = |B|.

Math 301 Functions and Algorithms

Page 76: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I A set A is called denumerable (or countably infinite) if|A| = |N|.

I A set which is finite and denumerable is said to be countable.

I A set that is not countable is called uncountable.

I Theorem: A countable union of countable sets is countable.

I For any sets A and B, we define |A| ≤ |B| if there exist aone-to-one function f : A→ B.

I |A| < |B| if |A| ≤ |B| but |A| 6= |B|.I Theorem: (Cantor) For any set A, we have|A| < |power(A)|.

I Theorem: If |A| ≤ |B| and |B| ≤ |A| then |A| = |B|.

Math 301 Functions and Algorithms

Page 77: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I A set A is called denumerable (or countably infinite) if|A| = |N|.

I A set which is finite and denumerable is said to be countable.

I A set that is not countable is called uncountable.

I Theorem: A countable union of countable sets is countable.

I For any sets A and B, we define |A| ≤ |B| if there exist aone-to-one function f : A→ B.

I |A| < |B| if |A| ≤ |B| but |A| 6= |B|.I Theorem: (Cantor) For any set A, we have|A| < |power(A)|.

I Theorem: If |A| ≤ |B| and |B| ≤ |A| then |A| = |B|.

Math 301 Functions and Algorithms

Page 78: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I A set A is called denumerable (or countably infinite) if|A| = |N|.

I A set which is finite and denumerable is said to be countable.

I A set that is not countable is called uncountable.

I Theorem: A countable union of countable sets is countable.

I For any sets A and B, we define |A| ≤ |B| if there exist aone-to-one function f : A→ B.

I |A| < |B| if |A| ≤ |B| but |A| 6= |B|.

I Theorem: (Cantor) For any set A, we have|A| < |power(A)|.

I Theorem: If |A| ≤ |B| and |B| ≤ |A| then |A| = |B|.

Math 301 Functions and Algorithms

Page 79: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I A set A is called denumerable (or countably infinite) if|A| = |N|.

I A set which is finite and denumerable is said to be countable.

I A set that is not countable is called uncountable.

I Theorem: A countable union of countable sets is countable.

I For any sets A and B, we define |A| ≤ |B| if there exist aone-to-one function f : A→ B.

I |A| < |B| if |A| ≤ |B| but |A| 6= |B|.I Theorem: (Cantor) For any set A, we have|A| < |power(A)|.

I Theorem: If |A| ≤ |B| and |B| ≤ |A| then |A| = |B|.

Math 301 Functions and Algorithms

Page 80: Functions and Algorithms - McMaster Universityms.mcmaster.ca/~nahid/Math-301/Lecturenotes/... · Exponential and logarithmic functions Sequence and Summation Sequence Summation Indexed

OutlineFunctions, Domain, Codomain, Range

One-to-one and Onto functionComposition function and Inverse function

Mathematical functionSequence and Summation

Recursively defined functionsAlgorithms and Function

Cardinality

I A set A is called denumerable (or countably infinite) if|A| = |N|.

I A set which is finite and denumerable is said to be countable.

I A set that is not countable is called uncountable.

I Theorem: A countable union of countable sets is countable.

I For any sets A and B, we define |A| ≤ |B| if there exist aone-to-one function f : A→ B.

I |A| < |B| if |A| ≤ |B| but |A| 6= |B|.I Theorem: (Cantor) For any set A, we have|A| < |power(A)|.

I Theorem: If |A| ≤ |B| and |B| ≤ |A| then |A| = |B|.

Math 301 Functions and Algorithms