Monday 7 December 2015

Relations as Sets


I recently came across a powerful idea in maths which could have far-reaching consequences for how I conteptualise things even in every day life (insofar as I think about things logically in every day life!) The idea is really simple: relations between two things form a set of ordered pairs. These can be numerical, conceptual, whatever you want! Let's get started on some examples to illustrate what I mean:

Simple maths case: Fractions

Fractions are relations between two numbers, the numerator and denominator. Take the simple example of a half, \(\frac{1}{2}\). This is the ordered pair $(1,2)$. In this set (currently just containing $(1,2)$) the first number indicates the numerator and the second number is the denominator. In fact, you can easily create an infinite set full of halfs by defining the equivalence class as all those ordered pairs which give \(\frac{1}{2}\): \(\frac{2}{4}\), \(\frac{4}{8}\), \(\frac{-8}{-16}\), etc. This would form the set of ordered pairs: $(1,2), (2,4), (4,8), (-8,-16),$ ... So you can see that something simple like \(\frac{1}{2}\) creates a whole set based not on numerical equivalence but on the relation between the first and second number - the denominator is double the numerator. Relations make sets.

But it's more than just mathematical relations which produce sets. Any relation does.

Real life cases: Friendships

You could create a friendship set with all the different pairs of friends. Say Alice and Bob are friends - then there would be an element in that set: $(Alice, Bob)$. Maybe you think all friendships are reciprocal - so if Alice is friends with Bob, that implies that Bob is friends with Alice. Then if $(Alice, Bob)$ is in the set, so is $(Bob, Alice)$. That's true for Facebook friends, at least - there are no one-way friends on Facebook. That's not the case for followers on Twitter, though: you can have the follower set $(Follower, Followed)$ where $(Alice, Bob)$ but not $(Bob, Alice)$.

I find this kind of interesting because it means friendship groups and networks can be thought of in terms of sets and analysed accordingly. So far though, I have only described ordered pairs. It is pretty simple to generalise this to sets with relations between any number of things. This would increase the dimension (ie, the number of elements within the brackets of each object). Let me list an example of sets of different dimensions to do with friendship:

Dimension 1: The set of all my friends is not a set of pairs but of individuals. So my friendship set might look like ${Me, Pillow, Brother, ...}$
Dimension 2: As before, the set of friendships has two elements (even if they are the same element - I am one of my best friends, so $(Me, Me)$ is an element of the friendship set).
Dimension 3: An example of a three dimensional friendship set could be friendship triplets, but it would probably be more interesting to create a set which included some different relation about three people. Three people in a love triangle might make a three-element per object set. It could be $(Lover \#1, Lover \#2, Beloved)$. So the set of all love triangles is a three dimensional set. Or another might be an introduction set, where Alice introducing Bob to Catherine would be the element $(Alice, Bob, Catherine)$.

And so on. No matter how complicated the relation, I suspect it could somehow be represented as a set. This is just a curious way of looking at relations when it comes to everyday life, but it holds particular significance for computer science. Here's an example:

Functions and their Plots


A function can be thought of as the relation between an input and an output. Viewed that way, functions create sets of ordered numbers - say you have $y = f(x)$, then over all the domain of $x$, there is some output y which creates all the points $(x,y)$. If the function is something simple, like $f(x) = x$, then the set would contain elements like $(1,1), (2,2), ( \pi, \pi)$, ...

Just like before, you can get higher dimensional sets from functions by just having more input variables. If $z=f(x,y,t)$ then the element would be $(x,y,t,z)$. This is exactly how a mathematics software like MATLAB/Octave graph their functions. You define all your $x$ and $y$ and you enter the command $plot(x,y)$ to give you a plot with the mathematical relation of the ordered pairs $(x,y)$. You could ask Octave to just give you $(x,y)$ as a matrix specifying all the elements of the set (discretely, of course - computers do not deal with continuous functions when doing numerical calculations).


Why Cares?

Most people will not care, and will just be happy to know that the mathematicians, scientists, engineers and computer scientists will use this idea when necessary. However, I think it does offer a cool way of looking at relations between objects and it gives a formalised representation of the relationships, which means it is easier to analyse formally and mathematically. It is a lot harder to be logically sloppy when dealing with set theory directly!

No comments:

Post a Comment