let y=f(x)
y = 3^x
to calculate inverse, we switch x and y and solve for y, where the new y=f-1(x).
x= 3^y [Note that 3^y is always positive, so x>0 should be assumed. ]
Take ln of both sides
ln x = ln (3^y) , assuming x>0
ln x = y * (ln 3) [property of logarithm]
Finally, solving for y = f^-1 (x) = ln(x)/ln(3) for all x>0.