Aloha :)
$$\left. g=\frac{n(n+1)}{2}\quad\right|\cdot2$$$$\left. 2g=n(n+1)\quad\right|\text{rechts ausrechnen}$$$$\left. 2g=n^2+n\quad\right|+\frac14$$$$\left. 2g+\frac14=n^2+n+\frac14\quad\right|\text{rechts die 1-te binomische Formel anwenden}$$$$\left. 2g+\frac14=\left(n+\frac12\right)^2\quad\right|\sqrt{\cdots}\quad\text{nur positive Lösung, weil \(n\ge0\)}$$$$\left. \sqrt{2g+\frac14}=n+\frac12\quad\right|-\frac12$$$$n=\sqrt{2g+\frac14}-\frac12$$