Find the inverse of $f(x,y) = (x+3y,3x+y)$ 
Given the function $f : \mathbb{R}^2 \to \mathbb{R}^2$ as $f(x,y) = (x+3y,3x+y)$. Find $f^{-1}$ .( Assume $f$ is a bijection)

I know how to find $f^{-1} (x) = (3x+2)$ or anything with one variable. But I am not sure how to proceed with 2 variables. Can anyone provide me with a step by step explanation?
Thanks
 A: You need to solve $(u,v) = (x+3y, 3x+y)$ for $x,y$.
In this case we get $3u-v = 8y$, hence $y = \frac{1}{8}(3u-v)$
and the same way we get $x = \frac{1}{8}(3v-u)$.
So $f^{-1}(u,v) = \frac{1}{8}(3v-u, 3u-v)$. You can check that this is true by computing $f\circ f^{-1}$ and $f^{-1}\circ f$.
A: One thing that might be useful is to observe that this is a linear function.  We can write $f(x,y) = (x + 3y, 3x + y)$ also in the matrix form
$$
f(x,y) \;\; \to \;\; \left [ \begin{array}{cc}
1 & 3 \\
3 & 1 \\
\end{array} \right ] \left [\begin{array}{c}
x \\
y \\
\end{array} \right ] \\
$$
Finding the inverse of $f$ should then be equivalent to finding the inverse of the matrix given below.  Try this out and let me know if you want more help.
A: We want a function that takes us from $(x+3y, 3x+y)$ to $(x,y)$. Let us assume that we can write this as $g(x,y) = (ax+by, cx+dy)$, then $$a(x+3y) + b(3x+y) = x+0y$$ and $$c(x+3y)+d(3x+y) = 0x+y$$
Hence the first equation gives us: $$a+3b = 1 \text{ and } 3a+b = 0$$ The second gives $$c+3d = 0 \text{ and } 3c+d =1.$$
Hence $-b = 3a$ and $a-9a = 1$ which gives $a=-1/8$ and $b=3/8$. Also $c=-3d$ and $-8d = 1$. Hence $d=-1/8$ and $c=3/8$.

This gives $g(x,y) = ( -1/8 x + 3/8 y, 3/8 x - 1/8 y )$
