TITLE: Why does notation for functions seem to be abused and ambiguous?
QUESTION [27 upvotes]: I really need to clear up a few things about function notation; I
can't seem to grasp how to interpret it. As of right now, I know that
a function is roughly a mapping between a set $X$ and a set $Y$, where no
element of $X$ is paired with more than one element of $Y$. This seems
simple enough. I know that this function is commonly denoted by a
single letter, such as $f$, $g$, or $h$. I also that when it comes to
"rules" for function, $f$ denotes the set of mathematical instructions
that tell how to find an output in set $Y$ given an input in set $X$. $x$ is
the input, $f$ is the function, and $f(x)$ is the result of applying f to
an input $x$, i.e., the output. My main question is, why do many authors
say call $f(x)$ the function? This really confuses me, since $f(x)$ is a
variable for a real number, and not a mapping between two different
sets. Following from this, why do some say that an expression such as
$2x + 5$ is a function? As stated before, this seems to just be a
variable quantity that varies with $x$, but is not a function itself.
Finally, if it's true that $x$ is the input, $f$ is the function, and $f(x)$
is the output, then why do we manipulate functions, like $f$, through
the output $f(x)$? For example, we have the image of $x$ under $f$, $f(x) =
2x^2 + 5x$. The only way to find $f'$ (the derivative of $f$) is to
manipulate $f(x)$. If we're manipulating functions, then why must we
reference an input variable $x$ in the process? Why do we have to have
$f(x)$ in order to find the derivative of $f$? 
One of the most confusing aspects about function notation is the
differentiation operator. $dy/dx$ represents the "infinitesimal" change
in $y$ with respect to the "infinitesimal" change in $x$, and since $y =
f(x)$, we can write $df(x)/dx$. The confusing aspect of this is, we say
"take the derivative of the function $f(x)$"; however, $f(x)$ can't be a
function because it is equal to $y$, which is a variable quantity, not a
function. To add to the confusion, we say that the differentiation
operator $d/dx$ maps a function, $f$, to its derivative, $f'$. However, as
with $df(x)/dx$, we need $f(x)$ in order to transform the function $f$ into
$f'$. This seems very confusing, because then it seems that the
derivative operator, $d/dx$, actually maps $f(x)$ to $f'(x)$, since we need $f(x)$ to calculate the derivative. The differentiation operator is just an example of a more broad
frustration with function notation.
To recap, I know that $x$ is the input, $f$ is the
function, and $f(x)$ is the image of $x$ under $f$, which can often be given
by an algebraic expression. I know that $f$ is a mapping, so $f: x \mapsto
f(x)$. This means that $f$ is the function that maps $x$ to an output $f(x)$.
I've determined this for myself, but I always stumble when I see
authors or other people refer to $f(x) = $ "some expression" as the
function. It is clear that $x$ is a variable of a
real number, and $f(x)$ is a variable of a real number that is dependent
on $x$. Then, $f$ is the function, the mapping that links $x$ to $f(x)$; yet ,
people insist on saying that something like $2x + 1$ is a function.
Additionally, I know that differentiation is an operator $d/dx: f \mapsto
f'$. However, in order to calculate derivatives, we are not given a
function $f$, we are given the image of $x$ under $f$, $f(x)$. This means that it seems that the
differentiation operator should be $d/dx: f(x) \mapsto f'(x)$. However, I do not think this is right, and it is one of the main points of my confusion.
EDIT: Looking at some of the comments, I have one additional question. When we define a function, we usually do so by writing $f: X \rightarrow Y$, such that $f(x) = 5x^2$, for example. My additional question is, why is it necessary to, in order to define the rule for a function, use a variable x as the input in the function? Why don't we define functions like $f(~)$, with no reference to any variables, since we are specifying the action of the function, not the image of $x$ under $f$...

REPLY [2 votes]: There are many questions in the final version of this post, and here I'm going to try to answer them all afresh.

