Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Trying to figure out an expression for adding exponents

  1. Apr 2, 2012 #1
    Basically I am trying to find an expression that can add exponents. Here is an example, lets say we start with n=5, I need something that will calculate 5^2+4^2+3^2+2^2+1^1 by putting in whatever value for n that I choose.

    So far I have

    The end, n(n-1) isn't working quite right. I need to get it to be the same as (n-1) as in the example using n=5 above, or in other words
    n(n-1) = 4^2+3^2+2^2+1^2
    which it doesn't lol

    Looking at it, I am basically running into the same issue again and may need to just start from scratch lol, what do you think?
  2. jcsd
  3. Apr 2, 2012 #2

    Stephen Tashi

    User Avatar
    Science Advisor

    That isn't a good title for what you're doing. You're trying to figure out a closed form formula for the sum of the squares of the first n consecutive integers. I'll assume you're interested in the general method for solving such problems because you could have looked this formula up easily (and someone will probably post the answer). The general topic you should look up is "The Calculus of Finite Differences".
  4. Apr 2, 2012 #3


    User Avatar
    Homework Helper

    The sum of a series of squares will be some cubic function. In this case:

    [tex]\sum_{i=1}^n i^2 = \frac{1}{3} n^3 + \frac{1}{2} n^2 + \frac{1}{6} n[/tex]

    Link to articles with various methods to solve this:



    For the sum of cubes:


    One general method for finding the sum of integers to the power p:

    [tex]\sum_{i=1}^n i^p = c_{p+1} \ n^{p+1} + c_{p} \ n^{p} + c_{p-1} \ n^{p-1} + ... c_{1} \ n[/tex]
    Generate p+1 equations using the numbers 1 to p+1, then use linear algebra to solve for the p+1 coefficients.
    Last edited: Apr 2, 2012
  5. Apr 3, 2012 #4
    That is correct; it's more fun to try to derive it, anyone can use Google lol.

    The first part I did is pretty useless really [n^3-n^2(n-1)] because what is left out of the formula will have to start out with the next integer down, basically it's an overly complicated way of stating [n^3-n^2(n-1)] = n^2 but it may still be helpful for the remainder.

    Hah, yeah your title is better than mine lol.
  6. Apr 3, 2012 #5
    Very good information, although I'm more interested in trying to derive it.

    Here is the formula as it sat, n^3-n^2(n-1)+[n(n^2+1)]/2
    The first part really can be simplified giving n^2+[n(n^2+1)]/2 with the nuts and bolts of it being [n(n^2+1)]/2; so I'm tossing out the beginning but now it's way off.

    There is a pattern in the outcomes when plugging in values for n, for example at:

    n=1 it works (no surprise)
    n=2 it works
    n=3 answer off by 1
    n=4 " 4
    n=5 " 10
    n=6 " 20
    n=7 " 35
    n=8 " 56
    n=9 " 84
    n=10 " 120

    So maybe we just need a formula that will give these values for each integer and tack it on then simplify? This is assuming the first part of the formula will let us do that lol
  7. Apr 3, 2012 #6


    User Avatar
    Homework Helper

    The general method I mentioned before is how these type of series are usually converted into polynomials. It's essentially using a pattern of values, usually 1 through p+1 to generate the p+1 equations I mentioned before.
  8. Apr 5, 2012 #7
    Oh okay, I'm not familiar with that. What is c? How does p work?

    I tried a different method and thought I was doing pretty well and got:


    until I realized it only calculated for values 3≤n≤5 lol
    Then a familiar pattern re-emerged
    n=6 answer was off by 1
    n=7 " " " " 5
    n=8 " " " " 14
    n=9 " " " " 30
    n=10 " " " " 55
    etc etc etc

    In other words this formula is just a complicated way of pushing the same problem I am trying to solve except now it starts at n=6 with the value being n^2+(n-5)^2; pretty funny!

    It seems the direction I am going will only continue to push the formula further down for a given n value so it doesn't seem like a good idea to continue in this direction.

    I was thinking about doing some hard calculations for n values and look for patterns in percentage differences next and try to derive a formula from that.

    Any thoughts?
    Last edited: Apr 5, 2012
  9. Apr 5, 2012 #8


    User Avatar
    Homework Helper

    c is just a set of coefficients to a polynomial. p is the power of i used in the summation series. There are p+1 terms, so you need to generate p+1 equations, then use linear algebra (or matrices) to solve for the coefficients c.

    Using the original post as an example, 12 + 22 + 32 + ... + n2, p = 2, and you need p+1 = 3 equations to determine the coefficients for
    c3 n3 + c2 n2 + c1 n, using the values 1 through 3 for n:

    c3 13 + c2 12 + c1 1 = 12 = 1
    c3 23 + c2 22 + c1 2 = 12 + 22 = 5
    c3 33 + c2 32 + c1 3 = 12 + 22 + 32 = 14

    01 c3 + 01 c2 + 01 c1 1 = 01
    08 c3 + 04 c2 + 02 c1 2 = 05
    27 c3 + 09 c2 + 03 c1 3 = 14

    then solving for the c's: c3 = 1/3, c2 = 1/2, c1 = 1/6, resuting in (1/3) n3 + (1/2) n2 + (1/6) n.
    Last edited: Apr 5, 2012
  10. Apr 8, 2012 #9
    WOW! This works remarkably well and makes a great deal of sense! My hat goes off to you rcgldr :) I'm also glad to see I was on the right track with n^3!

    I see I was getting close using a different approach, although it's similar to this method. I think I will follow it through and see how well it works by comparison when i am done; that is if I can get there lol!
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Discussions: Trying to figure out an expression for adding exponents