What is the sum of all even numbers from 0 to 2n, for any positive integer n?

Posted on 2011-04-24
Medium Priority
Last Modified: 2012-06-22
The instructor from my online course went over this but unfortunately I couldn't understand his answer due to his think accent.

What is the sum of all even numbers from 0 to 2n, for any positive integer n?
Question by:Eindoofus
LVL 32

Expert Comment

ID: 35456327
sum(k) for k = 1..L =    L (L+1) / 2

But you want

sum (2k) for k = 1..2N
= 2 + 4+ 6 + ... + 2N
= 2( 1 + 2 + 3 + ... + N)

So, the rest should be easy to finish.

Author Comment

ID: 35456346
I believe he said that it was n(n+1) ..Is that correct?
LVL 37

Accepted Solution

TommySzalapski earned 1000 total points
ID: 35456404
Yes. That is correct. Do you know what the sum of 1 + 2 + 3 + 4 + 5 + ... + N is?
Here's how he most likely explained it.

Let's say S = 1+2+3+4+5+...+N
So 2S = 1+2+3+4+5+...+N  +  1+2+3+4+5+...+N
Now flip one of them
So 2S = 1+   2+      3     + 4+5+...+N
          +  N+(N-1)+(N-2).             .. +1
Notice how the first one in each is N and 1, the next two are (N-1) and 2 which add to N+1
If fact, each pair equals N+1 and there are N of them.
So 2S = N(N+1) and S = N(N+1)/2
This is a common result that you will be expected to remember probably.

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This question got me thinking... (http://www.experts-exchange.com/questions/28707487/GLOBALS.html) Why shouldn't we use Globals? This is a simple question without a simple answer.  How do you explain these concepts to a programmer w…
When there is a disconnect between the intentions of their creator and the recipient, when algorithms go awry, they can have disastrous consequences.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses
Course of the Month15 days, 23 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question