If we apply a function and then its inverse, we should get back to where we started.
Suppose we start with an element x. If we apply f to it, we get to x+2. In order to get back to where we started (i.e. x), we need to subtract 2.
Hence, the inverse of the function f is
f-1=x-2.