First I apologize because the following are very elementary and annoying questions about functions. But I could sure use help. It's distressing to me that I'm trying to get better at math but I don't even understand a fundamental concept like functions... please explain very pedantically because I am a little slow.

Statement in question

Let's say: $\forall x,y \quad f(x) = g(x+y)$

My questions

  1. Is it correct to say that $g(x+y)$ is a function of one variable or two variables?

    • My attempt: It's clear to me that $g(x)$ is a function of one variable and $g(x,y)$ is a function of two variables. But I'm not sure about $g(x+y)$. I would guess $g$ is a function of a function and the inner function can be thought of as "one variable" that has "two variables." That seems really convoluted...
  2. What are some trivial examples of the statement above? My attempts:

    • My trivial example A: $f(x)=C$ and $g(x+y) = x+y$

    • My trivial example B: $f(x)=C$ and $g(x+y) = (x+y)^{30} + y^{x} - x$

    • My trivial example C: $f(x) = 42$ and $g(x+y) = 42$

    • My trivial example D: $f(x) = 11$ and $g(x+y) = 5u - u$

    • Are those acceptable trivial examples? In my last example I switched it up to $u$ on purpose... kind of shooting in the dark. Can you give me some trivial examples if mine are wrong?

  3. Is it true that $\forall x,y \quad$ if $f(x) = g(x,y)$ then the LHS must be a constant?

    • I know how to prove it if it's $g(x+y)$ but not for $g(x,y)$. If this is not true can you give me a trivial counter example?
  4. Let's say that $h(x,y)$ is a function of distance. Then you can say $h(x,y) = k(x^{2}+y^{2})$. You don't have to put the square root part of the distance function into $k$ because that can be part of the function $k()$ itself. But I don't think you can "simplify" it further from $x^{2}+y^{2}$. Correct? It's interesting to me that $k((x^{2}+y^{2})^{50})$ can be called a "function based on distance" even though it is powered to the 50 and the distance formula is powered to 0.5...

Thank you for your help and patience!

  • 1
    $\begingroup$ The answer to 3 is No. But, given $x$, you would have $g(x,y)$ unaffected by changes in $y$ $\endgroup$
    – Henry
    Feb 10, 2018 at 0:26
  • 5
    $\begingroup$ Good questions. First, if $f(x)=g(x+y)$ for all $x,y$ then both $f$ and $g$ must be constant. If you pick $x=0$ then you have $f(0)=g(y)$ for all $y$ and so $g$ is constant. Now set $y=-x$ to get $f(x)=g(0)$ for all $x$. Hence both are constant. I would write that $(x,y) \mapsto g(x+y)$ is a function of $x,y$, the notation emphasises that it is a function (as opposed to a formula). However, people are often sloppy with such things which can add to confusion. $\endgroup$
    – copper.hat
    Feb 10, 2018 at 0:26
  • 1
    $\begingroup$ Counterexample to 3: $$f(x)=x\\ g(x,y)=x$$$g(x,y)$ must be independent of $y$. The choice of $f(x)$ is arbitrary. For question 4: yes that's correct. For question 1: $g(x+y)$ is a function of one variable, ($g$) evaluated at the point $x+y$. $\endgroup$
    – John Doe
    Feb 10, 2018 at 0:31
  • 1
    $\begingroup$ @HJ_beginner yes, $C$ is the only correct example shown (for question 2) $\endgroup$
    – John Doe
    Feb 10, 2018 at 0:35
  • 1
    $\begingroup$ @HJ_beginner: It is not cheating, the function $g(x,y) = x$ is still a perfectly good function. $\endgroup$
    – copper.hat
    Feb 10, 2018 at 1:43

4 Answers 4


These are great questions!

Is it correct to say that $g(x+y)$ is a function of one variable or two variables?

Firstly, let me pedantically distinguish between $g$ (the thing you plug input values into) and $g(x+y)$ (the result of plugging $x+y$ into $g$), both of which are often called "functions".

Focus on $g$ first of all. Those values you plug in can be variables, or constants, or whatever(*). It can be $x+y$, or it can be $5$, or it can be $x+y-z+abc-d^5$, but you're only allowed to plug one thing into $g$, because it only has space for one input. The correct term for "a value you plug in" is an argument. So $g$ takes one argument.

On the other hand, there are clearly two variables visible here: $x$ and $y$. Why might that be? Well, as you rightly pointed out, this particular argument we've plugged in is some kind of combination (really: function!) of these two variables. Let's give that function a name, say $\mathrm{sum}(x,y) = x+y$ (a function that takes two arguments).

So you could rewrite $g(x+y)$ as $g(\mathrm{sum}(x,y))$, if you like that kind of thing. Note that you're still plugging one thing into $g$: it's just now called $\mathrm{sum}(x,y)$. And there are still two variables present. Nothing's changed here.

Is there some inherent "two-ness" about $g(x+y)$, though? Well, not necessarily. Here's another function: $\mathrm{bigsum}(w,x,y,z) = w+x+y+z$. This one takes four arguments; but there's nothing stopping me looking at what happens when I plug this into $g$ with $w = -z$, i.e. $$g(\mathrm{bigsum}(-z,x,y,z)).$$ Try it, and you'll see this also evaluates to $g(x+y)$. Or here's another function: $\mathrm{forgetful}(a,b,c,d,\dots,x,y,z) = x+y$ - a function of 26 arguments (but most of them happen to be redundant).

