Functions and Matrices
Functions and Matrices
Functions and Matrices
Discrete Mathematics
Functions
• The concept of a function is extremely important in mathematics and
computer science.
• Functions are also used to represent how long it takes a computer to
solve problems of a given size.
• In discrete mathematics functions are used in the definition of such
discrete structures as sequences and strings.
• Functions are sometimes also called mappings or transformations.
FUNCTION
A function is a relation that assigns each y-value with only one x-
value.
So, in order for the relation to be considered a function, there
cannot be any repeated values in the domain.
Steps:
• Draw two ovals
• List domain
• List range
• Draw lines to connect
This is a function!
Mapping: Two x-values go to the same y-value
It is not a function
if one x-value maps to
two different y-values.
Functions
• If f:A→B, and f(a)=b then:
A is the domain of f.
B is the codomain of f.
b is the image of a under f
a is a pre-image of b under f
Function
Function
What are the functions f1 + f2 and f1f2?
Where: f1(x) = x2 and f2(x) = x − x2
( f1 + f2)(x) = f1(x) + f2(x)
= x2 + (x − x2 )
=x
and
( f1 f2)(x) = x2 (x − x2 )
= x3 − x4
Functions
One-to-One Function
• A function is one-to-one if each element in the co-domain has unique
pre-image
• A function f from A to B is called one-to-one if whenever f(a)=f(b) then
a=b. No element of B is the image of more than one element in A.
• In one-to-one function, given any y there is only one x that can be
paired with the given y
Functions
Examples of one-to-one functions
1. f(x) = x3
2. f(x) = 3x + 5
3. f(x) = sqrt(x)
Functions
Onto Function
• A function is onto if each element in the co-domain is an image of
some pre-image
• A function f:A→B is subjective (onto) if the image of f equals its range
• A function f from A to B is called onto if all b in B there is an a in A
such that f(a)=b. All elements in B are used.
Functions
Example of onto functions
1. f(x) = x-2
2. f(x) = 3x – 4
Functions
Bijective function
• Functions can be both one-to-one and onto
• A function f is a one-to-one correspondence or a bijection, or
reversible or invertible, if it is both one-to-one and onto
Functions
Example of bijective function
1. f:R→R defined by f(x)=2x-3
2. f(x) = x5
3. f(x) = x3
Functions
Inverse of a function
• Given any function, f, the inverse of the function f-1, is a relation that
is formed by interchanging each (x,y) of f to a (y,x) of f-1
• The function g would be denoted as f-1 and read as “f inverse”
Functions
• Let f be defined as the set of values given
• Diagonal matrix – a square matrix with its all non diagonal elements
as zero
• Scalar matrix – it’s a diagonal matrix whose all elements are equal
Matrix
• Unit matrix – a scalar matrix whose all diagonal elements are equal to
unity, and also called as identity matrix
2.
Matrix
Multiplication: Multiply a matrix by a single number.
Matrix
Multiplication: Multiply a matrix by another matrix.
Matrix
Multiplication: Multiply a matrix by another matrix.
Matrix
Multiplication: Multiply a matrix by another matrix.
Matrix
Multiplication: Multiplying a 1x3 by a 3x1
Matrix
Multiplication: Multiplying a 3x1 by a 1x3
Activity
The local shop sells 3 types of pies.
• Apple pies cost $3 each
• Cherry pies cost $4 each
• Blueberry pies cost $2 each
And this is how many they sold in 4 days: