I came across a way to find whether some number is inside a sequence of numbers. For example the sequence (simple function for positive odd numbers): $a(n) = 2n + 1.$ So the numbers inside it go: $1, 3, 5, 7, \ldots$
If I want to test if the sequence contains a number $N,$ I reverse the formula to this: $n = (N - 1) / 2.$ If $n$ is an integer, then we know that $N$ is inside the sequence.
But, here is my question, how can I find the inverse function of this formula: $a(n) = n(2n - 1)$
Note: Please do comment every step and explain the logic behind it, so I'll understand