Finding the "triangular root" of a number. [duplicate]

A triangular number is a number that is the sum of the natural numbers up to some $n$. The closed form is $x = \frac{n(n+1)}{2}$. How do I get $n$ on one side? I've been looking at it from every angle, and I can't find out how. Any help?


The answer elsewhere in this thread is of course correct, but for actual calculation there is a simpler answer. We have $x = \frac12(n^2 +n)$ where $x$ is known and we want to find $n$. This is equivalent to $$2x+\frac14 = \left(n+\frac12\right)^2$$ or, neglecting the fractions, which I could justify with a more careful analysis, but won't, $$n\approx \sqrt{2x}.$$

And indeed the formula $$n = \left\lfloor\sqrt{2x}\right\rfloor$$ always gives the correct answer. ($\lfloor\ldots\rfloor$ just means to drop the fraction.)


$$n^2+n=2x$$

$$n^2 +n - 2x = 0$$

$$n = \frac{-1 +\sqrt{1+8x}}{2}\text{ provided $n \in \mathbb N,$ otherwise undefined}$$


For anyone unfamiliar, see proof.