# What does it mean for a variable to be a function of another?

When I hear someone say "$$y$$ is a function of $$x$$," I think of the notation $$y(x) = 2x + 4$$. But I've seen some people also say that $$y = 2x + 4$$ is a function $$y$$ of $$x$$. That's confusing to me because surely that's an equation and not a function. You can change it to be $$x = \frac{1}{2}y - 2$$, can you now call it $$x$$ being a function of $$y$$ even though nothing changed except for where the variables are or is that just outright incorrect and an equation can't be considered a function of another variable like that? I've seen these two being used interchangeably most often when plotting graphs of polynomials, sometimes the $$y$$-axis is even labelled $$y(x)$$ even though I didn't know you could have a function as an axis.

A little more broadly, how can I know when something is a function and when it is an equation, and are there any notable differences or problems when you misuse them (e.g. when a function was used when an equation should have been)?

• not sure how cromulent this is, but i would think an equation like $y = 2x + 4$ defines a relation between them, and a function is merely a specific kind of relation with some handy constraints (which also let us express the function in terms of inputs and output). a relation like $x^2 + y^2 = 1$ isn't a function and can't be rewritten as one, but it's still a valid and interesting relation, and in particular it's still something you can graph Jun 26, 2020 at 3:12

The confusion arises because there are two inconsistent, albeit related, uses of the word function. The older use is what may be called a dependent variable, in (for example) the phrase “$$y$$ is a function of $$x$$” or, more specifically, “the function $$y=2x+4$$”. This usage is still common among non-mathematicians who employ mathematics. This language tends to be avoided by present-day mathematicians, because it implies, in this case for example, that a function is a kind of real number (which depends on another, freely specifiable, real number). The function here is not $$y$$ but (in simple terms) the rule that specifies how $$y$$ is obtained from $$x$$. In the modern sense, a function can be precisely defined as a kind of mathematical object, which is quite distinct from the values (e.g. $$y$$) associated with the function.
• Hi John, quick question - when authors write something like “the position of a planet is a function of time”, is it correct to think about this mathematically as: we’re considering a function, e.g., $x : \mathbb{R} \to \mathbb{R}$ such that $x(t)$ is interpreted to be the position of the planet at time $t$? Jun 25, 2022 at 2:08
• @TaylorRendon : Yes. That is the modern, mathematical, conception. But the older usage, still common in writing by non-mathematicians, is (in 3-dimensional space) to identify $\pmb x$ with $\pmb x(t)$. That is, $\pmb x=\pmb x(t)\in\Bbb R^3$. In the modern conception, $\pmb x\in \Bbb (\Bbb R^3)^{\Bbb R}$, while $\pmb x(t)\in\Bbb R^3$ for each $t\in\Bbb R$. The mathematical way of thinking disentangles the position of the planet (which varies according to time) from the way that the position varies with time. Jun 25, 2022 at 8:24
Ultimately, I think that you are correct to write $$y = f(x)$$ when given the information "$$y$$ is a function of $$x.$$"
Like you mention, the equation $$y(x) = 2x + 4$$ implicitly gives the information that the output $$y$$ depends upon the input $$x,$$ i.e., $$y$$ is the dependent variable, and $$x$$ is the independent variable; however, it is a common abuse of notation to write $$y = 2x + 4$$ in place of the function $$y(x) = 2x + 4.$$ Unfortunately, in this case, the notation is ambiguous because as you noted, we could also write $$x = \frac 1 2 y - 2,$$ and this describes $$x$$ as a function $$x(y) = \frac 1 2 y - 2$$ of $$y.$$ What you are witnessing in this example is that the function $$f(x) = 2x + 4$$ has an inverse, i.e., there exists a function $$g(x)$$ such that $$f \circ g(x) = x$$ and $$g \circ f(x) = x.$$ Explicitly, the inverse function is $$g(x) = \frac 1 2 x - 2.$$ One can check that $$f \circ g(x) = 2g(x) + 4 = x$$ and $$g \circ f(x) = \frac 1 2 f(x) - 2 = x.$$
Like Maryam mentions above, the clear distinction between a function $$f(x)$$ and an equation is that a function comes with a domain (i.e., a set of $$x$$-values that are valid inputs for $$f(x)$$) and a codomain (i.e., a set of $$y$$-values that are valid outputs for $$f(x)$$). Unfortunately, in the case of $$f(x) = 2x + 4,$$ all $$x$$-values are valid inputs, and all $$y$$-values are valid outputs, so the domain and codomain are often suppressed; however, for the function $$g(x) = \sqrt x,$$ the domain and the codomain are quite important because the square root of a negative number is not a real number, hence the equation $$y = \sqrt x$$ is rather meaningless.
A function is the sum of three informations: the domain, the codomain, and a rule. You say a function $$f:A\to B$$ is defined by $$y=f(x)$$ to specify that the domain is $$A$$, the codomain is $$B$$ and the rule is expressed by the equation $$y=f(x)$$. Equivalently, you can see a function from a domain $$A$$ to a codomain $$B$$ and defined by an equation $$y=f(x)$$ as a relation from $$A$$ to $$B$$, that is as a subset of the cartesian product $$A\times B$$, such that the ordered pair $$(x,f(x))$$ is an element of that relation for all $$x$$ in the domain $$A$$ of $$f$$. If, as in your example, the relation is invertible, then for all $$x\in A$$ and all $$(x,y)\in f$$, you have that the symmetric pair $$(y, x)$$ is in the inverse relation $$f^{-1}$$, which is a function from the domain $$B$$ to the codomain $$A$$, defined by the equation $$x=f^{-1}(y)$$ for all $$y\in B$$.