Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • Number System and Arithmetic
  • Algebra
  • Set Theory
  • Probability
  • Statistics
  • Geometry
  • Calculus
  • Logarithms
  • Mensuration
  • Matrices
  • Trigonometry
  • Mathematics
Open In App
Next Article:
Piecewise Function
Next article icon

Domain and Range of Relations

Last Updated : 28 Apr, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

The domain is the set of all possible input values (the “x” values), and the range is the set of all possible output values (the “y” values) in a relation.

For any two non-empty sets A and B, we define the relation R as the subset of the Cartesian product of A × B where each member of set A is related to a member of set B through some unique rule.

We defined relation as,

R = {(x,y): x ∈ A and y ∈ B}

Example: The relation R = {(1,1), (2,4), (3,9)} and it is represented using following diagram:

Relation

Set Relation Diagram

Read More about Relations.

As we know, any set of ordered pairs that are related to a unique relation we have domain and range, i.e., for R such that R(A × B,) such that {(a, b) where a ∈ A and b ∈ B} we have domain and range of R. 

Here, the set of values of A is called the domain, and the set of values of b is called the range.

Domain of a Relation

The domain of any Relation is the set of input values of the relation. For example, if we take two sets A and B, and define a relation R: {(a,b): a ∈ A, b ∈ B}, then the set of values of A is called the domain of the function.

The image given below represents the domain of a relation.

Relations-and-Functions-1

Domain of the Relation

Range of a Relation

Range of any Relation is the set of output values of the relation. For example, if we take two sets A and B, and define a relation R: {(a,b): a ∈ A, b ∈ B}, then the set of values of B is called the domain of the function.

The image given below represents the range of a relation.

Relations-and-Functions-4

Range of the Relation

Codomain of a Relation

We define the codomain of the relation R as the set B of the Cartesian product A×B on which the relation is defined. Now it is clear that the range of the function is a proper subset of the Codomain.

Range ⊆ Codomain

Relations-and-Functions-3

Range and Co domain

Example: Take a set S = {4, 5, 6, 9,10,11,12,13, 17} and define a relation A from S to S such that in the ordered pair (x,y) in A, y is two more than x.

Solution:

We define R as,

S = {4, 5, 6, 9, 10, 11, 12,1 3, 17}
y = x + 2 , we want to pair it with another element y from the same set such that y is exactly 2 more than x.
Pairs:
x = 4, x + 2 = 6 ∈ S ⇒ (4, 6) ∈ A
x = 5, x + 2 = 7 ∉ S ⇒ (5, 7) ∉ A
.
.
.
Valid pairs we found: (4, 6), (9, 11), (10, 12),(11, 13)

R = {(4, 6), (9, 11), (10, 12),(11, 13)} 

Thus,

  • Domain of R is (4, 9, 10, 11) 
  • Range of R is (6, 11, 12, 13)
  • Codomain is (4, 5, 6, 9,10,11,12,13, 17)

How to Find the Domain and Range of a Relation?

Steps to find the Domain and Range of any relation are given as follows:

Steps to Find the Domain

We can find the domain of relation in many different ways, depending on the provided information. Steps to find the domain are listed below:

From a Set of Ordered Pairs

  • List all the unique x-values from the given ordered pairs.
  • Example: For the relation {(1, 2), (3, 4), (5, 6)}, the domain is {1, 3, 5}.

From an Equation

  • Identify the values of x for which the relation is defined.
  • Exclude x-values that make the equation undefined, such as:
    • Division by zero.
      • For y = 1/x​, x ≠ 0, so the domain is x ∈ R∖{0}.
    • Square roots of negative numbers (for real-valued relations).
      • For y = √(x − 3)​, x − 3 ≥ 0, so the domain is x ≥ 3.

From a Graph

  • Observe the horizontal extent of the graph.
  • Identify all the x-values covered by the graph.

Steps to Find Range

We can find the range of relation in many different ways, depending on the provided information. Steps to find the domain are listed below:

From a Set of Ordered Pairs

  • List all the unique y-values from the given ordered pairs.
  • Example: For the relation {(1, 2), (3, 4), (5, 6)}, the range is {2, 4, 6}.

