The objective here is to find the value of $S$, where $S$ is given by, $$S = 1-{1\over2}+{1\over3}-{1\over4}+...$$ I did this using two methods, but both the methods give different answers.
Method 1:
Let $$S' = 1+{1\over2}+{1\over3}+{1\over4}+...$$ Now,
$1+{1\over2}+{1\over3}+{1\over4}+{1\over5}+{1\over6}+...$
$\;\;\;\;-1\;\;\;\;\;\;\;-{1\over2}\;\;\;\;\;\;\;-{1\over3}\;\;\;...$
$\frac{\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;}{}$
$1-{1\over2}+{1\over3}-{1\over4}+{1\over5}-{1\over6}+...$
So, $$S = S'-S' = 0$$
Method 2:
Using the formula for infinite Geometric Progression, we can say $$ 1 + x + x^2 + x^3 + ... = \frac{1}{1-x}$$ Integrating both sides with respect to $x$ from $0$ to $t$ we get, $$[x+{x^2\over2}+{x^3\over3}+{x^4\over4}+...]^t_0 = [-ln(1-x)]^t_0$$ $$t+{t^2\over2}+{t^3\over3}+{t^4\over4}+... = -ln(1-t)$$ Putting $t = -1$, $$-1+{1^2\over2}-{1^3\over3}+{1^4\over4}-... = -ln(2)$$ $$1-{1\over2}+{1\over3}-{1\over4}+... = ln(2)$$ So, $$S=ln(2)$$ After some searching I found that the 2nd method gives the correct answer. But why is the 1st method wrong?
The series you denote by $S'$ is the divergent harmonic series. You're implicitly using the theorem that the limit of the sum (or difference) of two sequences is the sum (or difference) of their limits. Since $S'$ has no limit, this theorem doesn't apply.