Let y=f(x)=31x+6, then 31x=y-6 and x=y/31-6/31.
Let x=g(y)=y/31-6/31, so g(x)=f-1(x)=x/31-6/31 in the required standard form (m=1/31 and b=-6/31).
We need to prove this to be the inverse function f(f-1(x))=f-1(f(x))=x.
Let's prove it:
f(f-1(x))=31f-1(x)+6=31(x/31-6/31)+6=x-6+6=x✔️
f-1(f(x))=f(x)/31-6/31=(31x+6)/31-6/31=x+6/31-6/31=x✔️