Can Relations have a Domain and Codomain? Does it make sense to talk about the domain and codomain of a relation?
For example if the relation, $R$ $$x^2+y^2=r^2$$
only takes values $(x,y)\in\mathbb{R}^2$ its domain would be $\mathbb{R}^2$ and codomain the set of possible $r^2$s. So $$R\colon\mathbb{R}^2\to\{r^2:x^2+y^2=r^2\}$$ But presumably I could rearrange to get 
$$x^2+y^2-r^2=0$$ giving $$R\colon \mathbb{R}^2\to\{0\}$$
Do either of these make sense?
I cannot find anything online about this which makes me think I am doing something wrong.
 A: Absolutely it makes sense. The domain of the relation R is the set of arguments i.e. first members of each ordered pair and the codomain is the set of which the values i.e. second members of all the ordered pairs is a subset of. In other words, the range of the relation is a subset of the codomain. Set-theorists distinguish between the range and codomain of a relation for technical reasons. These are still not universally agreed on by experts and this is the source of a lot of the confusion between the terms that students have. There's an excellent discussion between Arturo Magidin and Pete Clark on the myriad terminologies and  difficulties here. The bottom line is that outside of mathematical logic,the issue doesn't even come up and other then the definition, you don't really have to worry about it at this point. All you really have to understand is that the codomain is the universal set of the range of the relation. For example,the range of the absolute value function is the set of all positive reals and the codomain of this map is the entire real line. 
As for this particular example,these are just 2 different formulas of the same relation,the codomain and domain of the map doesn't change. The variables i.e. members of the domain are still x and y, $r^2\in\mathbb{R}$ where $(x,y)\in\mathbb{R}^2$. So this is a real valued relation in the plane whose codomain is the positive reals.Rearranging a closed algebraic form for a relation-when this is possible-doesn't change either the domain or the range. A relation is simply a set of ordered pairs. In this case, the set of ordered pairs is R = {((x,y),$r^2$) | $(x,y)\in\mathbb{R}^2$ and  $r\in\mathbb{R}\geq 0$}. 
One of the hardest parts of making the transition from using math, like in calculus,to actually doing real mathematics, is to learn to completely divorce yourself from formulas and think in terms of abstract set-theoretic objects. When you begin to do it,you'll realize this is necessary since formulas can give you the wrong intuition about such objects. 
Here's a simple example for you to think about: Consider the vertical line test for a function in calculus.Why does this work? It's kind of mysterious when you're first told about it in calculus. But it becomes crystal clear when you learn the abstract definition of a function and consider the graph of a function to be simply a visualization in the plane of it. A function is a set of ordered pairs such that no 2 different ordered pairs have the same first member and when we draw a graph of a function in the plane, we're actually drawing a subset of the ordered pairs of the function. It's clear in this context that if we can draw a vertical line through the graph that crosses the graph more then once,then this means more then one ordered pair has the same first member and this relation can't be a function!  Get out a calculus book and try it to see for yourself! 
A: There is a category sometimes called $\mathbf{Rel}$ whose objects are sets,  morphisms $r:A\to B$ are arbitrary subsets of $A\times B$, and composition is given by ordinary composition of relations. In categorist lingo, it's an example of what's called a power allegory. Just a few of its features:


*

*For all $A,B$, $\hom(A,B)$ comes with a Boolean algebra structure.

*For all $r:A\to B$, there is a corresponding $r^{-1}:B\to A$ that satisfies a special property that I won't mention here.

*It has an object that is both initial and terminal (the empty set), and it has binary products and coproducts given by the disjoint sum in the underlying category of sets.

*It's closed monoidal with respect to the operation that takes sets $A,B$ to the object $A\times B$ in the underlying universe of sets and functions.
This last point means that a morphism $r:A\times B\to C$ in $\mathbf{Rel}$ can be understood as a morphism $\bar{r}:A\to B\times C$, since as sets both are just subsets of $A\times B\times C$. As such, the condition $x^2+y^2=r^2$ can be viewed as giving rise to a number of different morphisms with different domains and codomains in $\mathbf{Rel}$. (E.g. there are two morphisms that have $\{\langle x,y, r\rangle:x^2+y^2=r^2\}$ as its underlying graph, two that have $\{\langle y,x,r\rangle:x^2+y^2=r^2\}$, the inverse of any of these, etc.) Just like the graph of a function doesn't fully determine its codomain, the graph of a relation doesn't fully determine either its domain or codomain; but we can still find a notion of domain and codomain that's perfectly sound when we want to.
A: I don't think you are thinking about it the right way, but maybe I am thinking about it a way that a person who is right wouldn't think.
Anyway. The words domain and codomain are usually reserve for functions. A function is a relation, and so the answer could be that some relations have domains and codomains.
So, no I wouldn't use domain and codomain if I had a reneral relation (or even an equivalence relation.)
That said, a (binary) relation on a set $X$ is a subset of $X\times X$. That is, it is a set of ordered pairs $(x,y)$ where $x,y\in X.$ and so there is a set with every relation.
For your example, the relation is on the set $\mathbb{R}$ where $R = \{(x,y)\in \mathbb{R}\times \mathbb{R} : x^2 + y^2 = r^2\}$. You would make a function out of this by definition $S: \mathbb{R}\times \mathbb{R} \to \mathbb{R}$ by $S(x,y) = x^2 + y^2$. The domain of this function would be $\mathbb{R}\times \mathbb{R}$ and the codomain is $\mathbb{R}$.