Why do many authors call $f(x)$ the function? Why do some say that an expression such as $2x^2 + 5$ is a function?
I interpret this question as asking how this state of affairs came about.  It was not, as many people assume, through carelessness or deliberate abuse of notation/terminology (although perhaps that it how it persists), but because the meaning of the word ‘function’ (‘Funktion’, ‘fonction’, etc) has changed over time. The question at https://hsm.stackexchange.com/questions/6104/who-first-considered-the-f-in-fx-as-an-object-in-itself-and-who-decided-t by @MichaelBächtold (the question, not the answers, although they add some details) explains this history; but briefly, the original meaning of the word ‘function’ was $f(x)$, and this was established for a couple of centuries before anybody seriously considered the nature of $f$ as a thing in itself. (And when they did, they initially came up with different words for it.) This is in contrast to the synonyms ‘map’ and ‘mapping’, which have always meant $f$, and you're less likely to see $f(x)$ called by one of those terms.
Even when people write things like ‘$f(x)$ is continuous’ or ‘$2x^2 + 5$ is continuous’, this can be made sense of, although now it is true that the terminology is being abused; it should be ‘$f(x)$ is continuous in $x$’ or ‘$f(x)$ is continuous as a function of $x$’. (In practice, this meaning is clear, but ‘$f(x,y)$ is continuous’ and ‘$2x^2 + y$ is continuous’ are genuinely ambiguous.) Similarly, ‘the derivative of $2x^2 + 5$’ is an abbreviation for ‘the derivative of $2x^2 + 5$ with respect to $x$’ (but notice that, while the derivative of $f$ is the mapping $f'$, the derivative of $f(x)$ with respect to $x$ is that mapping's value $f'(x)$).
This is not to say that nobody who writes like this is confused or careless, only that there is long-standing precedent for this terminology, and that it can be done precisely and carefully. But if you want to use ‘function’ with its modern meaning and you want to write without abuse, then yes, the function is $f$ and not $f(x)$. (Although you can still say that $2x^2 + 5$ is a function of $x$, or that $2x^2 + 5$ is continuous in $x$, as this terminology has no other meaning. And you can also write $x \mapsto 2x^2 + 5$ if you want to discuss the function itself without giving it a name such as $f$.)
If we're manipulating functions, then why must we reference an input variable $x$ in the process?
You don't have to do this, but it's often convenient and always relevant. This is because a function (in the modern sense, that is a mapping) is determined by how it relates its inputs to its outputs. Some of the other answers have shown how you can refer to $x \mapsto 2x^2 + 5$ by high-level notation such as $2\operatorname{id}_{\mathbb{R}}^{\,2} + \operatorname{const}_5$ (although nobody else seems to have suggested quite this way of putting it), but at some point you have to define what identity functions and constant functions are and explain what it means to add and multiply functions, and at the most basic level, this is done with reference to input and output values.
So if I want to differentiate $x \mapsto 2x^2 + 5$, then maybe I directly compute $$\Bigl(x \mapsto \lim\nolimits_0 \bigl(h \mapsto \bigl((\xi \mapsto 2\xi^2 + 5)(x + h) - (\xi \mapsto 2\xi^2 + 5)(x)\bigr)/h\bigr)\Bigr) = \Bigl(x \mapsto \lim\nolimits_0 \bigl(h \mapsto \bigl((2(x + h)^2 + 5) - (2x^2 + 5)\bigr)/h\bigr)\Bigr) = \bigl(x \mapsto \lim\nolimits_0 (h \mapsto (4hx + 2h^2)/h)\bigr) = \bigl(x \mapsto \lim\nolimits_0 (h \mapsto 4x + 2h)\bigr) = (x \mapsto 4x)$$ (notice the change of dummy variable in the first step to avoid reusing a variable name), or maybe I do a more high-level calculation $$(2\operatorname{id}_{\mathbb{R}}^{\,2} + \operatorname{const}_5)' = 
2(2\operatorname{id}_{\mathbb{R}}^{\,2-1}\operatorname{const}_1) + \operatorname{const}_0 = 4\operatorname{id}_{\mathbb{R}}$$ that relies on known rules of differentiation. (Of course, the more basic calculation also relies on some rules of limits.) But when I prove these rules of differentiation, then I still need to go back to input and output values.
To add to the confusion, we say that the differentiation operator $d/dx$ maps a function, $f$, to its derivative, $f′$.
I'd say that the differentiation operator $D$ (or $'$ written postfix) maps a function $f$ to its derivative $Df$ (or $f'$). In contrast, $d/dx$ maps the quantity $f(x)$ to the quantity $f'(x)$; in particular, it maps the quantity $2x^2 + 5$ to the quantity $4x$. If you want to formalize what these ‘quantities’ are, then see the question https://mathoverflow.net/questions/307947/formalizations-of-the-idea-that-something-is-a-function-of-something-else by Michael Bächtold (and the answers by Terry Tao and Mike Shulman, especially the first two paragraphs of Mike's answer); but if you don't want to go down that route, then you can interpret $(d/dx)(2x^2 + 5)$ or $d(2x^2+5)/dx$ as notation for $(\xi \mapsto 2\xi^2 + 5)'(x)$ (which again has a change of dummy variable to avoid a clash).  Note that in this case, $(d/dx)\bigl(f(x)\bigr) = \bigl(\xi \mapsto f(\xi)\bigr)'(x) = f'(x)$ as expected.  In any case, to avoid ambiguity, you can't apply $'$ to $2x^2 + 5$ (although you can apply it to $x \mapsto 2x^2 + 5$) or apply $d/dx$ to $f$ (although you can apply it to $f(x)$).  People who write ‘$(2x^2 + 5)' = 4x$’ or ‘$df/dx = f'(x)$’ are being sloppy, although they can get away with it under certain default assumptions (such as that $x$ is the default variable).  This is essentially the same issue as saying ‘$2x^2 + 5$ is continuous’ instead of ‘$2x^2 + 5$ is continuous in $x$’ or ‘$x \mapsto 2x^2 + 5$ is continuous’; in particular, it gets more ambiguous when you have more variables.