# Should we stop teaching “interchange $x$ and $y$” when finding the inverse function?

In one textbook I use for College Algebra, the author teaches that one should interchange $$x$$ and $$y$$ when looking for inverse functions. For example, the inverse function of $$y=2x+2$$ is $$y=0.5x-1.$$

In a calculus textbook the author does not teach interchanging variables. For example, the inverse function of $$y=2x+2$$ is $$x=0.5y-1.$$

Surely there is no substantial difference between using $$x$$ as the variable and using $$y$$ as the variable for a function. I am a bit concerned about the two different teachings my students received from two different courses as students may get confused. Should we stop teaching "interchange $$x$$ and $$y$$" when finding the inverse function?

p.s. If we do teach "interchange $$x$$ and $$y$$" when finding the inverse function", the inverse function of

$$C=\frac{5}{9}(F-32)$$

should be $$C=\frac{9}{5}F+32,$$where in the inverse function, $$F$$ stands for the temperature in Celsius while $$C$$ stands for the temperature in Fahrenheit. Isn't this confusing?

• Yes! I stopped doing this long time ago and I am only annoyed when see this happen. It's a part of a bigger problem: making compositions of functions of the same variable: $f(x)=x^2$ and $g(x)=\sin x$. – Peter Saveliev Feb 28 '20 at 17:16
• This kind of thing seems to worry math teachers a lot. I have never seen evidence that it is a problem for students. The reason informal or non-rigorous notation exists is because the people who made it up found it natural. A student who understand the concept will also probably find it natural. – Ben Crowell Feb 28 '20 at 18:21
• For what I used to do (I no longer teach) and why, see my answer to When discussing inverse functions, how can our notation and methods reinforce student understanding? – Dave L Renfro Feb 28 '20 at 18:22
• There have been several discussion of this question online. Here is one blogs.ams.org/matheducation/2016/11/28/… – Michael Bächtold Feb 29 '20 at 8:25
• I think you are correct to not switch variables. The motivation for switching variables is just an overloading of the importance of always using the same letter for the input of a function. It is inculcating a certain rigidity which is neither helpful or mature... – James S. Cook Mar 1 '20 at 18:06

## 6 Answers

It's important to clarify the difference between the way mathematicians do things, and the way scientists do things. In math, we typically reserve $$x$$ for the independent variable (aka input) and the horizontal axis, while $$y$$ is reserved for the dependent variable (aka output) and the vertical axis. With these variable choices, we need to swap variables in the process of finding the inverse.

In science, variables generally stand for something meaningful. $$F$$ means Fahrenheit, $$C$$ means Celsius, and the relationship can be written with either one as input. So we can think of $$F$$ as a function of $$c$$: $$F(c) = \frac{9}{5}\cdot c + 32,$$ or of $$C$$ as a function of $$f$$: $$C(f) = \frac{5}{9}\cdot(f-32).$$ In this case, there is of course no swapping, in going from the first equation to its inverse, meaning is properly preserved by writing $$f$$ instead of $$F(c)$$, and then solving for $$c$$.

I think it's important for algebra students to see the science way, which is more concretely meaningful. Eventually, they need to understand inverse functions done with $$x$$ and $$y$$, also.

• This is a good answer, but let's be clear: the science approach is not only "more concretely meaningful". It's the only meaningful approach and the "way mathematicians do things" completely lacks meaning. There's no place where we all agreed that "$x$ is reserved for the independent variable" (because then it would be forbidden to talk of parametrised curves and write $x=f(t)$) or that the horizontal axis has alway to be labeled $x$. (Because then we couldn't plot $x$ as function of $t$, with $t$ on the horizontal axis.) – Michael Bächtold Feb 29 '20 at 8:46
• I have never seen y on the horizontal axis. You are right about parametrized curves, so I added the word typically in the first part of the second sentence. You are overstating your case. It is often helpful to have traditions like x being the input and y being the output. – Sue VanHattum Feb 29 '20 at 19:36
• Why do you think it is helpful to have this tradition? – Michael Bächtold Feb 29 '20 at 22:18
• @MichaelBächtold I don't know if this is tradition. I do know it's helpful. In these days, many students learn programming first, math later. When you use the words "input" and "output", they tend to understand it better. This is my personal experience. – scaaahu Mar 1 '20 at 9:33
• Hmm. Do you have any examples of x and y being used in reverse fashion to the convention, for some good reason? – Sue VanHattum Dec 27 '20 at 16:26

