How to find the formula given here (NOT PROOF)

50 Views Asked by At

I'm studying computer science, but my maths is a little lacking, and my course material isn't being explicit about how things are calculated (they expect you to just know).

Given a sequence such as:

(n − 1) + (n − 2) + ⋯ + 1

That results in the formula (if that's even the correct term?):

½n^2 − ½n

So:

(n − 1) + (n − 2) + ⋯ + 1 = ½n^2 − ½n

How do I work out what that formula(?) is?

What is that type of maths called?

I'm at a real loss... Without having any direction, it's nearly impossible to Google for a solution.

UPDATE:

So if I only had:

(n − 1) + (n − 2) + ⋯ + 1

How would I work out what the formula would be?

1

There are 1 best solutions below

0
On

Hint. You could use the following trick to obtain the formula: \begin{matrix} (n − 1) &+& (n − 2) &+& \dotsm &+& 1 \\ 1 &+& 2 &+&\dotsm &+& (n − 1) \\ \hline n &+& n &+& \dotsm &+& n \end{matrix}