Triangular number formula (Challenge #8)

More hosting issues recently… sigh. I’m seriously considering moving TMLT to a different hosting provider… the only problem being that right now, my hosting is free, and it might be hard to find another host which provides all the tools I need (LaTeX, imagemagick, PHP, and mySQL, for a start).

In other news, given the dismal frequency of my posts recently, I’ve decided to try sticking to a post-a-week schedule. We’ll see how it goes!

As you may recall (you probably don’t), I’m in the middle of a series of posts building up to a way of calculating tetrahedral numbers by hand. That’s still where we’re headed, but it will probably take a few more posts to get there! Today, we’ll take a small step in the right direction by deriving a simpler formula for calculating triangular numbers.

Recall that the nth triangular number (which we’ll call \Delta_n) is the sum of the first n positive integers:

\displaystyle\Delta_n = 1 + 2 + 3 + \cdots + n = \sum_{k=1}^n k.

[If the big E-looking thing scares you, don’t worry. It’s just a compact way of representing sums. If you’ve never seen it before, here’s a short explanation.]

What if you were asked to add up all the numbers from, say, 1 to 100? (Put down that calculator!) You could probably do it by brute force, but it would take a while, and you’d probably make a mistake. (Oh, you wouldn’t, eh? Well, excuse me, Mr. perfectpants.) Legend has it that the young Gauss was once asked to do just that by a schoolteacher who presumably wanted to get their students to be quiet for an hour or two. Gauss, however, stunned his teacher by immediately writing down the correct answer, having computed it in his head.

So, how did he do it? No one knows for sure what went through his head, of course, but it might have gone something like this. First let’s write down the sum in question and call it S:

S = 1 + 2 + 3 + 4 + \cdots + 99 + 100.

And now for something strange: let’s write S again, but backwards this time. Of course, since any sum is the same backwards as forwards, this is obviously pointless… or is it? The inspiration hits when we add the sum to itself:

\begin{array}{ccccccccccc}S & = & 1 & + & 2 & + & \cdots & + & 99 & + & 100 \\ +S & = & 100 & + & 99 & + & \cdots & + & 2 & + & 1 \\ \hline 2S & = & 101 & + & 101 & + & \cdots & + & 101 & + & 101 \end{array}

Look at that! Matching up the first term of S with the last term, the second term with the second-to-last term, and so on, forms pairs of terms which each add to 101. How many of these pairs are there? That’s easy; there are 100. We’re almost there:

\begin{array}{rcl} 2S & = & \overbrace{101 + 101 + \cdots + 101 + 101}^{100} \\ 2S & = & 101 \cdot 100 \\ S & = & 101 \cdot 50 \\ S & = & 5050. \end{array}

Voila! The sum of the numbers from 1 to 100 is 5050.

Now, as a challenge for you, I’ll let you use this technique to find a general formula in terms of n which can tell us the sum of the integers from 1 to n — that is, the nth triangular number, \Delta_n.

On to the next post in the series!

About Brent

Associate Professor of Computer Science at Hendrix College. Functional programmer, mathematician, teacher, pianist, follower of Jesus.
This entry was posted in challenges, computation, famous numbers, sequences. Bookmark the permalink.

12 Responses to Triangular number formula (Challenge #8)

  1. I had figured on using the knowledge that delta-10 = 55, multiplying it by 10, and adding delta-9 x 100 = 4500, but your method is easier and obvious in retrospect. It should have come to me like the multiple of two integers with a difference of 2 (subtracting 1 from the square of their average).

  2. Brent says:

    These sorts of things are always obvious in retrospect. =) That’s indeed a neat trick for multiplying two numbers with a difference of two, perhaps I will write about it sometime. Of course, it also easily extends to multiplying two numbers with a difference of 2k: subtract k^2 from the square of their average (in the case you mentioned, k=1). (n+k)(n-k) = n^2 – k^2.

  3. Rick Yorgey says:

    (n+1) x (n/2)

    Isn’t it just as likely that young Gauss skipped some of those steps by recognizing that 1+99=100 and 2+98=100, etc. In fact, it’s (49 x 100) + 50 + 100, and easier, it seems, to figure out in one’s head than the general method suggested (it’s certainly easier to multiply by 100 than by 101). But this “solution”, of course, is only “pretty” in this specific case (and a few carefully chosen others), hence the general formula above is, in the long run, more useful.

  4. Brent says:

    You got it. You’re absolutely right about the method to add up 1..100, that does seem like a more likely way of doing it in one’s head! For any particular problem involving particular numbers there are probably slick methods of doing it that make it easy to do in one’s head but don’t apply more generally. But of course really I was just trying to illustrate a method of arriving at the general solution, rather than speculate as to Guass’s mental processes. For all I know he had already added up all the numbers from 1 to 100 the previous week (the long way) and spent a couple seconds staring into space before he wrote down the answer just to make it look like he thought about it.

  5. And today I realize that I said “multiple” when I meant “product.” I knew it didn’t sound right.

  6. Deepika says:

    how would you write a sigma notation to find the sum of present given by true love in the twelve days of christmas?

  7. Frederick Stone says:

    Im looking for a formula related to triangular number

    1 3 6 10 15 21 28

    if u add up the numbers in a certain manner you get

    1+3=4 4+6=10 10+10= 20 20+15= 35 35+21= 56

    I need an algebraic formula to get these *irregular trinagular numbers* can anyone figure one out ( i cant)

  8. Pingback: Computing tetrahedral numbers « The Math Less Traveled

  9. Caroline says:

    Ugh…. how complicated. My dad tried to teach this to me once, but I never really got it. And by the way, the E looking thing does scare me a bit.

  10. Caroline says:

    teacher gave me this sheet which has a chart that says: n for the first column and under there 1 2 3 4…. the second column says “triangular number” at the top and underneath is 1 3 6 10 (and a few blank spaces under that for me to fill up, which i did, but the main prob is:) the third column says “sum of first n triangular numbers”, and underneath it says 1 4 10 and also blank spots.

    my Q is that wut does “sum of first n triangular numbers” mean and wut is the formula for finding it?
    u probably wont understand wut im asking. =]

  11. Brent says:

    Hi Caroline,

    “sum of first n triangular numbers” just means that you take the first n triangular numbers from the list, and add them up. If we list the triangular numbers like this:

    1 3 6 10 15 21 …

    The first triangular number is 1. The first two triangular numbers are 1 and 3, and if we add those we get 4. The first three triangular numbers are 1, 3, 6, and if we add 1 + 3 + 6 we get 10. See? 1, 4, 10. I’ll let you do the rest. =)

  12. Pingback: Challenge #8 solution | The Math Less Traveled

Comments are closed.