I am trying to solve the following recurrence relation but I think there's an error in my logic or thought process. Can you please help me? Here's what I have done so far.
n >= 1 is an integer
T(1) = 1
T(n) = T(n-1) + n
My approach is below
T(n) = T(n-1) + n = T(n-1-1) + n-1 = T(n-2) + n-1
T(n) = T(n-2) + n-1 = T(n-2-1) + n-1 + n -1 = T(n-3) + 2n -2
T(n) = T(n-3) + 2n -2 = T(n-4) + n-1 + 2n - 2 = T(n-4) + 3n - 3
By observation, I was came up with
T(n) = T(n-k) + Kn -k + n
Let k = n-l
Therefore
T(n) = 1 + n^2 -n -n + 1 -n = 2 + n^2 - n
However, this solution doesn't seem correct....
There is a mistake in your first line. You wrote
That second equality is false. I think what you meant to write is
That is, you apply the same recursion relation to the $T(n-1)$.