 We will be starting a topic called relations now we know we come across this word very often like when I when we write somebody's name related to us then we have to write what is the relation of myself to that person like that person can be my father mother brother or sister like that in that way there are other situations like when we when we look at students to each student we relate a number which is the end which may be the enrollment number then to each person we often relate mobile numbers or many other numbers now we will be looking at these things more systematically so we will be talking about sets of objects for example let us consider a situation where we have a set of students suppose s is equal to the set of students and n the set of enrollment numbers we know that given a student s belonging to the set s we will have a number let us say n belonging to n such that this n is the enrollment number for the student s in this way we can write a list similarly we can consider the set of names of students maybe we can write the set as t the set of names of students and again n the set of enrollment numbers now for each name let us say t belonging to T there is an enrollment number for example that number may be n belonging to N now here we see that we may have the same name associated to different enrollment numbers because there can be different students having the same name so we can have many such possibilities so here we see that naturally we are arriving at the situation where where objects belonging to two sets are related to each other we would like to look at this more systematically and therefore we will first go to a mathematical definition which is called Cartesian product now if we have two sets a and b the Cartesian product of these two sets is denoted by a cross b and it is the ordered pairs of elements of a and b we will write this as this is the notation of a set and it contains all ordered pairs a b where a belongs to a A and b belongs to B for example let us consider a to be the set 234 and b to be the set 45 then the Cartesian product a cross b is 2425 343544 and 45 we can go the other way round we can have Cartesian product of b and a write it as b cross a and we get 424344 and then here 5253 and 54 now we will we consider the case when the sets are not distinct we can have Cartesian product of the same set over and over again so we can have a cross a which is the Cartesian product of a with a and we will get 222324 then 323334 and 424344 next let us look at some examples of Cartesian product let us consider the set are which is a set of real numbers the Cartesian product of R with itself is often written as R2 and this is set of ordered pairs of elements of R so we have pairs like x, y where x and y both are in R now if we go back to our usual school geometry then we will realize that this is nothing but the real plane of which we use in coordinate geometry now we can modify the set R a little bit and we can get R plus which consists of set of all positive real numbers now if we have this set of positive real numbers then we have Cartesian product of R plus with itself and we will get again all ordered pairs but in this situation in this case this ordered pairs are such that both the elements are greater than 0 therefore we will have the first quadrant of the plane now let us look at the look at the situation over here so here we have set of positive real numbers starting from here going up here and another copy of the same set over here and R plus cross R plus consists of points in the shaded region now we come to the formal definition of relations if we start with two sets a and b which need not be distinct any subset of the Cartesian product of a and b is said to be a relation from a to b and similarly if we consider subsets of b cross a then we will get relations from b to a and if both the components of the Cartesian product are same that is if we have a cross a we write in short a square then also any subset of a cross a will give us relations technically from a to a which we usually call relations on a now let us suppose that we have a relation are from a to b in other words we have a subset are from of a cross b and now we will take an element a belonging to a and an element b belonging to b and we will say that and that a is related to b if the ordered pair a b belongs to R the fact that a ordered pair a b belongs to R is alternatively written as a RB and in fact in the context of relations we will be very often writing a RB instead of ordered pair a b belonging to R because it is more convenient and it is more intuitive because it tells us that a is related to b now we go to some examples of relations let us consider two sets again a 234 and b 45 now let us look at the Cartesian product of a and b so we have a equal to 234 and b as 45 let us check that once a is 234 and b is 45 the Cartesian product of a with b is the whole set 24 25 34 3544 and 45 okay we will consider some subsets of this Cartesian product the first of all the subset which contains nothing which is denoted by this symbol and read as 5 then the subset 24 25 then the subset 24 25 3544 and a cross b itself because a cross b is of course a subset of itself now all of them are relations from a to b Phi is said to be the empty relation because it contains no element that means with respect to with respect to Phi no element of a is related to b on the other hand the other extreme case is a cross b which contains everything if you pick up any element in a and another element in b it definitely is in a cross b so it is related and then we have intermediates which are in fact more meaningful so we have 2425 that means 2 is related to 5 4 and 2 is related to 5 and nothing else no other elements related then 24253544 this is another relation where we have 2 is related to 4 2 is related to 5 3 is related to 5 4 is related to 4 and that is all so these are relations on a cross b now we look look at other relations we go back to the set which we were discussing a while back so we consider z plus which is a set of positive integers and we consider relation r on a which is in fact z plus which is given by all ordered pairs of x y in case x is less than or equal to y now this means that given two elements in z plus that is positive real numbers I have to compare them suppose I have got two elements a x and y I pick them up and if x is less than or equal to y I say x is related to y I may write x, y belonging to r or x is related to y and if they are not related then they are not related that will they will not be related if x is greater than y we can in fact draw a graph here so suppose this is 1 2 3 4 1 2 3 4 then we have 1 is related to 1 1 is related to 2 1 is related to 3 1 is related to 4 and so on now starting from 2 2 is related to 2 2 is related to 3 2 is related to 4 and so on 3 3 is related to 3 3 is related to 4 and so on 4 4 is related to 4 4 is related to 5 and so on we go to another example now this is an example consisting of set a set and power set of that by power set of a set we mean the set of all subsets of that set let us look at the examples of some power sets now suppose we have the set S which is equal to 1 2 then the set of power sets of S is written as PS which is equal to ? that is the empty set then 1 which is the single term containing 1 then 2 which is a single term containing 2 and 1 2 which is the whole set so this is the power set of 1 2 then we can consider S to be equal to 1 2 and 3 and the power set of S is ? then 1 then 2 then 3 then we will have 1 2 we will have 1 3 and then we will have 2 3 and ultimately we will have the whole set 1 2 3 now within the power set we can consider a relation defined by the set containment that is we will say that two sets a b belonging to the power set of S are related if a is contained in b now let us look at the slide we have a b belonging to the power set of S we define the relation R on PS by a RB if and only if a is a subset of B very often instead of writing R we will simply write the subset equal to notation now suppose we consider the set S then as we have seen that the power set of S is ? 1 2 and 1 2 and the containment relation is ? ? ? 1 ? 2 because ? is a subset of what ? is a subset of itself ? is a subset of 1 ? is a subset of 2 ? is a subset of 1 2 then if we when we start with 1 1 is a subset of 1 1 is a subset of 1 2 then we start with 2 2 is a subset of 2 2 is a subset of 1 2 and eventually 1 2 is a subset of the set 1 to itself so this listing gives us the relation defined by subset subset equal relation okay next we now take up another relation our underlying set is now the set of integers and we define a relation which is commonly called the divisibility relation we write the relation by the symbol a vertical straight line we call this relation which is a what which we denote by a vertical set straight line on z as follows a b belonging to z for a b belonging to z a the straight line B if and only if a divides B so we will commonly say that a is related to B if a divides B for example if we consider 2 and 6 then of course 2 divides 6 so we will write 2 then the vertical straight line and 6 but if we compare 3 and 5 3 does not divide 5 so we will write 3 then the straight line and the cancel and 5 which we will read as 3 does not divide 5 next we will take up another relation which is extremely important in mathematics and computer science this is called congruence modulo relation but to understand this let us start with some examples here also we consider the set z which is a set of all integers then let us pick up a positive number that is a positive integer so let us pick up 7 of course 7 belongs to z and we pick up 2 integers and take their difference we will say that these two integers are congruent modulo 7 if their difference is divisible by 7 for example if we consider 14 and 28 let us see what happens let us say x is equal to 14 and y equal to 28 y-x is 28-14 is equal to 14 and it is of course clear that 7 divides 14 and therefore we will say that x that is 14 is congruent to y modulo 7 and we will write it as x y mod 7 we will read as x congruent to y modulo 7 now we see that there is nothing special about this 7 we can we can we can take any integer any positive integer m and we define the same thing that is we pick up two elements a and b belonging to z and we say that a congruent to be mod m if m divides b-a so as we have already seen that that 14 is congruent to 14 is congruent to 28 modulo 7 but if we consider 30 what about 14 and 30 we have to take the difference of 14 and 30 which is 16 and definitely 7 does not divide 16 and hence 14 is not congruent to 13 mod 7 we write like this suppose z is the set of integers and m is a positive integer for any a, b belonging to z we write a then this symbol b mod m well which we read as a is congruent to b modulo m if and only if m divides b-a now we take up another example let us consider m equal to 5 now we pick up the integer 1 and we pick up the integer 6 if you consider 1 and 6 then we will see that 1 is congruent to 6 modulo 5 but we can go one step forward we can say that I would like to know all the integers which are congruent to 1 modulo 5 can we find it yes we can find it as we see that we have 1 over here and we add 5 to it then we have 6 then we add another 5 to it then we have 11 then 16 and so on and we subtract 5 to it we get – 1 – 4 then we subtract 10 to 1 we subtract 10 from 1 to get – 9 and so on therefore we will get this so we can in fact write a general relation general formula that we will see over here here our aim is equal to 5 and then our element x we are taking as 1 so I want to know all the elements which are which are congruent to 1 modulo 5 so all these elements will form a set that set I am denoting by square bracket 1 I am writing this as set of all the elements in Z congruent to 1 modulo 5 then what are these elements in general if we consider an element in this way 1 plus n times 5 where n belongs to Z we will get all the elements in this way by changing the values of n for example when n equal to 0 we get 1 when n equal to 1 we get 6 when n equal to 2 we get 11 when n equal to 3 we get 16 when n equal to 4 we get 21 and so on when n equal to – 1 what we have to do is 1 – 1 plus – 1 5 so 1 – 5 this is – 4 when n equal to – 2 this is 1 plus – 2 into 5 this is 1 – 10 is – 9 n equal to – 3 1 plus – 3 into 5 that is 1 – 15 which is equal to – 14 n equal to – 4 1 plus – 4 5 so this is – 20 so I get – 19 a part of this listing we have already seen in the previous slide we can extend this we can say that okay now I want to know all the elements which are congruent to 2 modulo 5 and this set we will write this the elements of this set can be generated from the formula 2 plus n into 5 when n equal to 0 2 plus 0 into 5 gives me 2 when n equal to 1 2 plus 1 into 5 gives me 7 when n equal to 2 2 plus 2 into 5 give me 12 and so on when n equal to – 1 I get 2 plus – 1 times 5 which is 2 – 5 so it is – 3 when n equal to – 2 I get 2 plus – 2 into 5 which is equal to 2 – 10 which is – 8 and we can see that all these elements are congruent to 2 modulo 5 and in fact we can see something more that if we pick up elements any two elements from this listing they will be congruent to each other modulo 5 and if we pick up elements from this different listing for example from one from here and one from here then we will see that these elements are not congruent to each other modulo 5 we will see this thing more in more details in later lectures now we come to operations on relation as we have already seen that a relation is after all a subset now we have a relation from a to b therefore it is a subset of the Cartesian product of a and b that is a cross b and since it is a subset of a cross b if we take several relations from a to b these subsets will interact with each other through the set theoretic operations the most common set theoretic operations that we have are union intersection and complementation so if we have two relations from a to b in other words we have two relations two subsets of a cross b of course we can take the union of these two subsets so we can suppose we have two relations we denote by R1 and R2 from a to b we can consider R1 union R2 similarly we can also consider R1 intersection R2 and given any relation let us say R1 we can consider its complement now if we translate this to see what happens to this relations so if we have two relations R and S from a to b again that means two subsets of a cross b which at which we are denoting by R and S the a which is an element of capital A and small b which is the element of capital B a is related to b with respect to the relation R union S if and only if a is related to b or a is related to b through S I repeat again a is related to be through the relation R union S if and only if a is related to be through the relation R or a is related to be through the relation S a is related to be through the relation a intersect R intersection S if and only if a is related to be through R and a is related to be through S and if we consider the unary operation complementation on the set R that is a relation R so we have R bar which is R complement a related to be through the relation R bar if and only if the ordered pair a b is not in R that is a is related to be through R bar if and only if a is not related to be through R let us look at some examples of operations on relations now we have again a set a which is which consists of 1 2 3 4 and we have a relation R on a that is a relation on from a to a that is a subset of a cross a given by the ordered pair 1 2 1 3 1 4 and another relation S again on a given by the ordered pair 1 2 2 3 4 4 then a R union S is the simple set theoretic union of these two subsets of a cross a if we take the union we will see that it is the ordered pair 1 2 1 3 2 4 2 3 and 4 4 similarly we can consider the relation R intersection S and then we have to search for the common elements in R and S we see that this 1 2 is common in both R and S whereas there are there is there is no other element which appear both in R and S therefore R intersection S is simply 1 2 and if we would like to know the complementation we will have to take the set theoretic minus in short a set minus so we have to take the whole set of Cartesian product of a and take the set minus R that is a set of all elements that are in a cross a but not in R and then we will then we will get the relation R bar next we will come to the another way of combining relation which we call composition of relations suppose R is a relation from a to S suppose R is a relation from a to B and S is a relation from B to C for a belong a small a belonging to a and small c belonging to C we will say that a is related to C by the relation R composition S if and only if there exists B belonging to capital B such that a is let a RB that is a is related to B through R and B is related to C through R here we have a set a this is a set a and we have a set B this is a set B and we have another set set C we have a relation from a to B which we denote by R another relation from B to C which we denote by S so R is a subset of a x B and a is a subset of B x C we are trying to define a relation which we denote by R composition S suppose we have an element a in capital A and an element C in capital C will try to start from a and try to relate it to some element in B suppose it is related to the element small b in capital B and suppose it happens that this small b again is related to C in capital C then we say that a is R composition S C this gives us the definition since there exists B belonging to capital B such that a RB and B are C now if it so happens that a is related to something here but let us say B dash and this is related to nothing this is sorry this is not related to anything over here then there is then a is not connected to any element in C so a is not related to any element in C or it may so happen that we have an element let us say a dash in capital A and C dash in C such that there is no element in B with the property that a dash is related to that element and that element is related to C then we will say that a is not related to C dash now what we can do is that it is not necessary that ABC are distinct ABC may be same as written here suppose a equal to b equal to C so all of them all BC we are writing them as a so we can compose a relation on a that is a to a over and over again so we will write R raise to the power n as R composed R composed R composed and so on composed R n times for example if it is R square it is R composition R if is R cube it is R composition R composition R so in this way we can we can define powers of relations let us look at some examples again we consider the set 1 2 3 4 and relation on a which is given by 1 2 1 3 2 4 and another relation s which is given by 1 2 2 3 and 4 4 yeah and then we have to find out the relation so let me write down the relation a okay so we have a equal to 1 2 3 4 R equal to 1 2 1 3 2 4 and s equal to let us quickly go back 1 2 2 3 4 4 1 2 2 3 and 4 4 then we have to compute R composition s how to do that I start with 1 I have written 1 over here I go to 2 yes 1 is related to 2 now we see in s whether 2 is related to anything yes indeed 2 is related to 3 so I write 1 3 1 3 is an element of R composition s now is there anything else no 1 going to 2 but 2 is related to only 3 in s now we come to 1 goes to 3 1 goes to 3 then I ask a question let us cancel this so I write only 1 here 3 is my intermediate element and we see whether 3 is somewhere in s 3 is nowhere in s so it does not appear in R composition s now I come to 2 now 2 is 2 is related to 4 and 4 is related to 4 so 2 4 will appear in R composition s therefore R composition s will have only 2 elements 1 3 and 2 4 which we have over here so this is all about today thank you.