Search the complete library

What do you want to learn or calculate?

Quick linksAll calculatorsMath subjectsPractice questionsFormula library
← Discrete Math formulas

Sum of first integers

Add consecutive positive integers efficiently.

Discrete Math · Sums
$$\sum_{k=1}^{n}k=\frac{n(n+1)}2$$

Sum of first integers is one of 2 sums formulas in the discrete math section of this library, and it is used at high school · university level.

Why sum of first integers works

Write the numbers 1 through n forwards, then write them again backwards underneath. Every column adds to n + 1, and there are n columns, so the two copies together total n(n + 1). Since you wrote the list twice, half of that is the sum you wanted.

What each symbol means

$n$ is a nonnegative integer.

Sum of first integers: when it holds

For an empty sum at $n=0$, the result is $0$.

When it stops applying

It only counts consecutive whole numbers starting at 1. To add 20 through 50, take the sum to 50 and subtract the sum to 19: 1275 − 190 = 1085. Feeding 31 terms into the formula directly would give 496, which counts the wrong numbers entirely.

Sum of first integers: a worked example

$1+2+\cdots+100=100(101)/2=5050$.

The mistake to avoid

What people do: Students reach for n(n − 1)/2 instead, mixing this up with the handshake count.

Why it goes wrong: That formula stops one short. For n = 100 it gives 4950, which is the total up to 99, so the answer is short by exactly the last term.

Do this instead: Test the formula on n = 3, where you can add 1 + 2 + 3 = 6 in your head. Only n(n + 1)/2 returns 6, and it correctly gives 100(101)/2 = 5050 for the first hundred.

Sum of first integers: step by step

  1. Name the unknown, and the unit the answer has to come out in.
  2. Match the symbols to your values. $n$ is a nonnegative integer.
  3. Check the conditions before substituting. For an empty sum at $n=0$, the result is $0$.
  4. Substitute, keep exact values to the last line, then test the sign, size, and unit against a rough estimate — the check that catches most discrete math slips.

Where this formula fits

Subject
Discrete Math formulas — 11 entries in this library
Topic
Sums
Level
High school · University

Formulas are easiest to keep when they sit inside a method rather than on a list. Use the links below to see where sum of first integers comes from, to check a calculation against a tool, and to practise it until you can recall it without looking.

Questions about sum of first integers

Does the pairing still work when n is odd?

Yes. With n = 5 the pairs are 1 + 5 and 2 + 4, each making 6, and the leftover 3 is exactly half of 6. The formula gives 5(6)/2 = 15, which matches counting by hand.

How do I add all the even numbers up to 100?

Factor out the 2: 2 + 4 + ... + 100 is 2(1 + 2 + ... + 50), which is 2 times 1275, or 2550. The same trick works for any multiples of a fixed number.

Can the answer ever come out as a fraction?

No. Of any two numbers in a row, one is even, so n(n + 1) is always even and the division by 2 comes out clean. A fractional answer means an arithmetic slip.

Is this the same as the number of edges in a complete graph?

They are closely related but shifted by one. The complete graph on n vertices has n(n − 1)/2 edges, which equals the sum of the first n − 1 whole numbers.

Stuck on a problem?

Work a sum of first integers problem step by step

Type your own problem, or upload a photo of it. You get the method, the answer, and a check you can repeat yourself.