The take-home message is: whenever someone writes down (e.g.) a formula, there should(!) also be an underlying context for that formula. In the world of functions, this normally amounts to specifying a domain, i.e. an allowable range of input values. These don't come for free with formulas: it's your job, as the mathematician, to make sure that they're well specified (so that e.g. everyone reading your work understands what they are, or you don't accidentally change something subtle about the function in the middle of a long piece of work, or whatever).

(*) In practical, mathematical terms: there isn't really much of a distinction. What does "variable" mean anyway, apart from "some constant I don't know" or "a placeholder for some constants"?

I think other people have addressed your other questions, but one final comment from me:

What are some trivial examples of the statement above? My attempts:

Others have told you why three of these are wrong. Actually, I'd be pedantic here: (a) and (b) are wrong, and (d) is underspecified - in other words, it needs more information before it makes sense. For example:

  • if $u$ is a new, independent variable, then the formula given doesn't make any sense.
  • if $u$ is secretly a function, and you plug $x+y$ (or something dependent only on $x+y$) into it, then the formula given makes sense, but this is probably not a valid counterexample.
  • if $u$ just happens to be your favourite name for the number $2.75$, then the formula given makes sense and this is a valid counterexample.

Again, context matters.

  • $\begingroup$ Thank you Billy that was an excellent explanation. FYI - I will give your answer the checkmark although you along with many others have helped me greatly. I will need to meditate on this new knowledge to fully absorb. Thanks!! $\endgroup$ Feb 10, 2018 at 1:19
  • $\begingroup$ @HJ_beginner Absolutely worth the check. You can upvote it too (I did). $\endgroup$ Feb 10, 2018 at 1:24
  • 7
    $\begingroup$ Take-home lesson: $f(x)$ is not a function, $f$ is (or, if no other notation is at hand, $x\mapsto f(x)$) $\endgroup$ Feb 10, 2018 at 5:28
  • 1
    $\begingroup$ "The correct term for "a value you plug in" is an argument. So $g$ takes one argument." Almost reminded me of JavaScript there ;) $\endgroup$ Feb 16, 2018 at 2:17
  • $\begingroup$ I suspect it's not an accident! $\endgroup$
    – Billy
    Feb 16, 2018 at 3:04

Maybe you should clarify the definition of function that is a relation between a set of inputs and a set of permissible outputs with the property that each input is related to exactly one output.

Thus, on real numbers, in general a function $f$ has a set of input $\mathbb{R^n}$, which elements are n-dimensional vectors, and a set of output $\mathbb{R^m}$ which elements are m-dimensional vectors.

For example, the function $$g(x,y) = x+y$$

is a relation with a set of input $\mathbb{R^2}$ and a set of output $\mathbb{R}$ which is formally expressed by

$$g: \mathbb{R^2}\to\mathbb{R},\quad(x,y)\to x+y$$

and it is denoted as a function of severable variables.

Otherwise $$g(x+y) = x+y \quad$$ (that is $g: \mathbb{R}\to\mathbb{R} \quad t\to t$) is denoted as a function of a single variable.

  • $\begingroup$ I suppose I am using the "naive HS kid doesn't know math" definition of a function. I will study that link you provided. It seems like you answered my question 1, and you are saying that $g$ is more of a mapping then a "function of variables"... so if someone showed you $g$ as you defined it you'd call it a mapping of two variables to one output on the real number line versus a "function of two variables"... $\endgroup$ Feb 10, 2018 at 0:38
  • 1
    $\begingroup$ If $g$ is a function of two variables, we would normally write $g(x,y)=x+y,$ not $g(x+y)=x+y.$ I think that answering pedantically, as the OP requested, I would say that $g$ is a function of one variable, namely the identity function. I think a beginner should stick to the usual notations. $\endgroup$
    – saulspatz
    Feb 10, 2018 at 0:43
  • $\begingroup$ @HJ_beginner Note that g(x,y)=x+y is defined as "a function of several variables" since the input set is $\mathbb{R^2}$. With the term function of one variable we denote the funtion with $\mathbb{R}$ as input and output set. $\endgroup$
    – user
    Feb 10, 2018 at 0:45
  • 2
    $\begingroup$ Yes, exactly. If you look at the formula $g(x+y)=x+y,$ you can see that $g$ only cares about one number: $x+y$. So, I wouldn't define $g$ this way. I would write something like $g(t)=t.$ If this were really a valid function definition, wouldn't it also be possible to define $g(x+y)=xy?$ What on earth does that mean? $\endgroup$
    – saulspatz
    Feb 10, 2018 at 0:55
  • 1
    $\begingroup$ @HJ_beginner Absolutely. In fact, I'd go so far as to say that they're so unrelated that you probably shouldn't call them both by the same name, $g$. After all, one of them can take two inputs, and the other can only take one. $\endgroup$
    – Billy
    Feb 10, 2018 at 0:55

