Solution (source code)

= Solution

For $r>0$, solve $f(s)=r$ with $s>0$. Multiplying by the positive denominator gives $s^2+s=1/r$, so the <quadratic formula> gives
$$
s=\frac{-1\pm\sqrt{1+4/r}}2.
$$
The minus sign gives a negative number and is inadmissible. The plus sign gives a positive number for every $r>0$, and it is the unique positive solution. Hence the <inverse function> is
$$
\boxed{g(r)=\frac{\sqrt{1+4/r}-1}{2},\qquad r>0.}
$$
Indeed $g(r)(g(r)+1)=1/r$, so $f(g(r))=r$. Conversely, for $s>0$, $\sqrt{1+4/f(s)}=\sqrt{(2s+1)^2}=2s+1$, giving $g(f(s))=s$. These verify both <inverse function> identities.