Beginner questions about how functions work

Background

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!


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.


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.


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$.