17 Relations

17 Relations - Handout #17 April 16, 2010 CS103 Robert...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Handout #17 CS103 April 16, 2010 Robert Plummer Relations Relations are a fundamental concept in discrete mathematics, used to define how sets of objects relate to other sets of objects. Not only do they provide a formal way of being able to talk about such relationships, they also provide the most widespread model used in modern commercial database systems. Understanding relations from a mathematical perspective not only gives you an important modeling tool, but also gives you the foundational theory used in a number of applications including relational database management systems, task scheduling systems, and methods to solve various optimization problems. To explore what relations are, let’s begin by considering the following set G Greek deities: G = {Zeus, Apollo, Cronus, Poseidon} As you may know, Zeus is the father of Apollo, Cronus is the father of Poseidon, and Cronus is also the father of Zeus. So some of the elements of G that satisfy the "is the father of" relation with respect to others Notice that in this case, the elements that are related are both from the same set, G. If we had another set, H, of female deities, then some members of G might bear the "is married to" relation to members of H, and that relationship would also be true in the other direction. We will formalize all of these ideas, and more, starting with the following definition: Definition A binary relation R between two sets A and B (which may be the same) is a subset of the Cartesian product A x B . If element a A is related by R to element b B, we denote this fact by writing (a, b) R , or alternately, by a R b . A good way to think of a binary relation is that it is a way to designate that of all the ordered pairs in the cross product of two sets, some are "interesting" because there is a certain relationship between them. We often name relations with capital letters, but some relations, such as "less- than" have their own symbols, like "<". What we defined above is a binary relation because it operates on ordered pairs. We can also define unary relations, which operate on single elements, or ternary relations , which operate on ordered triples. In general an n -ary relation will operate on n -tuples. Formally, we can express this as: Definition An n -ary relation on the sets A 1 , A 2 , …, A n is a subset of A 1 x A 2 x … x A n . The sets A 1 , A 2 , …, A n are called the domains of the relation, and n is called its degree .
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
– 2 – Example 1 Let's consider the "is the father of" relation (which we will denote by F) on the set G x G. We can figure out that: G x G = { (Zeus, Zeus), (Zeus, Apollo), (Zeus, Cronus), (Zeus, Poseidon), (Apollo, Zeus), (Apollo, Apollo), (Apollo, Cronus), (Apollo, Poseidon), (Cronus, Zeus), (Cronus, Apollo), (Cronus, Cronus), (Cronus, Poseidon), (Poseidon, Zeus), (Poseidon, Apollo), (Poseidon, Cronus), (Poseidon, Poseidon) } But of the set G x G , only a subset satisfies the "is the father of" relation. Thus, applying the F relation to G x G yields the set: {(Zeus, Apollo), (Cronus, Poseidon), (Cronus, Zeus)} which we could also write as Zeus F Apollo, Cronus F Poseidon, and Cronus F Zeus.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 15

17 Relations - Handout #17 April 16, 2010 CS103 Robert...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online