# Section6.1Relations

A relation in mathematics is a symbol that can be placed between two numbers (or variables) to create a logical statement (or open sentence). The main point here is that the insertion of a relation symbol between two numbers creates a statement whose value is either true or false. For example, we have previously seen the divisibility symbol ($\mid$) and noted the common error of mistaking it for the division symbol ($/$); one of these tells us to perform an arithmetic operation, the other asks us whether if such an operation were performed there would be a remainder. There are many other symbols that we have seen which have this characteristic, the most important is probably $=$, but there are lots: $\neq$, $\lt$, $\leq$, $>$, $\geq$ all work this way — if we place them between two numbers we get a Boolean thing, it's either true or false. If, instead of numbers, we think of placing sets on either side of a relation symbol, then $=$, $\subseteq$ and $\supseteq$ are valid relation symbols. If we think of placing logical expressions on either side of a relation then, honestly, any of the logical symbols is a relation, but we normally think of $\land$ and $\lor$ as operators and give things like $\equiv$, $\implies$ and $\iff$ the status of relations.

In the examples we've looked at the things on either side of a relation are of the same type. This is usually, but not always, the case. The prevalence of relations with the same kind of things being compared has even lead to the aphorism “Don't compare apples and oranges.” Think about the symbol $\in$ for a moment. As we've seen previously, it isn't usually appropriate to put sets on either side of this, we might have numbers or other objects on the left and sets on the right. Let's look at a small example. Let $A = \{1,2,3,a,b\}$ and let $B=\{ \{1,2,a\}, \{1,3,5,7,\ldots\}, \{1\} \}$. The “element of” relation, $\in$, is a relation from $A$ to $B$.

A diagram such as we have given in <<Unresolved xref, reference "fig_rel1"; check spelling or use "provisional" attribute>> seems like a very natural thing. Such pictures certainly give us an easy visual tool for thinking about relations. But we should point out certain hidden assumptions. First, they'll only work if we are dealing with finite sets, or sets like the odd numbers in our example (sets that are infinite but could in principle be listed). Second, by drawing the two sets separately, it seems that we are assuming they are not only different, but disjoint. The sets not only need not be disjoint, but often (most of the time!) we have relations that go from a set to itself so the sets in a picture like this may be identical. In <<Unresolved xref, reference "fig_rel2"; check spelling or use "provisional" attribute>> we illustrate the divisibility relation on the set of all divisors of 6 — this is an example in which the sets on either side of the relation are the same. Notice the linguistic distinction, we can talk about either “a relation from $A$ to $B$” (when there are really two different sets) or “a relation on $A$” (when there is only one).

Purists will note that it is really inappropriate to represent the same set in two different places in a Venn diagram. The diagram in <<Unresolved xref, reference "fig_rel2"; check spelling or use "provisional" attribute>> should really look like this: \ifx\SetFigFont\undefined\gdef\SetFigFont#1#2#3#4#5{ \reset@font\fontsize{#1}{#2pt} \fontfamily{#3}\fontseries{#4}\fontshape{#5} \selectfont}\fi Indeed, this representation is definitely preferable, although it may be more crowded. A picture such as this is known as the directed graph (a.k.a. digraph) of the relation.

Recall that when we were discussing sets we said the best way to describe a set is simply to list all of its elements. Well, what is the best way to describe a relation? In the same spirit, it would seem we should explicitly list all the things that make the relation true. But it takes a pair of things, one to go on the left side and one to go on the right, to make a relation true (or for that matter false!). Also it should be evident that order is important in this context, for example $2\lt 3$ is true but $3\lt 2$ isn't. The identity of a relation is so intimately tied up with the set of ordered pairs that make it true, that when dealing with abstract relations we define them as sets of ordered pairs.

Given two sets, $A$ and $B$, the Cartesian product of $A$ and $B$ is the set of all ordered pairs $(a,b)$ where $a$ is in $A$ and $b$ is in $B$. We denote the Cartesian product using the symbol ×. \begin{equation*} A \times B = \{ (a,b) \suchthat a \in A \land b \in B \} \end{equation*}