A function is defined in term of sets. Functions can act on elements/points and very importantly, also on sets.

The two central and formal sets used to define a function are:

  • A set called the Domain, $D$.
  • A set called the Co-domain, $C$.

$f: D \to C$ means: $\forall x \in D$, $f(x) \in C$.

  • The set $G=\{f(x)|x\in D\} \subseteq C$ is called the Image of $f$.
  • For every $U \subseteq C$, the set $f^{-1}(U) = \{x|f(x)\in U\} \subseteq D$ (Where I used action on sets) is called the Preimage of $U$. ($f^{-1}$ in this context is defined $\mathcal{P}(C)\to \mathcal{P}(D)$, and is not the inverse of $f$ that need not necessarily exist)

Example: The absolute value function from the domain of real numbers to the codomain of real numbers: $$f: \mathbb{R} \to \mathbb{R}, f(x)=|x|= \begin{cases} x & x \geq 0 \\ -x & x < 0 \end{cases}$$

The image in this case is $G=\{x|x\geq0\} \subset \mathbb{R}$.

For every $x \in G$ the preimage is $f^{-1}(\{x\})=\{x,-x\}$ beacuse the rule $x \mapsto |x|$ maps both positive and negative versions of $x$ to the positive $|x|$.

Let's consider the Cartesian product $D \times C$. all subsets $F \subseteq D \times C$ are called relations.

A relation $R$ is a function if and only if

1.1: $xRy \land xRz \implies y=z$. Equivalently: $(x,y),(x,z)\in R \implies y=z$.

1.2: $\forall x \in D, \exists y \in C$ such that $(x,y) \in R$

A function represented by relation $R$ can be:

2.1: Injective: $xRy \land zRy \implies x=z$. ($|x|$ is not injective)

2.2: Surjective: $C=G$. i.e the image is the entire codomain.

2.3: Bijective: 2.1 and 2.2. In this case there is a two sided unique inverse.

1: $g(x+y)$ is a composition of a function $h: D \times D \to T, h(x,y)=x+y$ on the function $g: S \to A$ dentoed $g \circ h$ with the restriction that the image of $h$ which is a subset $I \subseteq T$ is the domain of $g$: $S$. More accurately this is generally a restriction of $g$ to $I \subseteq S$.

In the equation $f(x)=g(x+y)$ it is helpful to "fix" $x$. In that case the LHS is fixed as well. But $y$ is variable of $h$ and by varying $y$ you can get the entire image of $h$ regardless of $x$. This means $g$ does not depend on $y$.

  • $\begingroup$ Note that what you're calling the "Target" is more formally known as the codomain (not to be confused with the range, which is the subset of the codomain for which there exists a preimage). $\endgroup$
    – Kevin
    Feb 10, 2018 at 4:10
  • 1
    $\begingroup$ Not sure but this seems to be far over the head of OP. You can't do the definition-theorem-proof style on someone struggling on informal mathematics already. Explaining functions via relations was never appropriate as a definition for beginners, but more a tool of set theory. $\endgroup$
    – M. Winter
    Feb 10, 2018 at 12:03

There's lots of interesting confusion in the question, so worth having asked. Rather than trying to answer point by point, I'll try to respond to (4):

Let's say that $h(x,y)$ is a function of distance. Then you can say $h(x,y)=k(x^2+y^2)$.

You have that exactly right. $h$ is a real valued function of two real variables. So is the function $$ d(x,y) = x^2 + y^2 $$ where the name "$d$" is chosen to remind us of "distance" (and you're right to note that you can skip the square root). Clearly $d$ is a function of two variables.

When you say "$h$ is a function of distance" you mean that there is some function $k$ such that $h$ is $k$ composed with $d$: $$ h(\text{whatever}) = k(d(\text{whatever})). $$ But $h$ is still a function of two variables: it takes two variables to specify the $x$ and $y$ separately in "whatever", whether that's the argument for $h$ or the argument for $d$.

Geometrically, "$h$ is a function of distance" just when it has it is constant on each circle centered at the origin.

I think you can take this explanation and use it to make sense of the "$g(x+y)$" in (1) and (2). In particular, the second bullet point in (2) makes no sense since $g$ as written depends only on the sum $x+y$ and you can't separately extract $x$ and $y$ to compute what you've written on the right side of the equality.

  • $\begingroup$ Thanks Ethan your explanation is very illuminating. It's been hard getting over the initial shock of seeing a "function based on distance" that does not have a square root. ONE MORE QUESTION -- Can I say that the following function $h$ is a "function of distance"? $$h(x,y) = \sqrt{x^{2}+y^{2}} + x$$ $\endgroup$ Feb 10, 2018 at 1:13
  • 1
    $\begingroup$ No. If all you know is the distance from $(0,0)$ to $(x,y)$ you can't know the value of $x$ you need to evaluate the right hand side of your equation. So $h$ is a function of two variables part of which is easy to calculate if you know the distance. $\endgroup$ Feb 10, 2018 at 1:17
  • $\begingroup$ Thanks that helps quite a bit. Looking at trivial examples helps me a lot. $\endgroup$ Feb 10, 2018 at 1:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .