Docsity

Binary Relations and Functions: Definition, Properties, and Examples, Study notes of Discrete Structures and Graph Theory

Toggle sidebar
bg1
Abinary relation between Aand Bis a subset of A×B.
Ais called the domain;Bis called the codomain.
•A=Students;B=Classes;R={(a, b)|ais taking b this semester}.
•A=People;B=People;R={(a, b)|ais b’s ancestor}
•has downloaded ⊆People ×Songs
•likes ⊆People ×IceCreamFlavors
•acted in a movie with ⊆Actors2
•is a multiple of ⊆ZZ2
• ≤ ⊆ IR2
• ∈ ⊆ ZZ ×2ZZ
Equivalently, a binary relation is a predicate with two free variables.
IsTaking(x, y)Ancestor(a, b)a≤b a =b3
x=y k divides n x2+yis a multiple of 17
A⊂B|A|<|B|A∩B=∅x∈A
p→q p ∧q W ≡X p =IsAlive(x)
(BeatsAtChess(x, Kasparov)∧ ¬SmellsLike(y, Roses)) ∨Eats(x, y)
A relation between Aand Bis a function if and only if
each element of Ais related to exactly one element of B.
1
pf3
pf4
pf5
pf8
pf9

Partial preview of the text

Download Binary Relations and Functions: Definition, Properties, and Examples and more Study notes Discrete Structures and Graph Theory in PDF only on Docsity!

A binary relation between A and B is a subset of A × B. A is called the domain ; B is called the codomain.

  • A = Students ; B = Classes ; R = {(a, b) | a is taking b this semester}.
  • A = People ; B = People ; R = {(a, b) | a is b’s ancestor}
  • has downloaded ⊆ People × Songs
  • likes ⊆ People × IceCreamFlavors
  • acted in a movie with ⊆ Actors^2
  • is a multiple of ⊆ ZZ^2
  • ≤ ⊆ IR^2
  • ∈ ⊆ ZZ × 2 ZZ

Equivalently, a binary relation is a predicate with two free variables.

IsTaking (x, y) Ancestor (a, b) a ≤ b a = b^3 x = y k divides n x^2 + y is a multiple of 17 A ⊂ B |A| < |B| A ∩ B = ∅ x ∈ A p → q p ∧ q W ≡ X p = IsAlive (x) ( BeatsAtChess (x, Kasparov ) ∧ ¬ SmellsLike (y, Roses )) ∨ Eats (x, y)

A relation between A and B is a function if and only if each element of A is related to exactly one element of B.

A function f from A to B is an assignment of exactly one element f (a) ∈ B to each element a ∈ A. This is written f : A → B.

  • A is called the domain of f.
  • B is the codomain of f.
  • f (a) is called the image of a.

For example:

  • A = brands of beer
  • B = {x/ 4 | x ∈ IN}
  • f maps beer brands to prices in dollars
  • f ( La Fin Du Monde ) = 5

Small Brewery Bottled Beer Anchor Steam - San Francisco, CA ....................................4. Bavik Premium Pils - Belgium ...........................................4. Blue Moon - white ale, Colorado ...................................... 3. Carlsberg Beer - lager from Denmark ...............................4. Chimay Blue Cap - Belgium; 18 proof ..............................7. Delirium Tremens - Belgian ale; 17 proof .........................8. Founders Red’s Rye - red ale brewed w/rye ...................4. Founders DIRTY BASTARD - Scottish ale brewed with ten varieties of imported malts, a bold and powerful ale...$4. Goose Island - India Pale Ale, A hop lover’s dream! ....$4. Grolsch Lager - swingtop bottle.........................................5. Konig Ludwig - Royal Bavarian Hefe-Weizen ................4. La Fin Du Monde - Belgian style golden ale ....................5. Harp Lager - Ireland ............................................................4. Hoegaarden - Belgium, sweet and sour, gently bitter ....5. HofBrau - original, from Germany ....................................4. Left Hand JUJU Ginger - pale ale brewed with ginger, from Colorado ....................................................................$4. Lindeman’s Framboise - lambic style ale with real raspberries added! .............................................................$8. Newcastle Brown Ale - England ........................................4. Pilsner Urquell - Czech Republic .......................................4. Paulaner Thomas Brau - German N/A lager.................. 3. Samuel Adams - lager from Boston...................................4. Sterken’s White Ale - Belgian White Ale ..........................4. Sierra Nevada Pale Ale - from CA.....................................4. Staropramen - pilsner from Prague ...................................4. Strongbow - dry English cider ...........................................4. Steinlager - lager from New Zealand ................................4. Theakston Old Peculiar - English dark brown complex ale ..5. Tucher Light Hefe Weizen - Germany ..............................5. Warsteiner Dunkel - German dark ....................................4. Wolaver’s Brown Ale - organic! .........................................4. Wolaver’s IPA - organic! .....................................................4. Xingu - black beer from Brazil ...........................................4. Big Brewery Bottled Beer Amstel Light .........................................................................3. Bud Light/Budweiser/Bud Select.....................................3. Coor’s Light ..........................................................................3. Corona Extra .........................................................................3. Heineken ...............................................................................3. Michelob Ultra/Michelob Ultra Amber ...........................3. Miller High Life ....................................................................2. Miller Lite ..............................................................................3. Pabst Blue Ribbon ................................................................2. Red Stripe ..............................................................................3. Rolling Rock ..........................................................................3.

2

  • The range of f is the set of images of elements of A:

range(f ) = {f (a) | a ∈ A} = {b ∈ B | ∃a ∈ A : f (a) = b}

  • The image of a subset S ⊂ A is

f (S) = {f (a) | a ∈ S}

In particular, range(f ) = f (A).

  • The preimage of an element b ∈ B is

f −^1 (b) = {a | f (a) = b}

  • The preimage of a subset T ⊆ B is

f −^1 (T ) = {a | f (a) ∈ S}

domain A codomain B

f

a

f ( a )

f ( S )

S A image of^ S

b

f -1( b )

preimage of b

Two things to prove

  • For any subset T ⊆ B, we have f (f −^1 (T )) = T.
  • For any subset S ⊆ A, we have f −^1 (f (S)) ⊇ S.

Examples (all functions f : ZZ → ZZ):

  • f (x) = x + 1
  • f (x) = 2x
  • f (x) = bx/ 2 c

b c is the floor function: round down to the nearest integer. b 2 c = 2 bπc = 3 b−πc = − 4

  • f (x) = 42
  • f (x) =

x + 2 if x is divisible by 3 x − 1 if x is not divisible by 3

More Examples:

  • f : IN → IN where f (x) = x^2 is one-to-one but not onto.
  • f : ZZ → ZZ where f (x) = x^2 is neither one-to-one nor onto.
  • f : IR → IR≥ 0 where f (x) = x^2 is onto but not one-to-one.
  • f : IR≥ 0 → IR≥ 0 where f (x) = x^2 is both one-to-one and onto.

Composition

The composition of two functions f : A → B and g : B → C is the function g ◦ f : A → C where

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

  • Suppose f (x) = x^2 + 5 and g(x) = 3x − 2.

(f ◦ g)(x) = f (g(x)) = (3x − 2)^2 + 5 = 9x^2 − 12 x + 9

6 = (g ◦ f )(x) = g(f (x)) = 3(x^2 + 5) − 2 = 3x^2 + 13

  • Consider Home : People → Houses and ZipCode : Houses → ZZ. - Zipcode ◦ Home is well-defined: ( Zipcode ◦ Home )( me ) = “My house’s ZIP code” - Home ◦ Zipcode does not exist!

1 2 3 4

a b c δ

α β γ 1 2 3

4 δ

α β γ

1 2 3

a b c

α β γ d 1 2 3

α β γ

f : { 1 , 2 , 3 , 4 } → {a, b, c} f : { 1 , 2 , 3 } → {a, b, c, d} g : {a, b, c} → {α, β, γ, δ} g : {a, b, c, d} → {α, β, γ} g ◦ f : { 1 , 2 , 3 , 4 } → {α, β, γ, δ} g ◦ f : { 1 , 2 , 3 } → {α, β, γ}