trying to solve the nested sum $\sum_{n=1}^{\infty} \frac{1}{1^2+2^2+\dots+n^2} $ This sum grabbed my curiousity
$$
\sum_{n=1}^{\infty}  \frac{1}{1^2+2^2+\dots+n^2}
$$
I want to solve it with Calc II methods (that's the math I have).
By getting a closed form for the expression in the denominator, it becomes this:
$$
6 \sum_{n=1}^{\infty}  \frac{1}{n(n+1)(2n+1)} 
$$
First thing I did was partial fractions
$$
6 \sum_{n=1}^{\infty} \left( \frac{1}{n}  + \frac{1}{n+1}-  \frac{4}{2n+1} \right)
$$
You can reindex the first two terms, but I couldn't reindex the $2n+1$ term to telescope with that combined term, my thought is it's not possible because it isn't in the form (n+integer).
So I tried expressing it as an integral, viewing each term as multiplied by an $x$ evaluated between 0 and 1. Then deriving with respect to $x$ to produce an integral.
$$
6 \sum_{n=1}^{\infty}   \int_0^1  (x^{n-1} +x^n  - 4x^{2n}) dx
$$
Switching the order of integration and summation, and doing some reindexing:
$$
6 \int_0^1  \left(3+ 2\sum_{n=0}^\infty x^n - 4 \sum_{n=0}^\infty (x^2)^n\right)dx
$$
I've been doing decimal approximations the whole time, checking that my steps work. They do up to and including that point, the answer is about $1.3$
Next I used the geometric series expansion, and this is where the approximation goes wrong, so I believe this is a problematic step:
$$
6 \int_0^1  \left(3+  \frac{2}{1-x} - \frac{4}{1-x^2} \right)dx
$$
This integral is easy to solve using partial fractions on the $x^2$ term. You get an answer of $6(3-2\ln2)$, which is about $9.6$
The correct answer, based on some website that doesn't show steps, is $6(3-4\ln2)$, which matches my approximation.
I'm really stumped on what I'm doing wrong and how to get that correct answer. I've checked my algebra over and over and learned some latex to write this post. Any help is appreciated!
 A: There are already two excellent answers showing how to evaluate the series correctly.  I want to focus on how your attempt is incorrect.  We'll also see another way to evaluate the series as a result, but this will mostly be a side-effect rather than the actual intent.  As a result, while it can be made formal, the final resolution is a little more hand-wavey than the solutions of jjagmath and Svyatoslav
We can follow a similar process to your method but with partial sums to see where your method is insufficient:
$$\begin{align*}
S_N &:= \sum_{n=1}^{N-1} \left(\frac{1}{n} + \frac{1}{n+1} - \frac{4}{2n+1}\right) \\
&= \sum_{n=1}^{N-1}\int_0^1 \left(x^{n-1}+x^n-4x^{2n}\right)\,dx \\ 
&= \int_0^1\left(3-x^{N-1} + 2\sum_{n=0}^{N-1}x^n - 4\sum_{n=0}^{N-1}x^{2n}\right)\,dx \\
&= \int_0^1 \left(3 - x^{N-1}+2\frac{1-x^N}{1-x}-4\frac{1-x^{2N}}{1-x^2}\right)\,dx \\ 
&= \int_0^1\left(3+\frac{2}{1-x}-\frac{4}{1-x^2}\right)\,dx + \int_0^1\left(-x^{N-1}+\frac{4x^{2N}}{1-x^2}-\frac{2x^N}{1-x}\right)\,dx
\end{align*}$$
The first integral is just what you had proposed as the value for the limit $\displaystyle\lim_{N\to\infty}S_N$, so the question is whether the second integral tends to $0$ as $N \to \infty$.  As we've seen, the answer to this is no, and the reason is the factor of $1-x$ in the denominators.  Unlike the integral you ended up with, we cannot use partial fractions to precisely cancel this singularity because the factors $x^{2N}$ and $x^N$ in the numerators don't have the same growth rates.
Turning our attention to the second integral, we first note that the first term in the integrand, $x^{N-1}$ integrates to $\frac{1}{N}$ which does go to zero as $N \to \infty$ so we can safely ignore it.  Away from $x\approx1$, the remaining integrand also goes to $0$ uniformly, so we can also ignore everywhere except $x \approx 1$, where $1-x^2 = (1+x)(1-x) \approx 2(1-x)$, which gives
$$\begin{align*}
\lim_{N\to \infty} \int_0^1\left(-x^{N-1} +\frac{4x^{2N}}{1-x^2}-\frac{2x^N}{1-x}\right)\,dx &= \lim_{N\to\infty}\int_0^1 \left(\frac{4x^{2N}}{2(1-x)}-\frac{2x^{N}}{1-x}\right)\,dx \\ &= -2\lim_{N\to\infty} \int_0^1 \frac{x^N - x^{2N}}{1-x}\,dx \\ &= -2\lim_{N\to\infty} \int_0^1 \sum_{n=N+1}^{2N} x^{n-1} \\ &= -2\lim_{N\to\infty} \sum_{n=N+1}^{2N} \frac{1}{n} \\ &= -2\lim_{N\to\infty} \int_N^{2N} \frac{1}{x}\,dx \\ &= -2\ln(2)\end{align*}$$
A: Actually you do not need integrals.
$$ \sum_{k=1}^{2N+1}\frac{(-1)^{k+1}}{k}=\sum_{n=0}^{N}\frac{1}{2n+1}-\sum_{n=1}^{N}\frac{1}{2n} $$
converges to $\log(2)$ by the Maclaurin series of $\log(1+x)$ and Abel's lemma, so
$$ \sum_{n=1}^{N}\left(\frac{1}{n}+\frac{1}{n+1}-\frac{4}{2n+1}\right)=H_N+(H_{N+1}-1)-4\sum_{n=0}^{N}\frac{1}{2n+1}+4 $$
converges to $3-4\log(2)$.
A: Sorry, too long for a comment
We can use integration, but we have to be careful while changing the order of operations. Dealing with diverging terms, we can easily get an additional finite contribution to the sum. Heuristically, we have to keep the asymptotic behavior of every term in order to avoid such pitfall. In your case this is
$$S=\sum_{n=1}^{\infty}\Big( \frac{1}{n}  + \frac{1}{n+1}-  \frac{4}{2n+1}\Big)=\sum_{n=1}^{\infty}\Big( \frac{1}{n}  + \frac{1}{n+1}-  \frac{2}{n+1/2}\Big)$$
Now we can switch to integrals and change the order of summation and integration
$$S=\sum_{n=1}^{\infty}\int_0^1( x^{n-1}  + x^n-2x^{n-1/2})dx=\int_0^1dx(1+x-2\sqrt x)\sum_{n=1}^{\infty}x^{n-1}$$
$$=\int_0^1dx(1-\sqrt x)^2\frac{1}{1-x}=\int_0^1dx\frac{1-\sqrt x}{1+\sqrt x}=-\int_0^1dx+2\int_0^1\frac{dx}{1+\sqrt x}$$
$$=-1+4\int_0^1\frac{tdt}{1+t}=-1+4-4\int_0^1\frac{dt}{1+t}=3-4\ln 2$$
A: We have
\begin{align}
\sum_{n=1}^\infty\left(\frac{1}{n}+\frac{1}{n+1}-\frac{4}{2n+1}\right) & =
\sum_{n=1}^\infty\left(\frac{1}{n}-\frac{2}{2n+1}+\frac{1}{n+1}-\frac{2}{2n+1}\right)\\
&= \sum_{n=1}^\infty\left(\frac{1}{n}-\frac{2}{2n+1}\right)+\sum_{n=1}^\infty\left(\frac{1}{n+1}-\frac{2}{2n+1}\right)\\
&= 2\sum_{n=1}^\infty\left(\frac{1}{2n}-\frac{1}{2n+1}\right)+2\sum_{n=1}^\infty\left(\frac{1}{2n+2}-\frac{1}{2n+1}\right)\\
&= 2\;(1-\log 2)+2\;(\tfrac{1}{2}-\log 2)\\
&=3-4\log 2
\end{align}
where we used $\displaystyle\log 2 = \sum_{n=1}^\infty\frac{(-1)^{n+1}}{n} = \sum_{n=1}^\infty\left(\frac{1}{2n-1}-\frac{1}{2n}\right)$.