Since $$y=2x+2$$ and $$x=0.5y-1$$ have the same graph on the x-y plane, I am hesitant to call them inverse functions.

Clearly, it's just a matter of making a distinction between independent variables and dependent variables. It is both traditional and sensible to treat $$x$$ as the default independent variable and $$y$$ as the default dependent variable. Based on that, I don't have a problem teaching that an inverse function switches the roles of the independent and dependent variables and that is why we exchange the variable names. If an author had a bee in their bonnet that we shouldn't assume the dependence of a variable they used to describe it, I suppose they're welcome to fight for that hill.

It is also the tradition to use $$x$$ as the dummy independent variable in function notation. So I have no difficulty in saying that $$f(x)=e^x$$ and $$f(x)=\ln x$$ are inverse functions, and would be unnecessarily confused if an author felt compelled to switch one of those dummy variables.

• IMO, there are too many defaults drilled into students' heads, like x is an independent variable, x axis is horizontal, values always increase to the right, while in reality an independent variable can have name different from x, and arrowhead or the unit segment indicate the direction in which values increase. 𝑦=2𝑥+2 and 𝑥=0.5𝑦−1 drawn on the same plane and having the same graph are inverse, they both single-valued, no problem, just change the point of view, this also helps in real life and in politics. But the full graph of $y=x^2$ cannot be used for its inverse. – Rusty Core Feb 28 '20 at 17:57
• The difference between the two is seen in the difference between the $xy$-plane and the $yx$-plane. – Peter Saveliev Feb 28 '20 at 20:22
• "I'm hesitant to call them inverse" You wrote down two equations and it's not clear if by "them" you mean the equations or the variables $x$ and $y$. (Also: an equation is not a function (in the modern sense), neither is a variable like $x$ and $y$.) – Michael Bächtold Feb 29 '20 at 9:24
• That first line feels like the answer. Manipulating an equation to isolate the other variable isn’t the same as an inverse function. The question itself suggests a strong confusion on the part of the asker. – JTP - Apologise to Monica Feb 29 '20 at 12:34

I usually introduce the idea of inverse functions by linking it to the idea of basic composite functions

For your example, I'd ask: What are the (intermediary) functions done to $$x$$ to get $$2x+2$$?"

• Given $$x$$, we'd multiply by $$2$$ and then we'd add $$2$$
• So it's like we have $$y=f\left(g\left(x\right)\right)=2x+2$$, where $$f(x)=x+2$$ and $$g(x)=2x$$

Then to get $$x$$ from $$y=f\left(g\left(x\right)\right)$$, we'd have to undo those $$f(x)$$ and $$g(x)$$ functions.

• The inverse of $$f(x)$$ is what undoes $$x+2$$, so $$f^{-1}(x)=x-2$$
• Likewise, $$g^{-1}(x)=\frac{x}{2}$$

And introduce that $$f^{-1}\left(f(x)\right)=x$$, which is basically "whatever is done to $$x$$ by the function $$f(x)$$ is undone by $$f^{-1}(x)$$"

• So if $$f^{-1}(x)$$ was applied to $$y$$, we'd have $$f^{-1}\left(f\left(g\left(x\right)\right)\right)=g\left(x\right)$$
• Algebraically, $$[2x+2]-2=2x$$
• Then if we apply $$g^{-1}(x)$$, we'd get $$g^{-1}\left(g(x)\right)=x$$
• Algebraically, $$\frac{2x}{2}=x$$

