# Why do we apply functions the “wrong way around”, i.e. why do we write $f(x)$ instead of $(x)f$?

In English, we read and write from left to right, but for some reason we apply functions in the opposite order. Consider the following procedure:

Take an element $$x$$, apply a function $$f$$ to it and then apply a function $$g$$ to the result.

The formula we would write for this is $$g(f(x))$$, which is in some sense the wrong way around, it would be more consistent to write $$((x)f)g$$. (I have to admit that I had some trouble formatting that, but that's presumably because I'm used to do it the other way around.) This would not only be consistent with the way we write, but also with the notation using arrows, i.e. $$$$X \overset{f}{\rightarrow} Y \overset{g}{\rightarrow} Z$$$$

What is the reason for this apparent inconsistency?

I could imagine the reason to be either historical or logical, or both, and I would be interested in either explanation.

I wasn't sure how to tag this, so feel fry to add any appropriate tags.

• Take an element 𝑥, apply a function 𝑓 to it and then apply a function 𝑔 to the result. This is said g of f of x. – Jorge Fernández Hidalgo Mar 28 at 21:37
• This question might be a good fit for HSM.se. – J.G. Mar 28 at 21:38
• It's habit, nothing more. In his textbook on algebra, Paul Cohn makes an heroic effort to write $xf$ in place of $f(x)$. – Lord Shark the Unknown Mar 28 at 21:38
• In category theory, the notation $(x)fg$ is used (and it's indeed more clear than $g(f(x))$ that can be very confusing at some point). – user657324 Mar 28 at 21:41
• @JorgeFernándezHidalgo: you are right but that's just a habit. We could equally well say $x$ transformed by $f$ then $g$ (which is exactly what I do say if I am choosing to write functions on the right). – Rob Arthan Mar 28 at 21:44

The origin of $$f(x)$$ in Euler 1734, and Euler's frequent use of $$fx$$ (which he learned from his teacher, Johann Bernoulli) and $$f:x$$, have been discussed here before. I'm not sure of their motives (although my guess would be $$f$$ of $$x$$ is a more natural choice for pronunciation than $$x$$'s $$f$$), but they were prolific enough to be among the most influential mathematicians when it comes to notational conventions.
Because after all, all we have is a notational convention. As if to make things more confusing, some operations are represented to the right, e.g $$x$$ squared is $$x^2$$ rather than, say, $$\operatorname{sq}x$$ or $$\operatorname{pow}_2 x$$.
• Although this answer does not give a reason as to why the notation $f(x)$ was picked instead of $x(f)$, this answer gives what seems to me as close as we are likely to get, so I'll probably accept it soon if no other answer comes along. – Peter Mar 29 at 0:52
We say "$$f$$ of $$x$$" and "$$g$$ of $$f$$ of $$x$$", so "reading from right to left" can be recast here as "applying functions from the left", which is consistent with natural language.
• I'm not convinced that it isn't the other way around, that we say "$f$ of $x$" because we write $f(x)$. Maybe if we would write $x(f)$ we would say "$x$ in $f$". (I'm not saying you're wrong, just that I don't see any supporting evidence for the statement that natural language informed notation instead of the other way around.) – Peter Mar 29 at 0:49
• @Peter Let's consider "$\sin$ of $x$" as an example, which sounds like a property of an angle; and it is one, and a very important one at that. We miss this important way of thinking about it if we say "$x$ in $\sin$", which has the added drawback of sounding like a membership comment. We wouldn't want to confuse a function value (a codomain element) with the function with a domain element. – J.G. Mar 29 at 6:45