Math question (series sum)

Slapshot136

Divide et impera
Reaction score
471
so I have a series that looks like this:

r^0 + r^2 + r^4 + r^6 + ... r^2n = ?

how can I derive a formula for what the sum is equal to?

similar example:

r^0 + r^1 + r^2 + r^3 + ... r^n = (r^(n+1)-1) / (r-1)

P.S. - here is a working c++ example

Code:
int calculate(int n, int r)
{
 
    int sum = 1;
    int r2 = r*r;
    int temp = 1;
    for (int i = 1; i <= n; i++)
    {
        temp = temp * r2;
        sum += temp;
    }
    return sum;
 
}
 

Sevion

The DIY Ninja
Reaction score
413
Problem: r^0+r^2+r^4+r^6+...+r^(2n) = ?

Let r = 3
For n = 5: Sum = 66430
For n = 4: Sum= 7381
For n = 3: Sum = 820
For n = 2: Sum = 91
For n = 1: Sum = 10

E(r^i, i=0, n) = (r^(n+1) - 1) / (r-1)
  • Substitute r^2 for r -> (r^(2*(n+1)) - 1) / (r-1) -> r^2^(n+1) = r^(2*(n+1)) through multiplication of exponents
  • The ratio is wrong (answers are off) -> r-1 is not right
  • Through observing formula behavior, it is determined the ratio is (r-1)(r+1) -> not gonna explain this, as I did it intuitively, but you can figure it out by making a table or graph and finding the ratio and finding E(r^(3i), i=0, n) would show a clearer relationship
Result:
E(r^(2i), i=0, n) = r^(2*(n+1)) - 1) / ((r-1)(r+1))

Theorem: For any real number r except 1 and any integer n >= 0, E(r^(2i), i=0, n) = r^(2*(n+1)) - 1) / ((r-1)(r+1))

Proof(by mathematical induction):
Suppose r is a particular but arbitrarily chosen real number that is not equal to 1 and let the property P(n) be the equation​
r^(2*(n+1)) - 1) / ((r-1)(r+1)) <-- P(n)​
We must show that P(n) is true for all n >= 0​
We do this by mathematical induction to n​
ChtH8r0.gif
Show that P(0) is true:​
To establish P(0), we must show that​
E(r^(2i), i=0, 0) = r^(2*(0+1)) - 1) / ((r-1)(r+1))​
The left-hand side of the equation is r^(2*(0)) = 1 and the right-hand side is​
r^(2*(0+1)) - 1) / ((r-1)(r+1)) = r^2-1 / ((r-1)(r+1)) = ((r+1)(r-1))/((r+1)(r-1)) = 1​
also because r^2-1 = (r+1)(r-1) and r != 1, P(0) is true.​
ChtH8r0.gif
Show that for all integers k >= 0, if P(k) is true, then P(k+1) is also true:​
Let k be an integer with k >= 0 and suppose that:​
E(r^(2i), i=0, k) = r^(2*(k+1)) - 1) / ((r-1)(r+1)) <-- P(k) inductive hypothesis​
We must show (P(k+1) is true.​
E(r^(2i), i=0, k+1) = r^(2*(k+1+1)) - 1) / ((r-1)(r+1))​
or equivalently that​
E(r^(2i), i=0, k+1) = r^(2*(k+2)) - 1) / ((r-1)(r+1))​
The left-hand side of P(k+1) is​
E(r^(2i), i=0, k+1)​
= E(r^(2i), i=0, k) + r^(2*(k+1))​
= r^(2*(n+1)) - 1) / ((r-1)(r+1)) + r^(2*(k+1))​
= r^(2*(n+1)) - 1) / ((r-1)(r+1)) + (r^(2*(k+1))(r-1)(r+1))/((r-1)(r+1))​
= (r^(2*(n+1)) - 1 + r^(2*(k+1))(r-1)(r+1))/((r-1)(r+1))​
= (r^(2*(n+1)) - 1 + r^(2*(k+1))(r^2-1))/((r-1)(r+1))​
= (r^(2*(n+1)) - 1 + r^2*r^(2*(k+1)) - r^(2*(k+1)))/((r-1)(r+1))​
= (r^2*r^(2*(k+1)) - 1)/((r-1)(r+1))​
= (r^(2*(k+1) + 2) - 1)/((r-1)(r+1))​
= (r^(2*((k+1) + 1)) - 1)/((r-1)(r+1))​
= (r^(2*(k+2)) - 1)/((r-1)(r+1))​
Which is the right-hand side of P(k+1) [as was to be shown]​
Since we have proved the basis step and the inductive step, we can conclude that the theorem is true.​
 

Slapshot136

Divide et impera
Reaction score
471
I feel somewhat stupid, as the answer was obvious:

let r1 = r^2, and then use the sample equation...
 

Sevion

The DIY Ninja
Reaction score
413
Don't worry. I'm just baller.

Also, a little retarded because I didn't realize I never substituted the r in the denominator with r^2, so my intuition ended up guessing at something which ended up being correct.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top