I am attempting to find the complexity of an algorithm and I have noticed that the following pattern emerges:
Problem size of:
Problem size(1) = 1
Problem size(2) = 1 + 1
Problem size(3) = 2 + 1 + 1
Problem size(4) = 3 + 2 + 1 + 1
Problem size(5) = 4 + 3 + 2 + 1 + 1
Problem size(6) = 5 + 4 + 3 + 2 + 1 + 1
Problem size(7) = 6 + 5 + 4 + 3 + 2 + 1 + 1
Therefore I get the following recurrence relation I believe: T(n) = T(n-1) + (n - 1)
How do I convert this into a quadratic formula?
I have the following: ((n^2 - n) / 2) + 1 which I have done with trial and error, however how can I get a systematic way of solving this?
I have no idea which branch of maths this is, not sure if the tags are correct.
The sum $1+2+3+\cdots+n$ is a triangular number; there is a well known formula for them, which you seem to have rediscovered. Well done!
More generally, what you have is an aritmetic series (and then a trailing $+1$). The sum of an arithmetic series can be computed as the number of terms, here $n$, times the arithmetic mean of the first and last terms, here $\frac{1+n}2$. (This formula is sometimes known as Gauss's trick, due to a -- probably apocryphal -- story that Gauss used it to calculate $1+2+3+\cdots +100=5050$ as a schoolchild).