10A Week 10

# 10A Week 10 - CMPUT 272(Stewart Lecture 17 Reading Epp 1.3...

This preview shows pages 1–4. Sign up to view the full content.

CMPUT 272 (Stewart) Lecture 17 Reading: Epp 1.3, 8.1-8.3 Recall: A relation from a set A to a set B is a subset of A × B . If the ordered pair ( a, b ) is in the relation R , we say that a is related to b and we write: ( x, y ) R or xRy . Relations on two or more sets: An n -ary relation on A 1 ×· · ·× A n is a subset of A 1 ×· · ·× A n where A 1 , . . . , A n are sets and n 2. Relations on two sets: A relation from a set A to a set B is a binary relation on A × B . A binary relation on A × A is called a (binary) relation on A . 1

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

View Full Document
Examples: 1. R from { 1 , 2 , 3 , 4 , 5 } to { 1 , 2 , 3 , 4 , 5 } ( R on { 1 , 2 , 3 , 4 , 5 } ) where R = { (1 , 1) , (1 , 2) , (1 , 3) , (3 , 4) , (2 , 4) , (4 , 5) , (5 , 4) } . 2. LE from R to R ( LE on R ) where x LE y x y LE = { ( x, y ) R 2 | x y } 3. P from Z to Z ( P on Z ) where x P y x and y are both even or both odd P = { ( x, y ) Z 2 | x and y are both even or both odd } 4. T from P ( { a, b, c } ) to Z where A T x ⇔ | A | ≥ x { 1 } T 0 ( , 2) / T 5. All functions are binary relations but not all binary relations are func- tions. For example, the binary relations above are not functions. 6. B on R 3 where ( x, y, z ) B y < x < z or z < x < y 7. relational databases Let A 1 = the set of all possible student names A 2 = the set of all possible student numbers A 3 = the set of all possible courses A 4 = { A+, A, A-, B+, B, B-, C+, C, C-, D+, D, F } Define R on A 1 × A 2 × A 3 × A 4 as follows: ( w, x, y, z ) R the student with name w and student number x took course y and received a grade of z in that course. 2
Let R be a relation from A to B . The inverse relation of R is the relation R - 1 from B to A defined as follows: R - 1 = { ( y, x ) B × A | ( x, y ) R } .

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern