# Can the idea of a 'function of a variable' be made rigorous?

Suppose that $$y=x^2$$. Very often people describe this relationship by saying that '$$y$$ is a function of $$x$$'. It seems that there are several logical problems with this statement:

• A function is simply a set of ordered pairs of numbers. It does not matter how you denote the input of a function, and there is no doubt that $$x \mapsto x^2$$ and $$y \mapsto y^2$$ are the same function. Indeed, in both cases $$y$$ and $$x$$ are simply dummy variables used to illustrate what happens when you plug in an arbitrary number into the function.
• $$x$$ and $$y$$ are often described as variables that are related in some way; in this case, with $$y$$ being the square of $$x$$. However, in this Math Overflow post Mike Shulman states that the idea of a variable is 'not a standard part of modern formalizations of mathematics'. Strangely, the idea of a dummy variable makes much more sense to me. For instance, when we say 'consider the function $$f$$ defined by $$f(x)=x^2$$ for all $$x$$', it is clear that the only purpose of the letter $$x$$ is to declare that the second entry of the ordered pair is the square of the first.
• If $$y=x^2$$ and $$x \geq 0$$, then we just as well might write $$x=\sqrt{y}$$. This flexibility is not really allowed when speaking of functions: $$x \mapsto x^2$$ and $$x \mapsto \sqrt{x}$$ are certainly not the same function. Perhaps it is possible evade this by treating $$x$$ as the independent variable and $$y$$ as the dependent variable.

Some authors get around this ambiguity by saying that 'the function $$y=x^2$$' is just a shorthand for 'the function $$y(x)=x^2$$', which in turn is just a shorthand for 'the function $$y$$ defined by $$y(x)=x^2$$ for all x'. However, this doesn't seem to align with how people treat the relationship between $$y$$ and $$x$$ in practice. Even if we accept that $$y=x^2$$ is simply a shorthand for $$y(x)=x^2$$, it still seems that there is a tendency towards treating $$x$$ as an independent variable representing the input of $$y$$, as opposed to simply a dummy variable that can be replaced by any other letter.

So I ask, in formal mathematics, is it possible to interpret $$y=f(x)$$ in such a way that $$x$$ and $$y$$ are variables representing the inputs and outputs of a function? And if so, how should the statement '$$y$$ is a function of $$x$$' be understood?

• In my opinion, it is problematic to always use $x$ as the input of a function and $y$ for the output. Say you have $x$ and you apply the squaring function $\text{sq}$ obtaining $y=\text{sq}(x)=x^2$. One ought to be able to feed $y$ to the squaring function again to obtain $x^4$, but then how would you call the output, if $x$ and $y$ are already used? Feb 13, 2021 at 19:50
• Maybe I'm missing something, but doesn't the MathOverflow post you linked do just that? It seems to provide a good synthetic interpretation of variable quantities and functional relationships between them. Feb 13, 2021 at 19:50
• @pregunton: I did find that thread useful, but I'm interested in hearing other views on this topic. Moreover, I think that question was focused on the notion of a function from the perspective of set theory. Perhaps my question is a little less ambitious in that it just seeks a coherent definition of both a variable and a function of variable, without too much machinery.
– Joe
Feb 13, 2021 at 22:22
• I don't have an answer but I want to express appreciation for asking this. It's something I've thought about a lot. Feb 14, 2021 at 8:46

When we say “$$y=f(x)$$”, we are stating a typographical convention that we are going to adopt in the present context: Namely, whenever the letters $$x$$ and $$y$$ appear, the values to which they refer are connected by the functional relationship $$f$$. The terminology “$$y$$ is a function of $$x$$” is confusing. While it is still employed by many people who use mathematics, it is often avoided by present-day mathematicians, who are aware that $$y$$ and $$f$$ refer to quite different types of mathematical object.

For example, consider the function $$f:\Bbb R\to\Bbb R_{\geqslant0}:x\mapsto f(x):= x^2.$$ In this case, $$f$$ may be identified with a certain subset of $$\Bbb R\times\Bbb R_{\geqslant0}$$. Quite separately, and in addition, we may adopt the naming convention of using $$y$$ instead of $$f(x)$$. But $$y$$ is just some element of $$\Bbb R_{\geqslant0}$$, albeit dependent on $$x$$, while $$f$$ is a quite particular subset of $$\Bbb R\times\Bbb R_{\geqslant0}$$ (which determines the relationship between $$x$$ and $$y$$).

In this context, the notation “$$y=y(x)$$” is often used, which further reinforces the confusion between $$y$$ and $$f$$. This sort of notation may be convenient for (say) practical engineering calculations, but it's not a good place to start when you want to maintain a clear mathematical concept of function.

In the above, for simplicity, I have adopted the convention of identifying a function with its graph. In some branches of mathematics this is inconvenient, and to specify a function it is necessary to specify a codomain for it (of which the range of the function is a subset).

• I'm not convinced the "it's only a convention, not a function" thing actually works because people in calculus do write $y = y(x)$ (shudder) and then proceed to take the derivative of $y$ with respect to $x$. I think the underlying view is much more that of several variables that are allowed to depend on each other as long as it's not cyclic, so that indeed $y$ is a variable and a function of $x$. This is not rigorous (or at least not easily grounded in set theory) as OP points out. Feb 14, 2021 at 8:45
• Thanks for this answer. I'm still unsure about this: is the $x$ in '$y=f(x)$' a free or bound variable (or neither)? I have the same question about $y$.
– Joe
Feb 14, 2021 at 20:24
• Fundamentally, the problem I have is that when people say let $f:\mathbb{R} \mapsto \mathbb{R}$ be the function given by $f(x)=x^2$, there is an implicit quantifier; namely, that the equation holds for all $x$. It seems to follow that $x$ is a bound variable, not a free one. However, most people seem comfortable with the idea of $f$ being a 'function of $x$', in which case $x$ would appear to be a free variable. Isn't the symbol $x$ being used in two different ways?
– Joe
Feb 14, 2021 at 23:21
• @Joe : The terms free variable and bound variable are used in logic (or metamathematics) and, as such, can be given precise meanings. In mathematics, these terms are less clear. Instead, we tend to refer to dummy variables and dependent/independent variables. Not much mathematics is involved here. Rather, the issues are custom, clarity, concision, and context. True story: One day, a teacher I know solved an equation for his class and found that $x=2$. The next day, he solved another equation, to get $x=3$. A student objected: “You lie! yesterday you told us $x$ was $2$.” Feb 15, 2021 at 11:26
• @JohnBentin: It appears then that it is a little unreasonable to expect that the variables one encounters in analysis are as clear-cut as they are an in logic. So when we write $y=f(x)$, and say that $x$ is an 'independent variable', the best way to think about this is that $x$ can take any value in the domain of $f$. The variable $y$ then depends on what value $x$ takes. If however we want a formal foundation to fall back on, many statements that are written in terms of variables can be rewritten in terms of functions. Does this view make sense?
– Joe
Feb 15, 2021 at 11:48

A function is a subset $$f$$ of $$A\times B$$ with$$\forall x_1\in A\forall x_2\in B\forall x_3\in B((x_1,\,x_2)\in f\land(x_1,\,x_3)\in f\to x_2=x_3).$$(Some would say a "function" can be multivalued, but I'll address that in another paragraph.) If some $$(x_1,\,x_2)\in f$$, we write $$x_2=f(x_1)$$, thereby forgetting the set theory. But if all we know about values $$x,\,y$$ is $$y=f(x)$$ or equivalently $$(x,\,y)\in f$$, recalling $$f$$ is a set is again useful: $$f$$ is just the set of values of $$(x,\,y)$$ consistent with our knowledge. So "$$y$$ is a function of $$x$$" is shorthand for "the set of values of $$(x,\,y)$$ consistent with our knowledge is a function", which is a nontrivial statement because of the unique-images property of functions.

Even if a "multivalued function" is what you have in mind, knowing which function $$y$$ is of $$x$$ means knowing the set of values of $$(x,\,y)$$ consistent with our knowledge. (Indeed, this is true regardless of how we define "function", although in this more general case we lose the nontriviality observed above.)

Feel free to repeat this analysis for concepts other than knowledge. For example, if $$x,\,y$$ are related by a physical process, the "function" is the set of physically realizable values of $$(x,\,y)$$. (There's no need to worry about how other variables may come into play, because we can assume $$x,\,y$$ are tuples in their own right, thereby folding everything relevant into this discussion. Even randomness/indeterminism doesn't trip us up, if you use what are called random functions, which have a nuanced but ultimately non-ruinous effect on the discussion similar to that of multivalued functions. We might end up saying "there exists a function $$f$$ for which $$y$$ is the function $$f$$ of $$x$$, but the choice of $$f$$ is random, so itself has a probability space for its possible values".)

• I like the idea that $y=f(x)$ can be thought of as a shorthand for $(x,y) \in f$. However, I'm unsure of the status of $x$ and $y$ in this question. Does $x$ refer to a specific element in the domain of $f$? Or is it a free/bound variable?
– Joe
Feb 14, 2021 at 20:22
• @Joe It may help if you first volunteer your definition of a variable, but basically I'm taking $x,\,y$ to be variables whose set of legal values as tuples is a function.
– J.G.
Feb 14, 2021 at 20:46
• I suppose it is the concept of a variable itself that is causing me the most confusion in understanding the notation $y=f(x)$. From reading the Wikipedia on the subject, I gather that in modern mathematics, a 'variable' is not a varying quantity per se, but rather a placeholder for a number, something that can be replaced by any member of the domain of $f$. So when we say 'let $f(x)=x^2$', $x$ is being used as a symbol that can be substituted by any number. So is the $x$ being used here a free or bound variable? And do things change when we write $y=x^2$ instead of $f(x)=x^2$?
– Joe
Feb 14, 2021 at 20:58
• I'm sorry if I haven't been specific enough for you to properly answer my query. Please let me know if this is the case, and I'll do my best to elaborate.
– Joe
Feb 14, 2021 at 20:58
• @Joe For example, is it a random variable, which is formally defined as a special kind of function? If not, can you zoom in on one of these? Don't worry if you can't. "Implicit" definitions (saying which axioms something obeys) are often more helpful than "explicit" ones.
– J.G.
Feb 14, 2021 at 21:07

A formal notation is

$$f:X\to Y:x\to f(x)$$ where $$X,Y$$ and the expression of $$f$$ are specified.

When you write $$y=f(x)$$, it must be obvious from context that

• you are defining a function $$y(x)$$,

• $$X$$ and $$Y$$ are known (such as $$\mathbb R$$).

Otherwise, the identity $$y=f(x)$$ might denote an equation where $$y$$ is explicitly known in terms of $$x$$ and you could be interested to express $$x$$ in terms of $$y$$. But again, this must be clear from context.