Solve the equation #y=\frac{2x+1}{x}# for #x# in terms of #y#. Do this by first multiplying both sides by #x# to get #xy=2x+1#. Then subtract #2x# from both sides to get #xy-2x=1# and then factor to get #x(y-2)=1#. Finally, divide both sides by #y-2# to get #x=f^{-1}(y)=\frac{1}{y-2}#.
Oftentimes people now "swap" the #x# and the #y# around to write the answer as #y=f^{-1}(x)=\frac{1}{x-2}#. There are two main reasons this is done: 1) people are used to using "#x#" for the independent variable and "#y#" for the dependent variable and, more significantly, 2) This swapping leads to the reflection property: the graphs of #y=f(x)# and #y=f^{-1}(x)# are reflections of each other across the #45^{\circ}# line #y=x#.
As a purely symbolic matter, the swapping is not necessary. In fact, if the variables have specific real-life meanings, it's best not to swap them.