Skip to content
Related Articles
Get the best out of our app
GFG App
Open App
geeksforgeeks
Browser
Continue

Related Articles

Mathematics | Sum of squares of even and odd natural numbers

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

We know sum squares of first n natural numbers is \frac{n(n+1)(2n+1)}{6}.

How to compute sum of squares of first n even natural numbers?
We need to compute 22 + 42 + 62 + …. + (2n)2

EvenSum = 22 + 42 + 62 + .... + (2n)2 
        = 4 x (12 + 22 + 32 + .... + (n)2)
        = 4n(n+1)(2n+1)/6
        = 2n(n+1)(2n+1)/3

Example:

Sum of squares of first 3 even numbers =
                 2n(n+1)(2n+1)/3
               = 2*3(3+1)(2*3+1)/3
               = 56
22 + 42 + 62 = 4 + 16 + 36 = 56



How to compute sum of squares of first n odd natural numbers?
We need to compute 12 + 32 + 52 + …. + (2n-1)2

OddSum  = (Sum of Squares of all 2n numbers) - 
          (Sum of squares of first n even numbers)
        = 2n*(2n+1)*(2*2n + 1)/6 - 2n(n+1)(2n+1)/3
        = 2n(2n+1)/6 [4n+1 - 2(n+1)] 
        = n(2n+1)/3 * (2n-1)
        = n(2n+1)(2n-1)/3

Example:

Sum of squares of first 3 odd numbers = n(2n+1)(2n-1)/3
                                      = 3(2*3+1)(2*3-1)/3
                                      = 35
12 + 32 + 52 = 1 + 9 + 25 = 35

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above

My Personal Notes arrow_drop_up
Last Updated : 04 Apr, 2019
Like Article
Save Article
Similar Reads