If you're teaching younger students (like middle school grade?), I might use a sort of "last in; first out" analogy. Like "when you are getting ready to walk out the door, first you'd put your sock on and, lastly, put on your shoe. Coming home, you'd need to take off your shoe, and then take off the sock"

-

Obviously a big downside is that it only works for very simple functions but I do like it since it always keeps the idea of an inverse function linked to the function itself, rather than just swapping variables and solving.

I've found it most helpful when teaching students new to trigonometry since, for example, $$\sin(\theta)=\frac{O}{H}$$ and you want to solve for $$\theta$$

• To get $$\theta$$ alone, you need to "undo" that $$\sin$$ function that is done to $$\theta$$.
• To undo $$\sin$$ you need $$\sin^{-1}$$, and since it's an equation what is done to one side you need to do it to the other.
• Algebraically, $$\sin^{-1}\left(\sin(\theta)\right)=\sin^{-1}\left(\frac{O}{H}\right)$$
• $$\longrightarrow \theta = \sin^{-1}\left(\frac{O}{H}\right)$$

I can't spot in any of the other answers what I think is the main point.

Neither teaching students to swap variables or teaching them not to switch variables is really the solution, as both of these simply train students to carry out a mechanical process without understanding what is going on.

Either way, for the student the 'inverse' of a function remains 'the formula I get at the end of carrying out these steps'.

What is lacking is the more basic idea of what a function is. While a function is a formula written on a page, the concept of an inverse doesn't really mean much. I'd say what needs adding is:

• a function is a rule for taking an input number and giving an output number (this definition should be sufficient in the circumstances);
• and the same function can be written in more than one way.

I was really hit by how little understanding students have of functions when I wrote down $$f(x)=x^2+2$$ and asked them to write down what $$f(y)$$ was. Most of them got there after some thought, but really weren't sure they had the right answer (which explains why they were finding linear functions so hard).

Once you have those ideas, you are in a better position to teach that:

Sometimes is it right to change the variables. Sometimes it's not. You have to make a decision based on the meaning you are attaching to the symbols you have written down.

Let me take a moment to look at an example which involves more variables. Consider the map defined by: $$f(x,y) = \left( \frac{x}{x^2+y^2},\frac{-y}{x^2+y^2}\right)$$ for $$(x,y) \neq (0,0)$$. Let us study how to find the inverse map. We seek $$f^{-1}$$ such that $$f(f^{-1}(u,v)) = (u,v) \qquad \& \qquad f^{-1}(f(x,y))=(x,y)$$ for all appropriate $$(u,v)$$ and $$(x,y)$$. If $$f: dom(f) \rightarrow range(f)$$ then $$f^{-1}: range(f) \rightarrow dom(f)$$. In this example we should eventually be convinced that $$dom(f)=range(f) = \mathbb{R}^2-\{ (0,0)\}$$.