From an Equation

  • Express y in terms of x, and determine all possible y-values.
    • For y = x2, y ≥ 0, so the range is y ∈ [0,∞).
  • Consider restrictions on y based on the equation.
    • For y = 1/x​, y ≠ 0, so the range is y ∈ R∖{0}.

From a Graph

  • Observe the vertical extent of the graph.
  • Identify all the y-values covered by the graph.

Read More,

  • Relations and Functions
  • Types of Relations
  • Domain and Range of a Function

Solved Question on Domain and Range of a Relation

Question 1: Find the domain and range of the relation R: {(a,a2) | a ∈ A, a2 ∈ A} which is defined on A×A and the set A = {1,2,3,4,5,6,7,8,9}.

Solution:

Set A = {1, 2, 3, 4, 5, 6, 7, 8, 9}

Relation R = {(a,a2) | a ∈ A, a2 ∈ A} , defined on A×A
If
a = 1 : a2 = 1 ⇒ (1, 1) a2∈ A
a = 2 : a2 = 4 ⇒ (2, 4) a2∈ A
a = 3 : a2 = 9 ⇒ (3, 9) a2∈ A
a = 4 : a2 = 16 ⇒ (4, 16) a2∉ A

Relation R is defined as,

R = {(1,1), (2,4), (3,9)}

  • Domain of R = {1,2,3}
  • Range of R = {1,4,9}
  • Codomain of R = Set A = = {1,2,3,4,5,6,7,8,9}

Question 2: Find the domain and range of the relation R: {(a, a+3) | a ∈ A, a2 ∈ A} which is defined on A×A and the set A = {1, 2, 3, 4, 5, 6, 7, 8, 9}.

Solution:

Set A = {1, 2, 3, 4, 5, 6, 7, 8, 9}

Relation R={(a, a +3 )|a ∈ A ,a2∈ A}, defined on A×A
Check values of a in A for which a2 ∈ A
If
a = 1 : a2 = 1 ⇒ (1, 1) a2∈ A
a = 2 : a2 = 4 ⇒ (2, 4) a2∈ A
a = 3 : a2 = 9 ⇒ (3, 9) a2∈ A
a = 4 : a2 = 16 ⇒ (4, 16) a2∉ A

Now form the ordered pairs (a, a + 3):
For

a = 1 : (1, 4)
a = 2 : (2, 5)
a = 3 : (3, 6)

Relation R is defined as,

R = {(1, 4),(2, 5),(3, 6)}

  • Domain of R = {1,2,3}
  • Range of R = {4,5,6}
  • Codomain of R = Set A = {1, 2, 3, 4, 5, 6, 7, 8, 9}

Question 3: Find the domain and range of the relation R: {(a, b) | a+b = 7 a ∈ A, b ∈ B} which is defined on A×B and the set A = {1, 2, 3, 4} B = {5, 6, 7, 8, 9}.

Solution:

Set A={1, 2, 3, 4}

Set B={5, 6, 7, 8, 9}

Relation R={(a, b)∣a + b = 7, a ∈ A, b ∈ B}
If
a = 1 : a + b = 7, b = 6 ⇒ (1, 6) B∈ A
a = 2 : a + b = 7, b = 5⇒ (2, 5) B∈ A
a = 3 : a + b = 7, b = 4⇒ (3, 4) B∉ A
a = 4 : a + b = 7, b = 3⇒ (4, 3) B∉ A

Relation R is defined as,

R = {(1,6), (2,5)}

  • Domain of R = {1, 2}
  • Range of R = {6, 5}
  • Codomain of R = Set B = {5, 6, 7, 8, 9}


Next Article
Piecewise Function
author
apoorvadaga
Improve
Article Tags :
  • Class 11
  • Mathematics
  • School Learning
  • Technical Scripter
  • Maths-Class-11
  • Technical Scripter 2020

Similar Reads

  • CBSE Class 11 Maths Notes
    CBSE Class 11 Maths Revision Notes have been designed in the most basic and detailed format possible, covering nearly all domains such as differential calculus, arithmetic, trigonometry, and coordinate geometry. We know how hard it gets when you shift to an altogether new grade where subjects are no
    15+ min read
  • Chapter 1: Sets

    • Representation of a Set
      Sets are defined as collections of well-defined data. In Math, a Set is a tool that helps to classify and collect data belonging to the same category. Even though the elements used in sets are all different from each other, they are all similar as they belong to one group. For instance, a set of dif
      7 min read

    • Types Of Sets
      In mathematics, a set is defined as a well-defined collection of distinct elements that share a common property. These elements— like numbers, letters, or even other sets are listed in curly brackets "{ }" and represented by capital letters. For example, a set can include days of the week. The diffe
      13 min read

    • Universal Sets
      Universal Set is a set that has all the elements associated with a given set, without any repetition. Suppose we have two sets P = {1, 3, 5} and Q = {2, 4, 6} then the universal set of P and Q is U = {1, 2, 3, 4, 5, 6}. We generally use U to denote universal sets. Universal Set is a type of set that
      6 min read

    • Venn Diagram
      Venn Diagrams are used for the visual representation of relationships as they provide a clear, visual method for showing how different sets intersect, overlap, or remain distinct. They are essential tools in mathematics and logic for illustrating the relationships between sets. By employing intersec
      15 min read

    • Operations on Sets
      Sets are fundamental in mathematics and are collections of distinct objects, considered as a whole. In this article, we will explore the basic operations you can perform on sets, such as union, intersection, difference, and complement. These operations help us understand how sets interact with each
      15+ min read

    • Union of Sets
      Union of two sets means finding a set containing all the values in both sets. It is denoted using the symbol '∪' and is read as the union. Example 1:If A = {1, 3. 5. 7} and B = {1, 2, 3} then A∪B is read as A union B and its value is,A∪B = {1, 2, 3, 5, 7} Example 2:If A = {1, 3. 5.7} and B = {2, 4}
      13 min read

    Chapter 2: Relations & Functions

    • Cartesian Product of Sets
      'Product' mathematically signifies the result obtained when two or more values are multiplied together. For example, 45 is the product of 9 and 5. One must be familiar with the basic operations on sets like Union and Intersection, which are performed on 2 or more sets. Cartesian Product is also one
      7 min read

    • Relations and Functions
      In mathematics, we often deal with sets of numbers or objects and the ways they are connected. Two important concepts that help us describe these connections are relations and functions. A relation is simply a connection between two sets of objects. Think of it as a rule that pairs elements from one
      3 min read

    • Domain and Range of Relations
      The domain is the set of all possible input values (the "x" values), and the range is the set of all possible output values (the "y" values) in a relation. For any two non-empty sets A and B, we define the relation R as the subset of the Cartesian product of A × B where each member of set A is relat
      8 min read

    • Piecewise Function
      Piecewise Function is a function that behaves differently for different types of input. As we know a function is a mathematical object which associates each input with exactly one output. For example: If a function takes on any input and gives the output as 3. It can be represented mathematically as
      11 min read

    • Range of a Function
      Functions in math can be thought of as vending machines. Given the money in the form of input, they give some cans or cookies in return. Similarly, functions take some input numbers and give us some output. It can be said that, in real life, Everything can be formulated and solved with the help of f
      7 min read

    Chapter 3: Trigonometric Functions

    • Measuring Angles
      Measurement of angles is very important in geometry for solving various geometrical problems and comparing angles in various geometrical figures. We use various geometric tools such as a protractor, and a compass for measuring angles. There are various types of angles measured by us and before learn
      7 min read

    • Trigonometric Functions
      Trigonometric Functions, often simply called trig functions, are mathematical functions that relate the angles of a right triangle to the ratios of the lengths of its sides. Trigonometric functions are the basic functions used in trigonometry and they are used for solving various types of problems i
      6 min read

    • Trigonometric Functions of Sum and Difference of Two Angles
      Trigonometry is a branch of mathematics, which deals with the angles, lengths, and heights of triangles and their relationships. It had played an important role in calculating complex functions or large distances which were not possible to calculate without trigonometry. While solving problems with
      15+ min read

    Chapter 4: Principle of Mathematical Induction

    • Principle of Mathematical Induction
      Mathematical induction is a concept in mathematics that is used to prove various mathematical statements and theorems. The principle of mathematical induction is sometimes referred to as PMI. It is a technique that is used to prove the basic theorems in mathematics which involve the solution up to n
      11 min read

    Chapter 5: Complex Numbers and Quadratic Equations

    • Complex Numbers
      Complex numbers are an essential concept in mathematics, extending the idea of numbers to include solutions for equations that don't have real solutions. Complex numbers have applications in many scientific research areas, signal processing, electromagnetism, fluid dynamics, quantum mechanics, and v
      13 min read

    • Algebra of Real Functions
      The algebra of real functions refers to the study and application of algebraic operations on functions that map real numbers to real numbers. A function can be thought of as a rule or set of rules which map an input to an output knows as its image. It is represented as x ⇢ Function ⇢ y. A real funct
      5 min read

    • Algebraic Operations on Complex Numbers
      A complex number is a number that includes both a real and an imaginary part. It is written in the form: z = a + bi Where: a is the real part,b is the imaginary part,i is the imaginary unit, satisfying i2 = −1. Algebraic operations on complex numbers follow specific rules based on their real and ima
      8 min read

    • Polar Representation of Complex Numbers
      Complex numbers, which take the form z = x + yi, can also be represented in a way that highlights their geometric properties. This alternative representation is known as the polar form. The polar representation of a complex number expresses it in terms of its magnitude (modulus) and direction (argum
      10 min read

    • Absolute Value of a Complex Number
      The absolute value (also called the modulus) of a complex number z = a + bi is its distance from the origin in the complex plane. It is denoted as ∣z∣ and is given by the formula: [Tex]|z| = \sqrt{ (a2 + b2)}[/Tex] Where: a is the real part of z,b is the imaginary part of z,The square root operation
      7 min read

    • Conjugate of Complex Numbers
      In the world of mathematics, complex numbers are one of the most important discoveries by mathematicians as they help us solve many real-life problems in various fields such as the study of electromagnetic waves, engineering, and physics. The Conjugate of a Complex Number is also a complex number ob
      7 min read

    • Imaginary Numbers
      Imaginary numbers are numbers as the name suggests are the number that is not real numbers. All the numbers real and imaginary come under the categories of complex numbers. Imaginary numbers are very useful in solving quadratic equations and other equations whose solutions can not easily be found us
      9 min read

    Chapter 6: Linear Inequalities

    • Compound Inequalities
      Compound Inequalities are the combination of two or more inequalities. These inequalities are combined using two conditions that are AND, and OR. These conditions have specific meanings and they are solved differently. The inequities in compound inequalities are individually solved using normal rule
      11 min read

    • Algebraic Solutions of Linear Inequalities in One Variable and their Graphical Representation - Linear Inequalities | Class 11 Maths
      A linear inequality is a mathematical expression involving an inequality symbol (<, >, ≤, or ≥) and a linear expression. Unlike linear equations, which give a specific solution, linear inequalities define a range of possible solutions. Example: 2x+3>5 In this case, the inequality indicates
      7 min read

    • Graphical Solution of Linear Inequalities in Two Variables
      We know how to formulate equations of different degree, and it is used a lot in real life, but the question arises, is it always possible to convert a situation into an equation? Sometimes we get statements like, the number of Covid cases per day in Delhi has reached more than 10,000. This phrase “L
      8 min read

    • Solving Linear Inequalities Word Problems
      We are well versed with equations in multiple variables. Linear Equations represent a point in a single dimension, a line in a two-dimensional, and a plane in a three-dimensional world. Solutions to linear inequalities represent a region of the Cartesian plane. It becomes essential for us to know ho
      11 min read

    Chapter 7: Permutations and Combinations

    • Fundamental Principle of Counting
      Fundamental Principle of Counting is the basic principle that helps us to count large numbers in a non-tedious way. Suppose we have to guess the pin of a three-digit code so the number of ways we can guess is 1000 this can be seen as the pin can be, 000, 001, 002, ....., 999 any number between 000,
      11 min read

    • Permutation
      In Mathematics, Permutation is defined as a mathematical concept that determines the number of possible arrangements for a specific set of elements. therefore, it plays a big role in computer science, cryptography, and operations research. For example, take a set {1, 2, 3}:All Permutations taking al
      15+ min read

    • Combinations
      Combination is a way of choosing items from a set, (unlike permutations) when the order of selection doesn't matter. In smaller cases, it's possible to count the number of combinations. Combination refers to the mixture of n things taken k at a time without repetition. Example: For set S = {a, b, c}
      9 min read

    Chapter 8: Binomial Theorem

    • Binomial Theorem
      Binomial theorem is a fundamental principle in algebra that describes the algebraic expansion of powers of a binomial. According to this theorem, the expression (a + b)n where a and b are any numbers and n is a non-negative integer. It can be expanded into the sum of terms involving powers of a and
      15+ min read

    • Pascal's Triangle
      Pascal's Triangle is a triangular arrangement of numbers where each number is the sum of the two numbers directly above it in the previous row. It is named after the French mathematician Blaise Pascal, although it was studied by mathematicians in various cultures long before him. Structure of Pascal
      9 min read

    Chapter 9: Sequences and Series

    • Sequences and Series
      A sequence is an ordered list of numbers following a specific rule. Each number in a sequence is called a "term." The order in which terms are arranged is crucial, as each term has a specific position, often denoted as an​, where n indicates the position in the sequence. For example: 2, 5, 8, 11, 14
      7 min read

    • General and Middle Terms - Binomial Theorem - Class 11 Maths
      Binomial theorem or expansion describes the algebraic expansion of powers of a binomial. According to this theorem, it is possible to expand the polynomial "(a + b)n" into a sum involving terms of the form "axzyc", the exponents z and c are non-negative integers where z + c = n, and the coefficient
      7 min read

    • Arithmetic Series
      An arithmetic series is the sum of the terms of an arithmetic sequence, where an arithmetic sequence is a sequence of numbers in which the difference between consecutive terms is constant. Or we can say that an arithmetic progression can be defined as a sequence of numbers in which for every pair of
      5 min read

    • Arithmetic Sequence
      An arithmetic sequence or progression is defined as a sequence of numbers in which the difference between one term and the next term remains constant. For example: the given below sequence has a common difference of 1. 1 2 3 4 5 . . . n ⇑ ⇑ ⇑ ⇑ ⇑ . . . 1st 2nd 3rd 4th 5th . . . nth Terms The Arithme
      8 min read

    • Geometric Progression or GP
      Geometric Progression (GP) is a sequence of numbers where each term after the first is found by multiplying the previous term by a constant called the common ratio. For Example, the sequence given below forms a GP with a common ratio of 2 1 2 4 8 16 . . . n⇑ ⇑ ⇑ ⇑ ⇑ . . . 1st 2nd 3rd 4th 5th . . . n
      11 min read

    • Geometric Series
      In a Geometric Series, every next term is the multiplication of its Previous term by a certain constant, and depending upon the value of the constant, the Series may increase or decrease. Geometric Sequence is given as: a, ar, ar2, ar3, ar4,..... {Infinite Sequence}a, ar, ar2, ar3, ar4, ....... arn
      3 min read

    • Arithmetic Progression and Geometric Progression
      Arithmetic Progression and Geometric Progression: The word "sequence" in English means a collection of some numbers or objects in such a way that it has a first member, a second member, and so on. Sequences can be of anything, for example. - January, February, .... is the sequence of months in a yea
      11 min read

    • Special Series in Maths - Sequences and Series | Class 11 Maths
      Special Series: A series can be defined as the sum of all the numbers of the given sequence. The sequences are finite as well as infinite. In the same way, the series can also be finite or infinite. For example, consider a sequence as 1, 3, 5, 7, … Then the series of these terms will be 1 + 3 + 5 +
      10 min read

geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences