Main content

### Course: Calculus, all content (2017 edition) > Unit 7

Lesson 7: Series basics challenge# Sum of n squares (part 2)

What is the sum of the first n squares, 1 + 4 + 9 + 16 + ... + n²? In this video we find one possible formula for this sum. Created by Sal Khan.

## Want to join the conversation?

- How do you know that if the difference of the differences is constant, that you have a 3rd order polynomial?(14 votes)
- I think that it has something to do with the derivative of a function and how f(x) changes when x is increased by 1.

For example when f(x) = m*x + b its first derivative is a constant and when you increase x by 1, f(x) increases by a constant (m).

An equation in the form f(x) = a*x^2 + b*x + c its second derivative (or the derivative of its derivative) is a constant.

So, if you have an equation where its third derivative is a constant or as x increases by 1 f(x) increases by a square then f(x) should be in the form a*x^3 + b*x^2 + c*x + d(24 votes)

- 4:14, Shouldn't it be the first n+1 squares since we're starting at 0 or do most people start at 1 so it's the first n squares? If the latter, why is Sal starting at 0?(2 votes)
- I think he started at 0 to eliminate the D term (in the previous video). Our Sigma in this starts at 0, also, so he had to start at 0 to evaluate the formula.(10 votes)

- Why can we assume that the formula is a cubic? Shouldn't it be verified by induction?(4 votes)
- A constant set of differences on the third degree is characteristic of a cubic polynomial. Sal showed that taking the differences between terms through three levels ultimately led to constant differences, proving that the general formula is a polynomial of third degree.(5 votes)

- this maybe a silly question but why sum goes from 0 to n, and not from 1 to n?(3 votes)
- That's not a silly question at all. It turns out that that the sum can be from 0 to n or from 1 to n, it really depends on the question or your preference. Sometimes it's just easier to start from 0, because that would usually be the first term in a series, with no exponents. I hope that clarified a little bit.(4 votes)

- Hey, when solving this system of equations, is it ok to use a matrix of 3 by 3 with all the coefficients of each equation and solving it in RREF form/ identity matrix of 3 by 3?

If so, which method would be an advantage of the other?(2 votes)- I think you mean what I'd call an augmented matrix:

1 1 1 1

8 4 2 5

27 9 3 14

Yes?

(sorry they aren't aligned nice and neat, haven't researched how to make it do ht in the comments)

You can do it that way. Sal appears to be covering it in a way for people who don't know/remember much Linear Algebra.

At two colleges I've attended sequences and series don't get covered until second semester of Calc. Linear Algebra required Calc I, but Calc II did not require Linear Algebra. It is possible they wouldn't recall from the dark days of High School algebra how to use a matrix to solve.

Personally I find the augmented matrix better since it solves for all three values at the same time. Both work, so which is better is somewhat subjective.(5 votes)

- Trying to come up with an equations where all possible permutations/combinations of numbers 1 through 10 that add up to 10 without repeating the combination? Have not been able to solve this.(1 vote)
- I am assuming you mean integers, because if you include decimals there are infinitely many ways to do this. I am also assuming you mean to use each number only once. If you are allowed to use a digit more than once, then there will be far more possibilities than mentioned here.

Rather than trying to do this in one single step, with one formula, it is better to break it into more manageable pieces.

Do it in sets of how many numbers you are adding. The most you'll have is 4 because the only way to sum to 10 with those integers is 1+2+3+4.

So, with 1 addend, there is only one way: 10 = 10

With 2 addends, you have 1+9, 2+8. etc.

With 3 addends, you have a bit more difficulty, start with 1 and then find sets of two numbers that add to 9. Then use 2 and find two digits that add to 8, then 3 plus two digits that add to 7, and finally 4 plus two numbers that sum to 6. You won't need to do 5 through 10 because either you will have already used that set of numbers (in the cases of 5 through 7) or there won't be any (in the cases of 8 through 10).

You'll need to sort the list because you may have some repeats.

Again, if you are allowed to reuse an integer, then there will be far more than these.(5 votes)

- What happens in the polynomial if n is a non-integer value, such as 0.5? Is the domain of n restricted in this, and how would one represent that restriction?

Thanks!(2 votes)- This question involves "sequences" and the sums of sequences that we call "series". Sequences are defined discretely. These are NOT continuous functions and thus are not defined at non integer values of n. So yes, you can think of this as a domain restriction of the x^2 function to just the natural numbers n=1,2,3,...(1 vote)

- I thought the formula was (n*(n+1)*(2n+1))/6.

Does it have to do with the fact that Sal started at 0 but (n*(n+1)*(2n+1))/6 starts at 1?

But 0^2 is 0 so nothing should change! Please help! Thanks(2 votes) - Does i always have to be 0 in order for this formula to work?(1 vote)
- In order for this formula to work "i" doesn't always have to start at 0, but it typically will. If it doesn't start at 0, then you will need to have 4 equations instead of 3 to solve for all 4 variables.(2 votes)

- Sal says at the end you can multiply all the way to 100 using that formula , but wouldn't it be a fraction cause 1/3*100^3 it's gonna be 1,000,000 divided by 3(1 vote)
- The entire formula is 1/3*n^3 + 1/2*n^2 + 1/6*n

Though it may be true that each of these terms might turn out to be a number with fractional part. But when all these terms are added together, even a bunch of fractions can add up to a whole number.

This is the case when n = 100. We would get 1000000/3 + 10000/2 + 100/6. It is true that the first and last terms are fractional when simplified. But they add up to a whole number. And we get a final answer as 338350.(2 votes)

## Video transcript

We're now ready to
solve for A, B, and C, given these three equations
with three unknowns. So let's first start with
these top two constraints. So I have this one
right over here in blue. Let me just copy and
paste it right over here. And then let me rewrite
this constraint, but let me multiply
it by negative 2 so that I can cancel
out the C terms. So it's negative 2A
minus 2B minus 2C is equal to negative 2. And then, if I add the left-hand
sides and the right-hand sides, on the left-hand sides, I get
6A plus 2B-- these cancel out-- is equal to 3. And then the other
constraint I could use is this orange one
and the green to get the C's to cancel out here. So I have 27A plus 9B
plus 3C is equal to 14. And here, let's see. I can multiply it
by negative 3 if I want to get the C's
to cancel out again. And my whole goal is to have two
equations and two unknowns that have leveraged these two
constraints in tandem and these two
constraints in tandem. So now I'm going do these two. So I've multiplied this
equation times negative 3. I get negative 3A minus 3B
minus 3C is equal to negative 3. And now I can perform
the subtraction. And I get 24A plus 6B-- these
cancel-- is equal to 11. Now I have two equations
in two unknowns. And let's see. If I multiply this
equation right over here times
negative 3, I should get the B's to cancel out. So let's do that. So if I multiply this
times negative 3, this constraint, or this
term, 6A times negative 3, is negative 18A. 2B times negative 3, minus 6B,
is equal to 3 times negative 3 is equal to negative 9. And now if we add both
sides, on the left-hand side, we have-- let's see. 24A minus 18A is 6A-- these
cancel-- is equal to 11 minus 9 is 2. Divide both sides by 6. We get A is equal to 2/6,
which is the same thing as 1/3. And so now we can substitute
back to solve for B. So let's see. We have 6 times 1/3. Our A is 1/3. Plus 2B is equal to 3. 6 times 1/3 is 2. 2 plus 2B is equal to 3. Subtract 2 from both sides. 2B is equal to 1. Divide both sides by 2. B is equal to 1/2. So A is 1/3. B is 1/2. Now we just have to solve for C. So we can go back to
this original equation right over here. So we have 1/3 plus 1/2
plus C is equal to 1. Actually, let me do that over
here so I have some space. So I have some space, let
me do it right over here. So I have 1/3 plus 1/2
plus C is equal to 1. Now we find ourselves
a common denominator. So let's see. A common multiple
of 3, 2, and-- I guess you could say 1-- this
is 1 over 1-- is going to be 6. So I can rewrite
this as 2/6 plus 3/6 plus C is equal to 6/6. 1 is the same thing as 6/6. So this is 5/6 plus
C is equal to 6/6. Subtract 5/6 from both sides. We get C is equal to 1/6. So C is equal to 1/6. And there we are. We deserve a drum roll now. We've figured out a formula for
the sum of the first n squares. So we can rewrite this. This formula is now
going to be-- A is 1/3. So it's 1/3 n to the third
power plus 1/2 n squared-- let me make sure it doesn't
look like that n is a-- 1/2 n squared plus 1/6 n. So this is a pretty
handy formula. If now you wanted to find
0 squared plus 1 squared plus 2 squared plus 3 squared,
all the way to 100 squared, instead of squaring 100 numbers
and then adding them together, you could figure out 1/3
of 100 to the third power plus 1/2 times 100 squared
plus 1/6 times 100. Or you could do
that for any number. So this right over here is a
pretty neat little formula.