MATLAB Answers

Proof that sum of all positive integers is -1/12

5 views (last 30 days)
Hi there,
I'm trying to use MATLAB to prove that the sum of all positive integers to infinity is -1/12 (sry but I don't know how to write in LaTeX). I've tried using a for loop as well as integrating, but the values I've attained from those methods just get larger and larger. I tried using Inf in my for loop but that led to the for loop iterating forever.
Here's what I have so far:
a = [];
for i = 1:10000
if i ~= 10000
a = [a, (i*(i+1))/2];
else
a = [a, (i*10000 + 1)/2];
end
end
%disp(a)
plot(1:10000, a);
syms x
X = sum(a)
Y = -1*4*(10^-26)*x^5 - 1.6*(10^-22)*x^4 + 5*(10^-19)*x^3 + 0.5*x^2 + 0.5*x - 3*10^-11; %This I got from using Basic Fitting tool on MATLAB
Z = int(Y,1,1000) %Integration
How can I prove the proof using simple methods?
Thanks

  3 Comments

David Hill
David Hill on 25 Mar 2020
What, the sum of all positive integers to infinity? Is that not infinity?
Jayesh Kamboj
Jayesh Kamboj on 25 Mar 2020
Intuition tells us that it should be infinity, but if you look at Ramanujan Sum (https://en.wikipedia.org/wiki/1_%2B_2_%2B_3_%2B_4_%2B_%E2%8B%AF) then it says that the sum should be equal to -1/12.

Sign in to comment.

Accepted Answer

James Tursa
James Tursa on 25 Mar 2020
Edited: James Tursa on 27 Mar 2020
This has nothing to do with MATLAB and numerical sums. You can pretty much get any answer you want by manipulating divergent series on paper, and manipulating divergent series doesn't prove anything ... and certainly is not going to match any numerical summing method you might do with MATLAB.
From the website:
c = 1 + 2 + 3 + 4 + 5 + 6 + ... is a divergent series (inf)
4c = 4 + 8 + 12 + ... is another divergent series (inf)
(c-4c) = 1 - 2 + 3 - 4 + 5 - 6 + ... is yet another divergent series (inf-inf on lhs)
The very first step is actually a violation of mathematical equality ... stating that the sum of a divergent series is equal to something. However, we can play the game for the first two steps. But for that last series, stating it is equal to c-4c is complete BS from a mathematical standpoint. You cannot manipulate divergent series this way and maintain equality in a mathematical sense. Similar manipulation can be done to get completely different results. And then "assigning" it a value of 1/(1+1)^2 by plugging in a value outside the domain of a convergent series for 1/(1+x)^2 because it looks similar is another bogus mathematical step.
This whole exercise is fun to play with, but does not have anything to do with mathematical equality.
EDIT
Here is my solution for that series sum.
Start with c and 2c and subtract them:
c = 1 + 2 + 3 + 4 + 5 + 6 + 7 + ...
-( 2c = 2 + 4 + 6 + ...)
c-2c = 1 + 3 + 5 + 7 + ...
So we get the result:
-c = 1 + 3 + 5 + 7 + ...
Multiply -c by 4 and rewrite it to get:
-4c = 4 + 12 + 20 + 28 + ...
-4c = 2 + 2 + 6 + 6 + 10 + 10 + 14 + 14 + ...
Now take that result and subtract our –c result:
-4c = 2 + 2 + 6 + 6 + 10 + 10 + 14 + 14 + ...
-( -c = 1 + 3 + 5 + 7 + 9 + 11 + 13 + 15 + ...)
-4c+c = 1 – 1 + 1 – 1 + 1 - 1 + 1 - 1 + ...
So clearly
-3c = 1 – 1 + 1 – 1 + 1 - 1 + 1 - 1 + ...
But we also have this series expansion
1/(1-x) = 1 + x + x^2 + x^3 + x^4 + ...
Plugging in x = -1 we get:
1/(1-(-1)) = 1 – 1 + 1 – 1 + 1 – 1 + ...
Combining the two results gives us the obvious answer:
-3c = 1/(1 – (-1))
-3c = 1/2
c = -1/6
So, I have proven that the -1/12 answer is clearly off by a factor of 1/2, right?
No, not really. Again, this is a fun exercise in manipulating divergent series, but I haven't followed the strict rules of mathematical equality.

  3 Comments

John D'Errico
John D'Errico on 27 Mar 2020
+1, even though this question is unresolvable using MATLAB, as James has recognized. Anyway, we know the answer to all questions must be 42, so he has clearly made a mistake.
David Goodmanson
David Goodmanson on 28 Mar 2020
Here's a different take on the problem that results in -1/12, using a process just as unjustifiable as James's. As he mentioned, divergent series have issues. You can get pretty much anything you want by adding and subtracting divergent series.
Consider the sum
1 + x + x^2 + x^3 + ... = 1/(1-x)
and its derivative
1 + 2x + 3x^2 + 4x^3 + ... 1/(1-x)^2
Both of these series are convergent for |x| <1. For the first illegal step, plug in x = -1 and get
1 - 2 + 3 - 4 + 5 - 6 + ... 1/4
Now consider
{A} = the set of all positive integers
{E} = the set of all even positive intergers
{O} = the set of all odd positive intergers
So the union of {E} and {O} is {A}, which is a true statement. Now denoting sum of elements of {A} = sA etc, we have
sA = sO + sE
sE = 2*sA
sO - sE = 1/4 as above
Solving these gives
sA = -1/12 the requred result
sE = -1/6
SO = 1/12
and as an added bonus we find that the sum of the odd positive integers = 1/12. Of course all three of the sum equations are bogus, but why not!
** here is a more serious comment:
The Riemann zeta function for a complex number s is defined as
zeta(s) = 1/1^s +1/2^s +1/3^s +1/4^s + ... Re(s) > 1
but the series is only convergent and meaningful for real(s) > 1. If you could plug in s = -1 you would have
zeta(-1) = 1 + 2 + 3 + 4 + ...
which is illegal because the series solution does not apply. The resulting series is divergent, besides which adding up a bunch of positive integers is not ever going to result in -1/12. But the Riemann zeta function can be analytically continued over to s = -1 in the complex plane, where entirely different methods show that zeta(-1) = -1/12.
Image Analyst
Image Analyst on 29 Mar 2020
There are tons of these kind of 1=0 (or whatever) "Proofs" on the internet: Click here
For example
1 + 1 = 1 + sqrt(1)
= 1 + sqrt(-1 * -1)
= 1 + sqrt(-1) * sqrt(-1)
= 1 + i * i
= 1 + -1
2 = 0

Sign in to comment.

More Answers (0)