Consider a function $f : Y_n \rightarrow X_{n^2} $
For any $(a, b) \in Y_n $, let $f((a, b)) = f(a, b) = an + b.$ Prove that $f$ is a bijection and find its inverse $f^{-1}$.
I am struggling to see how I can find an inverse of this multivariable function. I was already able to prove that $f(a,b) = an+b$ is a bijection, I'm just not certain how to find its specific inverse. It would be important to note that $Y_n=X_n \times X_n$ where $X_n = \{0,1,2,...,n-1\}$.
Any help would be appreciated. Thanks!
edit:
I've worked this out a little bit and came up with this, please let me know if this is invalid.
f-1(f(a,b)) = f-1(an+b)
let x = an+b
f-1(x) = f-1((floor(x/n)*n)+(x % n)) -> (floor(x/n), x%n)
Then $(a_1-a_2)n = b_1-b_2$.
If $a_1 \ne a_2$, $|LHS| > n > |RHS|$, which is absurd. Therefore, $LHS = RHS = 0$.