replace f(x) with y
switch x and y
solve for y
replace y with g(x)
y=1/3x+2
x=1/3y+2
x-2=1/3y
3x-6=y
g(x)=3x-6
f(g(x)) should have the same result as g(f(x)) which should be x
f(g(x))=1/3(3x-6)+2=x-2+2=x
g(f(x))=3(1/3x+2)-6=x+6-6=x
the inverse is g(x)=3x-6