How do we find the inverse of a vector function with $2$ variables?

$$f(m,n) = (2m+n, m+2n)$$

What do we have to do to find the inverse of this function?

I don't even know where to begin.


Denote $$\begin{cases} u=2m+n,\\ v=m+2n. \end{cases}$$ To find inverse mapping is sufficient solve this system w.r.t variables $m$ and $n$: $$\begin{cases} 2u-v=3m,\\ 2v-u=3n. \end{cases}$$ From there $$\begin{cases} m=\frac{2u-v}{3},\\ n=\frac{2v-u}{3}. \end{cases}$$ Then $f^{-1}(u,\ v)=\left(\dfrac{2u-v}{3}, \ \dfrac{2v-u}{3} \right).$


The following is a solution with matrices: $f$ can be regarded as a linear function, e.g. $\mathbb{Q}^2\to \mathbb{Q}^2$. With respect to the standard basis this is given by the matrix $$\begin{pmatrix}2&1\\1&2\end{pmatrix}$$ Now you can invert this matrix. There are different methods for that. I'm just using the explicit formula given by Cramer's rule. The inverse is $$\frac{1}{3}\begin{pmatrix}2&-1\\-1&2\end{pmatrix}$$ Now you can interpret this as a linear function again and get $f^{-1}(m,n)=\left(\frac{2m-n}{3},\frac{-m+2n}{3}\right)$.


I think this might be a useful place to begin: We can invert a function $f$ of a single variable by solving the equation $f(x)=y$ for $x$. For example, we invert $f(x)=2x+1$ by solving the equation $2x+1=y$ to get $x=(y-1)/2$. We can then write $x=f^{-1}(y)=(y-1)/2$, where $f^{-1}$ is the inverse required.

In your case, you need to do the 2-variable equivalent: solve the equation $f(m,n)=(2m+n,m+2n)=(a,b)$ to get the input $(m,n)$ - which plays the role of $x$ - in terms of $(a,b)$ - which plays the role of $y$. Your answer should have the form $(m,n)=f^{-1}(a,b) = (\hbox{an expression in $a$ and $b$}, \hbox{another expression in $a$ and $b$})$.