This preview shows page 1. Sign up to view the full content.
Unformatted text preview: Relations, Functions and Matrices Matrices Relations Relations We talked earlier about the Cartesian We product, namely the set of ordered pairs of product namely elements taken from S1 and S2. A relation, in general, is any set of ordered relation in ntuples chosen from n sets. tuples Relations Relations
But we will mostly study the simplest case, a binary relation on a set S. This binary on corresponds to sets of ordered pairs, with each of the elements of an ordered pair coming from the same set, S. Therefore, a binary relation on set S is binary defined as a subset of S x S. Relations Relations
But we will mostly study the simplest case, a binary relation on a set S. This binary on corresponds to sets of ordered pairs, with each of the elements of an ordered pair coming from the same set, S. Therefore, a binary relation on set S is binary defined as a subset of S a S. For simplicity, P we will call these things simply binary relations. We write (x, y) ∈ ρ, or (more simply) x ρ y. We or Relations Relations It's easy to get lost in the notation. Examples should make things clearer. Consider the set S = {1, 2, 3, 4, 5, 6, 7, 8}. The relation < is the set of ordered pairs {(1, 2), (1, 3), (1, 4), (1, 5), (1, 6), (1, 7), (1, 8), (2, 3), (2, 4), (2, 5), (2, 6), (2, 7), (2, 8), (3, 4), (3, 5), (3, 6), (3, 7), (3, 8), (4, 5), (4, 6), (4, 7), (4, 8), (5, 6), (5, 7), (5, 8), (6, 7), (6, 8), (7, 8)} (4, Relations Relations <12345678 1 √√√√√√√ 2 √√√√√√ 3 √√√√√ 4 √√√√ 5 √√√ 6 √√ 7 √ 8 Relations Relations There are a number of important properties by There which we characterize relations. which Given two sets S and T, Given .. .. . . S . .. T . onetoone Relations Relations There are a number of important properties by There which we characterize relations. which Given two sets S and T, Given .. .. . . S . .. T . onetomany Relations Relations There are a number of important properties by There which we characterize relations. which Given two sets S and T, Given .. .. . . S . .. T . manytoone Relations Relations There are a number of important properties by There which we characterize relations. which Given two sets S and T, Given .. .. . . S . .. T . manytomany Relations Relations Properties of binary relations. Properties binary ρ is reflexive if every element is related to itself reflexive if ρ is symmetric if whenever s ρ t, then t ρ s symmetric then ρ is transitive if whenever s ρ t and t ρ u, then transitive sρu These properties hold only if the conditions are true in ALL cases. are Relations Relations One other property of binary relations. One binary ρ is antisymmetric if every we never have the antisymmetric situation s ρ t and t ρ s unless s = t. and unless t. Relations Relations What are some examples of relations that have such properties? have reflexive: =, ≤ , ⊆ , "has the same eye color as" =, symmetric: =, "has the same cardinality as" transitive: every one of the above not transitive: "is 10 more than" transitive antisymmetric: ≤ , ⊆ , < Relations Relations The closure of a relation ρ with respect to closure property P is denoted by ρ* and satisfies these conditions: conditions: ρ* has the property P ρ ⊆ ρ* ρ* is the smallest such relation that is a superset of ρ. Relations Relations
<12345678 1√√√√√√√√ 2 √√√√√√√ 3 √√√√√√ 4 √√√√√ 5 √√√√ 6 √√√ 7 √√ 8 √ reflexive closure of < Relations Relations
< 1 2 3 4 5 6 7 8 12 √ √ √√ √√ √√ √√ √√ √√ 3456 √√√√ √√√√ √√√ √ √√ √√ √ √√√ √√√√ √√√√ 7 √ √ √ √ √ √ √ 8 √ √ √ √ √ √ √ symmetric closure of < Relations Relations
<123456 1 √√ √ 2 3 √ √√ 4 √ √√ 5 √ √ 6 √ √ 7 √ √ √ 8 √ √ √ 78 √√ √ √√ √ √√ √ transitive closure of a relation.
suppose 2 ρ 6 and that 6 ρ 3 we must add 2 ρ 6 to the relation repeat process until we can't any more. Partial Orderings Partial A relation that is reflexive, antisymmetric and relation transitive is called a partial ordering . partial When a relation on a set is a partial ordering, we call When the underlying set a partially ordered set, or poset. or Consider a relation on the set {1, 2, 3, 6, 12, 18} Consider {1, The above set is a partially ordered set under the The relation "divides into". relation reflexive: a always divides into itself antisymmetric: the only way a divides into b and b divides the into a is if a = b into transitive: a divides into b, b divides into c, then a divides divides into c. into Partial Orderings Partial Given a partial ordering e , if x e P if P Given y and x ≠ y then x is said to be a predecessor of y. predecessor If x is a predecessor of y and there is no other If element z between x and y, then x is called an then immediate predecessor of y. immediate Similar definitions apply for successor and Similar successor immediate successor. immediate successor Partial Orderings Partial If an element in a partially ordered set is "less If than" every other element we call it a least least element. element If an element has no other element "less than" it, we call it a minimal element minimal element the least element is the absolutely "smallest least element element" (if it exists). element" a minimal element is any of the smallest elements minimal element (if more than exists) or the least element if there's least element only one. only Partial Orderings Partial If an element in a partially ordered set is "greater If than" every other element we call it a greatest greatest element. element If an element has no other element "greater than" it, we call it a maximal element maximal element the greatest element is the absolutely "biggest greatest element element" (if it exists). element" a maximal element is any of the biggest elements maximal element (if more than exists) or the greatest element if greatest element there's only one. there's Partial Orderings Partial A Hasse diagram shows the nature of posets Hasse and partial orderings. In it, the least elements are drawn at the bottom and the greatest elements at the top. In between we draw lines between elements of the set if one element is an immediate predecessor of the other. an An example makes this much more clear Partial Orderings Partial A Hasse Diagram illustrates the nature of a partial Hasse ordering. ordering. Consider "divides into" on {1, 2, 3, 6, 12, 18} Consider {1, no greatest element 12 6 2 1 18 maximal element 3 least element minimal element Partial Orderings Partial A partial ordering in which every element is partial related to every other element (in one way or the other) is called a total ordering, or chain. total or chain The relation ≤ on the integers is a total The ordering. ordering. The previous example (Hasse diagram) is not not a total ordering. total Equivalence Relations Equivalence
A binary relation that is reflexive, symmetric and transitive is called an equivalence relation and equivalence relation Typically, equivalence relations are relations Typically, of things similar or equal. For example: of = equivalent sets equivalent = mod n mod Equivalence Relations Equivalence
Equivalence relations do something different to a set than partial orderings. to Equivalence relations subdivide and cover the Equivalence underlying set. underlying subdivide: group together a subset containing all group elements that are equivalent to each other. No two such sets overlap. such cover: the collection of these subsets covers the the entire set. The union of these subsets is the original set. original Equivalence Relations Equivalence
This process is called partitioning. Each partitioning subset created is called a partition, or partition or equivalence class. equivalence class Example: two integers n ≡m (mod 5) if and ≡m only if (n mod 5) = (m mod 5) mod there are 5 equivalence classes: all the numbers there who are divisible by 5, all the numbers that leave a remainder of 1 when divided by 5, and so on. so Equivalence Relations Equivalence
This process is called partitioning. Each partitioning subset created is called a partition, or partition or equivalence class. equivalence class Example: equals. two integers are equal Example: there are an infinite number of equivalence there classes, since every number is equal to itself and to nothing else. and Equivalence Relations Equivalence This process is called partitioning. This partitioning Each subset created is called a partition, or partition or equivalence class. equivalence class Example: Given the power set of {a, b, c, d, e} Example: d, S ≡T if they have the same cardinality. ≡T if How big is the equivalence class containing How {a, b, c}? Remember our counting problems! 5C3 Remember Functions Functions A function is a special case of a binary relation function between sets S and T. A function is a binary relation on S c T such that each P element s in S is related to exactly one element t in T. exactly The set S is called the domain, the set T is called the domain the codomain, the subset of T containing all the elements codomain the that are mapped to is called the range. range f:S→T Functions Functions What are some examples of functions? What f(x) = x + 4x – 5 2 f(S) = the length of S. What is the domain? What is the the codomain? the etc. Properties of functions Properties A function is said to be onto if the range is the same as function onto the codomain. the Onto functions are sometimes called surjections, or are Onto surjections or said to be surjective. surjective An onto function maps to every element in the codomain. An element Is the function f(x) = 4x – 5 onto? Is • It is if the domain and codomain are both the set of all It rationals (e ) rationals P • It isn't if the domain and codomain are both the set of (e ) P Properties of functions Properties A function is said to be onetoone if no member of the function onetoone range is mapped to by more than one element of the range. range. or are said to be injective. injective Onetoone functions are sometimes called injections, injections
Is the function f(x) = x2 + 4x – 5 onetoone? Is • It is if the domain and codomain are both the set of all It natural numbers (e ) P natural • It isn't if the domain and codomain are both the set of all It integers (e ). The values f(5) = f(1) = 0. integers P ). (5) (1) Properties of functions Properties Functions that are onetoone and onto are called onetoone onto bijections, or are said to be bijective. bijections or bijective Composition of functions Composition Functions can be combined. Consider the Functions functions f:S →T and g:T →U. The composition The of these functions, written as g ○ f : S → U represents the combination obtained by applying f to some member of S and then applying g to the result. result. f S T g○f g U Composition of functions Composition What is the composition g ○ f of the functions f(x) = x3 What and g(x) = x + 3 if the domains and codomains are all the set of all integers? the g ○ f (x) = x3 + 3 What is the composition f ○ g of the functions f(x) = x3 What and g(x) = x + 3 if the domains and codomains are all the set of all integers? the f ○ g (x) = (x + 3)3 3) Inverse functions Inverse The inverse of a function is the "reversal" of that The inverse function. An identity function is any function that maps every An identity element to itself. element The inverse function f 1 of function f : S → T is the 1 The function f 1: T → S such that f 1 ○ f : S → S is the 1 1 identity function. identity The inverse of x + 3 is the function x – 3. Note that The Note (x + 3) – 3 = x Permutation functions Permutation A bijection is sometimes called a permutation function. bijection permutation Why? Because since the domain and range are identical, Why? we are merely rearranging the elements of the domain. we 1 2 3 4 f = 2 3 1 4 We sometimes write permutation functions in cycle We cycle notation: f = (1, 2, 3) with the understanding that each notation value maps to the next value in the list and that the last one maps back to the first. We usually leave out cycles of length 1. length Permutation functions Permutation The cycle notation is merely a listing of all the cycles in The the permutation. An example of a cycle is 1 → 3, 3 → 6, 6 → 2, and 2 → 1. This would be written as (1, 3, 6, 2). and This (1, All permutations are merely a collection of cycles 1 f = 5 2 6 3 8 4 4 5 3 6 7 7 2 8 1 Cycle notation: f = (1, 5, 3, 8)(2, 6, 7)(4) Cycle Writing down cycles with only one element is optional Matrices and operations on them Matrices A matrix looks like 1 4 5 A= 6 − 3 2 Matrices and operations on them Matrices If r is a numerical value, then scalar multiplication is If represented as represented 1 4 5 rA = 6 − 3 2 3 12 15 3A = 18 − 9 6 Matrices and operations on them Matrices Matrix addition can only be performed on two matrices Matrix of the same shape (same number of rows and same number of columns number 3 12 15 1 4 5 3A + A = + 6 − 3 2 18 − 9 6 16 20 4 = 24 − 12 8 Matrices and operations on them Matrices Matrix multiplication A B can only be performed on two Matrix matrices if the number of columns of A is equal to the number of rows of B. An n x m matrix multiplied by an m x k matrix yields an n x k matrix.
1 5 1 4 5 AB = 3 − 1 6 − 3 2 0 3 1 + 12 + 0 5 − 4 + 15 13 14 = = − 3 39 6 − 9 + 0 30 + 3 + 6 ...
View Full
Document
 Spring '10
 landis
 Matrices

Click to edit the document details