SlideShare a Scribd company logo
Relational Algebra
What is Relation?
• I am sure that you are familiar with many relations such as “less than,” “is
parallel to,” “is a subset of,” and so on. In a certain sense, these relations
consider the existence or nonexistence of a certain connection between
pairs of objects taken in a definite order.
• Formally, we define a relation in terms of these “ordered pairs.”
• An ordered pair of elements a and b, where a is designated as the first
element and b as the second element, is denoted by (a, b). In particular,
• (a, b) = (c, d)
• if and only if a = c and b = d. Thus (a, b) = (b, a) unless a = b. This contrasts
with sets where the order of elements is irrelevant; for example, {3, 5} = {5,
3}.
Product Sets
• Consider two arbitrary sets A and B. The set of all ordered pairs (a, b)
where a ∈ A and b ∈ B is called the product, or Cartesian product, of A
and B. A short designation of this product is A × B, which is read “A
cross B.” By definition,
• A × B = {(a, b) | a ∈ A and b ∈ B}
• Example: Let A = {1, 2} and B = {a, b, c}. Then
• A × B = {(1, a), (1, b), (1, c), (2, a), (2, b), (2, c)}
• B × A = {(a, 1), (b, 1), (c, 1), (a, 2), (b, 2), (c, 2)}
• Also, A × A = {(1, 1), (1, 2), (2, 1), (2, 2)}
(Here A×B ≠ B ×A)
Number of Elements in Product Sets
In our previous example, n(A × B) = 6 = 2(3) = n(A)n(B)
• We can say n(A×B) = n(A)n(B)
Relations
• Let A and B be sets. A binary relation or, simply, relation from A to B is a
subset of A × B.
• Suppose R is a relation from A to B. Then R is a set of ordered pairs where
each first element comes from A and each second element comes from B.
That is, for each pair a ∈ A and b ∈ B, exactly one of the following is true:
1. (a, b) ∈ R; we then say “a is R-related to b”, written aRb.
2. (a, b) ∉ R; we then say “a is not R-related to b”, written aRb.
• If R is a relation from a set A to itself, that is, if R is a subset of 𝐴2 = A×A,
then we say that R is a relation on A.
• The domain of a relation R is the set of all first elements of the ordered
pairs which belong to R, and the range is the set of second elements.
Example:
• A = {1, 2, 3} and B = {x, y, z}, and let R = {(1, y), (1, z), (3, y)}. Then R is
a relation from A to B since R is a subset of A × B. With respect to this
relation, 1Ry, 1Rz, 3Ry, but
• The domain of R is {1, 3} and the range is {y, z}
• Set inclusion ⊆ is a relation on any collection of sets. For, given any
pair of set A and B, either A ⊆ B or A ⊈ B.
• A familiar relation on the set Z of integers is “m divides n.” A common
notation for this relation is to write m|n when m divides n. Thus 6 |
30 but
• Consider the set L of lines in the plane. Perpendicularity, written “⊥,”
is a relation on L. That is, given any pair of lines a and b, either a ⊥b
or . Similarly, “is parallel to,” written “||,” is a relation on L since
either
• Let A be any set. An important relation on A is that of equality, {(a, a)
| a ∈ A} which is usually denoted by “=.” This relation is also called
the identity or diagonal relation on A and it will also be denoted by A
or simply .
• Let A be any set. Then A × A and ∅ are subsets of A × A and hence are
relations on A called the universal relation and empty relation,
respectively.
Inverse Relation
• Let R be any relation from a set A to a set B. The inverse of R, denoted
by 𝑅−1, is the relation from B to A which consists of those ordered
pairs which, when reversed, belong to R; that is,
• 𝑅−1 = {(b, a) | (a, b) ∈ R}
• For example, let A = {1, 2, 3} and B = {x, y, z}. Then the inverse of
• R = {(1, y), (1, z), (3, y)} is 𝑅−1= {(y, 1), (z, 1), (y, 3)}
• Clearly, if R is any relation, then (𝑅−1)−1 = R. Also, the domain and
range of 𝑅−1are equal, respectively, to the range and domain of R.
Moreover, if R is a relation on A, then 𝑅−1 is also a relation on A.
Pictorial Representation of Relation
Directed Graph:
• Say relation R on the set A = {1, 2, 3, 4}: R = {(1, 2), (2, 2), (2, 4), (3, 2),
(3, 4), (4, 1), (4, 3)}
Pictures of Relations on Finite Sets
Suppose A and B are finite sets. There are two
ways of picturing a relation R from A to B.
1. Form a rectangular array (matrix) whose rows
are labeled by the elements of A and whose
columns are
I. labeled by the elements of B. Put a 1 or 0 in each
position of the array according as a ∈ A is or is not
II. related to b ∈ B. This array is called the matrix of
the relation.
1. Write down the elements of A and the elements of B in two disjoint
disks, and then draw an arrow from
I. a ∈ A to b ∈ B whenever a is related to b. This picture will be called the
arrow diagram of the relation.
II. A = {1, 2, 3}, B = {x, y, z} and R = {(1, y), (1, z), (3, y)}

More Related Content

PPTX
Relations
DOC
Final relation1 m_tech(cse)
DOC
Final relation1 m_tech(cse)
DOC
Final relation1 m_tech(cse)
PPTX
Presentation2 vijayan pillai
DOCX
Week 5 ( basic concept of relation )
PDF
Relations
PPSX
Relations
Final relation1 m_tech(cse)
Final relation1 m_tech(cse)
Final relation1 m_tech(cse)
Presentation2 vijayan pillai
Week 5 ( basic concept of relation )
Relations

Similar to Relational Algebra (1).pptx (20)

PDF
Chapter 2: Relations
PDF
relations (1).pdf
PDF
Relations and Functions.pdf
PDF
Ncert class-12-mathematics-part-1
PPTX
realtion ppt for disteane maths for engg
PPTX
Key Guidelines for Low-Income Housing.ptx
PDF
Abs Alg L1 Cartessian Product and Mapping.pdf
PPTX
Binary Relation-1 ssssssssssssssssssssssss
PDF
duj28udehj82uh3duujd83uijdj3Relations lecture-1 (11th JEE
PDF
Lecture 3 (4).pdfbbbbbbbbbbbbbbbbbbbvvvvvvvvvvvvvvvvvvvvvvvvv
PDF
Lecture 3 (2).pdf,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
PPTX
relation and operations power point presentation
PPT
PPTX
RELATION_20231006_151843_0000.hhahahpptx
PPTX
setRelation&functions_class_xii ppt.pptx
PPTX
CMSC 56 | Lecture 13: Relations and their Properties
PPT
Set theory
PDF
PPTX
Relation and function_xii
PPTX
Relations in Discrete Math
Chapter 2: Relations
relations (1).pdf
Relations and Functions.pdf
Ncert class-12-mathematics-part-1
realtion ppt for disteane maths for engg
Key Guidelines for Low-Income Housing.ptx
Abs Alg L1 Cartessian Product and Mapping.pdf
Binary Relation-1 ssssssssssssssssssssssss
duj28udehj82uh3duujd83uijdj3Relations lecture-1 (11th JEE
Lecture 3 (4).pdfbbbbbbbbbbbbbbbbbbbvvvvvvvvvvvvvvvvvvvvvvvvv
Lecture 3 (2).pdf,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
relation and operations power point presentation
RELATION_20231006_151843_0000.hhahahpptx
setRelation&functions_class_xii ppt.pptx
CMSC 56 | Lecture 13: Relations and their Properties
Set theory
Relation and function_xii
Relations in Discrete Math
Ad

More from SarowarSuman (6)

PPTX
L3_Tokens, Expression Evaluation.pptx
PPTX
Structure.pptx
PPTX
Software requirement & specification .pptx
PPT
Projectile_Motion_ppt.ppt
PDF
Enhancing-Entrance-Security-at-Daffodil-International-University-through-Tech...
PPTX
Software Testing (1).pptx
L3_Tokens, Expression Evaluation.pptx
Structure.pptx
Software requirement & specification .pptx
Projectile_Motion_ppt.ppt
Enhancing-Entrance-Security-at-Daffodil-International-University-through-Tech...
Software Testing (1).pptx
Ad

Recently uploaded (20)

PPTX
OOP with Java - Java Introduction (Basics)
PPTX
Glazing at Facade, functions, types of glazing
PPTX
CH1 Production IntroductoryConcepts.pptx
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PDF
July 2025: Top 10 Read Articles Advanced Information Technology
PPTX
Practice Questions on recent development part 1.pptx
PDF
Queuing formulas to evaluate throughputs and servers
PPT
Chapter 6 Design in software Engineeing.ppt
PPTX
Unit 5 BSP.pptxytrrftyyydfyujfttyczcgvcd
PPTX
anatomy of limbus and anterior chamber .pptx
PDF
flutter Launcher Icons, Splash Screens & Fonts
PDF
algorithms-16-00088-v2hghjjnjnhhhnnjhj.pdf
PPTX
436813905-LNG-Process-Overview-Short.pptx
PPTX
Fluid Mechanics, Module 3: Basics of Fluid Mechanics
PPTX
Internship_Presentation_Final engineering.pptx
PPTX
web development for engineering and engineering
PDF
오픈소스 LLM, vLLM으로 Production까지 (Instruct.KR Summer Meetup, 2025)
PPT
Drone Technology Electronics components_1
PDF
ETO & MEO Certificate of Competency Questions and Answers
OOP with Java - Java Introduction (Basics)
Glazing at Facade, functions, types of glazing
CH1 Production IntroductoryConcepts.pptx
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
July 2025: Top 10 Read Articles Advanced Information Technology
Practice Questions on recent development part 1.pptx
Queuing formulas to evaluate throughputs and servers
Chapter 6 Design in software Engineeing.ppt
Unit 5 BSP.pptxytrrftyyydfyujfttyczcgvcd
anatomy of limbus and anterior chamber .pptx
flutter Launcher Icons, Splash Screens & Fonts
algorithms-16-00088-v2hghjjnjnhhhnnjhj.pdf
436813905-LNG-Process-Overview-Short.pptx
Fluid Mechanics, Module 3: Basics of Fluid Mechanics
Internship_Presentation_Final engineering.pptx
web development for engineering and engineering
오픈소스 LLM, vLLM으로 Production까지 (Instruct.KR Summer Meetup, 2025)
Drone Technology Electronics components_1
ETO & MEO Certificate of Competency Questions and Answers

Relational Algebra (1).pptx

  • 2. What is Relation? • I am sure that you are familiar with many relations such as “less than,” “is parallel to,” “is a subset of,” and so on. In a certain sense, these relations consider the existence or nonexistence of a certain connection between pairs of objects taken in a definite order. • Formally, we define a relation in terms of these “ordered pairs.” • An ordered pair of elements a and b, where a is designated as the first element and b as the second element, is denoted by (a, b). In particular, • (a, b) = (c, d) • if and only if a = c and b = d. Thus (a, b) = (b, a) unless a = b. This contrasts with sets where the order of elements is irrelevant; for example, {3, 5} = {5, 3}.
  • 3. Product Sets • Consider two arbitrary sets A and B. The set of all ordered pairs (a, b) where a ∈ A and b ∈ B is called the product, or Cartesian product, of A and B. A short designation of this product is A × B, which is read “A cross B.” By definition, • A × B = {(a, b) | a ∈ A and b ∈ B} • Example: Let A = {1, 2} and B = {a, b, c}. Then • A × B = {(1, a), (1, b), (1, c), (2, a), (2, b), (2, c)} • B × A = {(a, 1), (b, 1), (c, 1), (a, 2), (b, 2), (c, 2)} • Also, A × A = {(1, 1), (1, 2), (2, 1), (2, 2)} (Here A×B ≠ B ×A)
  • 4. Number of Elements in Product Sets In our previous example, n(A × B) = 6 = 2(3) = n(A)n(B) • We can say n(A×B) = n(A)n(B)
  • 5. Relations • Let A and B be sets. A binary relation or, simply, relation from A to B is a subset of A × B. • Suppose R is a relation from A to B. Then R is a set of ordered pairs where each first element comes from A and each second element comes from B. That is, for each pair a ∈ A and b ∈ B, exactly one of the following is true: 1. (a, b) ∈ R; we then say “a is R-related to b”, written aRb. 2. (a, b) ∉ R; we then say “a is not R-related to b”, written aRb. • If R is a relation from a set A to itself, that is, if R is a subset of 𝐴2 = A×A, then we say that R is a relation on A. • The domain of a relation R is the set of all first elements of the ordered pairs which belong to R, and the range is the set of second elements.
  • 6. Example: • A = {1, 2, 3} and B = {x, y, z}, and let R = {(1, y), (1, z), (3, y)}. Then R is a relation from A to B since R is a subset of A × B. With respect to this relation, 1Ry, 1Rz, 3Ry, but • The domain of R is {1, 3} and the range is {y, z} • Set inclusion ⊆ is a relation on any collection of sets. For, given any pair of set A and B, either A ⊆ B or A ⊈ B. • A familiar relation on the set Z of integers is “m divides n.” A common notation for this relation is to write m|n when m divides n. Thus 6 | 30 but
  • 7. • Consider the set L of lines in the plane. Perpendicularity, written “⊥,” is a relation on L. That is, given any pair of lines a and b, either a ⊥b or . Similarly, “is parallel to,” written “||,” is a relation on L since either • Let A be any set. An important relation on A is that of equality, {(a, a) | a ∈ A} which is usually denoted by “=.” This relation is also called the identity or diagonal relation on A and it will also be denoted by A or simply . • Let A be any set. Then A × A and ∅ are subsets of A × A and hence are relations on A called the universal relation and empty relation, respectively.
  • 8. Inverse Relation • Let R be any relation from a set A to a set B. The inverse of R, denoted by 𝑅−1, is the relation from B to A which consists of those ordered pairs which, when reversed, belong to R; that is, • 𝑅−1 = {(b, a) | (a, b) ∈ R} • For example, let A = {1, 2, 3} and B = {x, y, z}. Then the inverse of • R = {(1, y), (1, z), (3, y)} is 𝑅−1= {(y, 1), (z, 1), (y, 3)} • Clearly, if R is any relation, then (𝑅−1)−1 = R. Also, the domain and range of 𝑅−1are equal, respectively, to the range and domain of R. Moreover, if R is a relation on A, then 𝑅−1 is also a relation on A.
  • 9. Pictorial Representation of Relation Directed Graph: • Say relation R on the set A = {1, 2, 3, 4}: R = {(1, 2), (2, 2), (2, 4), (3, 2), (3, 4), (4, 1), (4, 3)}
  • 10. Pictures of Relations on Finite Sets Suppose A and B are finite sets. There are two ways of picturing a relation R from A to B. 1. Form a rectangular array (matrix) whose rows are labeled by the elements of A and whose columns are I. labeled by the elements of B. Put a 1 or 0 in each position of the array according as a ∈ A is or is not II. related to b ∈ B. This array is called the matrix of the relation.
  • 11. 1. Write down the elements of A and the elements of B in two disjoint disks, and then draw an arrow from I. a ∈ A to b ∈ B whenever a is related to b. This picture will be called the arrow diagram of the relation. II. A = {1, 2, 3}, B = {x, y, z} and R = {(1, y), (1, z), (3, y)}