Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

This is really basic (I'm new to this stuff), and doesn't even matter at all - But I'm just curious:

From my book:

If $R = (G,A,B)$ and $S = (H,B,C)$ the composition of $R$ and $S$ is known as $S \circ R = (H \circ G,A,C)$

First of all, if it says "of $R$ and $S$" I'd expect the $R$ to come first, and then the $S$. Which is not the case in $S \circ R$.

Even the graphs are inverted. I would expect $G$ to come first. But we got $(H \circ G,A,C)$.

I can live with that. But I'd like to know why is this the case. Why are they inverted?

share|improve this question
You are right, it certainly could be done the other way. Some people do. The problem is that the usual left to right convention of European languages does not play well with the function notation. –  André Nicolas Dec 5 '12 at 5:59

3 Answers 3

up vote 1 down vote accepted

Composition of relations is a generalization of composition of functions. When we have a function $f:A\to B$ and a function $g:B\to C$, the composite function is a function from $A$ to $C$ that takes $a$ to $g\big(f(a)\big)$, so it makes sense to write the composition in that same order: $g\circ f$ to match $g\big(f(a)\big)$ rather than $f\circ g$ to mean ‘apply $f$ first, then $g$’.

That said, however, it should be mentioned that some people do use the opposite convention for composition: when they write $f\circ g$, they do mean that $f$ is applied first, so that the result of applying $f\circ g$ to $a$ is $g\big(f(a)\big)$. When this convention is used, functions are often written to the right of their arguments: $(a)(f\circ g)=\big((a)f\big)g$. (The parentheses around the argument are often omitted.)

share|improve this answer

It quite probably originates from function notation: If you have $f:A\to B$ and $g:B\to C$ and want to compose them, you get $g(f(x))$, so $g\circ f:A\to C$. This then got extended to relations and other things. I would personally prefer $f\circ g$ in this case and $xf$ or similar for function application.

share|improve this answer

Because the argument of a function is usually written to its right. Then it looks like $$(S \circ R)(x) = S(R(x))$$ and function application is right to left.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.