Pragmatically, to calculate the formula for the inverse we can set $$f(x,y) = (u,v)$$ and solve the following for $$x$$ and $$y$$. $$\left( \frac{x}{x^2+y^2},\frac{-y}{x^2+y^2}\right) = (u,v) \ \ (*)$$ Remember, we assume $$(x,y) \neq (0,0)$$ hence multiplication by $$x^2+y^2$$ is a reasonable step. $$(x,-y) = (u(x^2+y^2), v(x^2+y^2))$$ which means $$x = u(x^2+y^2)$$ and $$-y = v(x^2+y^2)$$. Suppose $$u,v \neq 0$$, we can return to the cases $$u=0, v\neq 0$$ and $$u \neq 0, v=0$$ after we've finished the interesting case. We already can rule out the case $$u=v=0$$ since that forces $$x=y=0$$ in view of the above equations. Now solve both equations for $$x^2+y^2$$, $$x^2+y^2 = \frac{x}{u} = \frac{-y}{v} \ \ (**)$$ Next, consider $$u^2+v^2 = \left(\frac{x}{x^2+y^2} \right)^2+ \left(\frac{-y}{x^2+y^2} \right)^2 = \frac{x^2+y^2}{(x^2+y^2)^2} = \frac{1}{x^2+y^2} \ \ \Rightarrow x^2+y^2 = \frac{1}{u^2+v^2}.$$ Great, now with the above and (**) we derive: $$\frac{x}{u} = \frac{1}{u^2+v^2} \qquad \& \qquad \frac{-y}{v} = \frac{1}{u^2+v^2}$$ Thus, $$x = \frac{u}{u^2+v^2} \qquad \& \qquad y = \frac{-v}{u^2+v^2}$$ We find, $$f^{-1}(u,v) = \left( \frac{u}{u^2+v^2}, \frac{-v}{u^2+v^2} \right)$$ But, what about $$u=0, v\neq 0$$ ? Let's investigate if the formula above works in such a context, \begin{align} f(f^{-1}(0,v)) &= f\left( \frac{0}{0^2+v^2}, \frac{-v}{0^2+v^2} \right) \\ &= f(0, -1/v) \\ &= \left(\frac{0}{0^2+(-1/v)^2}, \frac{-(-1/v)}{0^2+(-1/v)^2}\right) \\ &= \left(0, \frac{1/v}{1/v^2}\right) \\ &= \left(0,v \right). \end{align} Similar calculations show that $$f(f^{-1}(u,0)) = (u,0)$$. Indeed, you can check, $$f(f^{-1}(u,v) = (u,v)$$ for all $$(u,v) \neq (0,0)$$. Amusingly, pretty much identical calculations reveal that $$f^{-1}(f(x,y)) = (x,y)$$ for $$(x,y) \neq 0$$. In fact, since $$dom(f) = range(f)$$ we might as well say $$f=f^{-1}$$ in this case. But, if I intend to keep distinct the copies of $$\mathbb{R}^2$$ in which $$dom(f)$$ and $$range(f)$$ reside then writing $$f=f^{-1}$$ is not a good idea. I suspect a notation such as: $$f: dom(f) \subset \mathbb{R}^2_{xy} \rightarrow range(f) \subset \mathbb{R}^2_{uv}$$ and $$f^{-1}: range(f) \subset \mathbb{R}^2_{uv} \rightarrow dom(f) \subset \mathbb{R}^2_{xy}$$ is helpful.

Fine, full disclosure, $$f(z) = 1/z$$ hence $$w=1/z$$ yielding $$z =1/w$$ gives $$f^{-1}(w) = 1/w$$ is the better way to see that the reciprocal map on the punctured plane is it's own inverse.

If students in the precalculus are taught to solve for the independent variable in terms of the dependent variable then it is a fairly easy transition to higher dimensions where we simply solve for the independent variables in terms of the dependent variables.

Consider the equation in its two different arrangement of variables: $$y=x+5$$ and $$x=y-5$$;

for $$x$$ (independent variable value) as input, I am getting a set of $$y$$ (values dependent on input '$$x$$' variable values). Plotting them on a graph(where $$x$$ is independent and $$y$$ is the dependent variable) I get:(Line in red) for $$y$$ (independent variable value) as input, I am getting a set of $$x$$ (values dependent on input '$$y$$' variable values). Plotting them on a graph (where $$y$$ is independent and $$x$$ is the dependent variable) I get:(Line in blue(overlapping the red line made by the first equation) which is the same thing (since it's the same equation), but in this case the axes aren't the same, they are in a way "interchanged", so in order to represent the the inverse function (which is a function, lets say, $$g(x)$$ i.e a function where $$x$$ is dependent and $$y$$ is independent) we swap the variables so they can be plotted to get the inverse function in terms of $$x$$ as independent variable.

The inverse function is the line in green (with $$x$$ as dependent variable) So, in conclusion, this is how I understand it and how I explain the "interchanging of x and y" to myself. It ultimately translates to undoing of a function that is done on independent variable x. Maybe you could explain it in this way while teaching.