From here on out in your mathematical career you'll need to take note of the context that the symbol × appears in. If it appears between numbers go ahead and multiply, but if it appears between sets you're doing something different — forming the Cartesian product.

The familiar $x$–$y$ plane, is often called the Cartesian plane. This is done for two reasons. Rene Descartes, the famous mathematician and philosopher, was the first to consider coordinatizing the plane and thus is responsible for our current understanding of the relationship between geometry and algebra. Rene Descartes' name is also memorialized in the definition of the Cartesian product of sets, and the plane is nothing more than the product $\Reals \times \Reals$. Indeed, the plane provided the very first example of the concept that was later generalized to the Cartesian product of sets.

##### Exercise6.1.1

Suppose $A = \{1,2,3\}$ and $B = \{a,b,c\}$. Is $(a,1)$ in the Cartesian product $A \times B$? List all elements of $A \times B$.

In the abstract, we can define a relation as any subset of an appropriate Cartesian product. So an abstract relation $\relR$ from a set $A$ to a set $B$ is just some subset of $A \times B$. Similarly, a relation $\relR$ on a set $S$ is defined by a subset of $S \times S$. This definition looks a little bit strange when we apply it to an actual (concrete) relation that we already know about. Consider the relation “less than.” To describe “less than” as a subset of a Cartesian product we must write \begin{equation*} \lt \; = \; \{ (x,y) \in \Reals \times \Reals \suchthat y-x \in \Reals^+ \}. \end{equation*}

This looks funny.

Also, if we have defined some relation $\relR \subseteq A \times B$, then in order to say that a particular pair, $(a,b)$, of things make the relation true we have to write \begin{equation*} a\relR b. \end{equation*}

This looks funny too.

Despite the strange appearances, these examples do express the correct way to deal with relations.

Let's do a completely made-up example. Suppose $A$ is the set $\{a,e,i,o,u\}$ and $B$ is the set $\{r,s,t,l,n\}$ and we define a relation from $A$ to $B$ by \begin{equation*} \relR = \{ (a,s), (a,t), (a,n), (e,t), (e,l), (e,n), (i,s), (i,t), (o,r), (o,n), (u,s) \}. \end{equation*}

Then, for example, because $(e,t) \in \relR$ we can write $e \relR t$. We indicate the negation of the concept that two elements are related by drawing a slash through the name of the relation, for example the notation $\neq$ is certainly familiar to you, as is $\nless$ (although in this latter case we would normally write $\geq$ instead). We can denote the fact that $(a,l)$ is not a pair that makes the relation true by writing $a \nrelR l$.

We should mention another way of visualizing relations. When we are dealing with a relation on $\Reals$, the relation is actually a subset of $\Reals \times \Reals$, that means we can view the relation as a subset of the $x$–$y$ plane. In other words, we can graph it. The graph of the “$\lt$” relation is given in <<Unresolved xref, reference "fig_lt_graph"; check spelling or use "provisional" attribute>>.

A relation on any set that is a subset of $\Reals$ can likewise be graphed. The graph of the “$\mid$” relation is given in <<Unresolved xref, reference "fig_div_graph"; check spelling or use "provisional" attribute>>.

Eventually, we will get around to defining functions as relations that have a certain nice property. For the moment, we'll just note that some of the operations that you are used to using with functions also apply with relations. When one function “undoes” what another function “does” we say the functions are inverses. For example, the function $f(x)=2x$ (i.e. doubling) and the function $g(x)=x/2$ (halving) are inverse functions because, no matter what number we start with, if we double it and then halve that result, we end up with the original number. The inverse of a relation $\relR$ is written $\relR^{-1}$ and it consists of the reversals of the pairs in $\relR$, \begin{equation*} \relR^{-1} = \{ (b,a) \suchthat (a,b) \in \relR \}. \end{equation*}

This can also be expressed by writing \begin{equation*} b\relR^{-1}a \; \iff \; a\relR b. \end{equation*}

The process of “doing one function and then doing another” is known as functional composition. For instance, if $f(x) = 2x+1$ and $g(x) = \sqrt{x}$, then we can compose them (in two different orders) to obtain either $f(g(x)) = 2\sqrt{x}+1$ or $g(f(x)) = \sqrt{2x+1}$. When composing functions there is an “intermediate result” that you get by applying the first function to your input, and then you calculate the second function's value at the intermediate result. (For example, in calculating $g(f(4))$ we get the intermediate result $f(4) = 9$ and then we go on to calculate $g(9) = 3$.)

The definition of the composite of two relations focuses very much on this idea of the intermediate result. Suppose $\relR$ is a relation from $A$ to $B$ and $\relS$ is a relation from $B$ to $C$ then the composite $\relS \circ \relR$ is given by \begin{equation*} \relS \circ \relR \; = \; \{ (a,c) \suchthat \exists b \in B, (a,b) \in \relR \, \land (b,c) \in \relS \}. \end{equation*}

In this definition, $b$ is the “intermediate result,” if there is no such $b$ that serves to connect $a$ to $c$ then $(a,c)$ won't be in the composite. Also, notice that this is the composition $\relR$ first, then $\relS$, but it is written as $\relS \circ \relR$ — watch out for this! The compositions of relations should be read from right to left. This convention makes sense when you consider functional composition, $f(g(x))$ means $g$ first, then $f$ so if we use the “little circle” notation for the composition of relations we have $f \circ g (x) = f(g(x))$ which is nice because the symbols $f$ and $g$ appear in the same order. But beware! there are atavists out there who write their compositions the other way around.

You should probably have a diagram like the following in mind while thinking about the composition of relations. Here, we have the set $A=\{1,2,3,4\}$, the set $B$ is $\{a,b,c,d\}$ and $C=\{w,x,y,z\}$. The relation $\relR$ goes from $A$ to $B$ and consists of the following set of pairs, \begin{equation*} \relR \; = \; \{(1,a), (1,c), (2,d), (3,c), (3,d) \}. \end{equation*}

And \begin{equation*} \relS \; = \; \{(a,y), (b,w), (b,x), (b,z) \}. \end{equation*} \ifx\SetFigFont\undefined\gdef\SetFigFont#1#2#3#4#5{ \reset@font\fontsize{#1}{#2pt} \fontfamily{#3}\fontseries{#4}\fontshape{#5} \selectfont}\fi ##### Exercise6.1.2

Notice that the composition $\relR \circ \relS$ is impossible (or, more properly, it is empty). Why?

What is the (only) pair in the composition $\relS \circ \relR$ ?

# Subsection6.1.1Exercises

1. The lexicographic order, $\lt _{\mbox{lex} }$, is a relation on the set of all words, where $x \lt _{\mbox{lex} } y$ means that $x$ would come before $y$ in the dictionary. Consider just the three letter words like “iff”, “fig”, “the”, et cetera. Come up with a usable definition for $x_1x_2x_3 \lt _{\mbox{lex} } y_1y_2y_3$.

2. What is the graph of “$=$” in $\Reals \times \Reals$?

3. The inverse of a relation $\relR$ is denoted $\relR^{-1}$. It contains exactly the same ordered pairs as $\relR$ but with the order switched. (So technically, they aren't exactly the same ordered pairs …) \begin{equation*} \relR^{-1} = \{ (b,a) \suchthat (a,b) \in \relR \} \end{equation*} Define a relation $\relS$ on $\Reals \times \Reals$ by $\relS = \{ (x,y) \suchthat y = \sin x \}$. What is $\relS^{-1}$? Draw a single graph containing $\relS$ and $\relS^{-1}$.

4. The “socks and shoes” rule is a very silly little mnemonic for remembering how to invert a composition. If we think of undoing the process of putting on our socks and shoes (that's socks first, then shoes) we have to first remove our shoes, then take off our socks. The socks and shoes rule is valid for relations as well. Prove that $(\relS \circ \relR)^{-1} = \relR^{-1} \circ \relS^{-1}$.