$\sum_{n=1}^\infty a_n \cos nx$ unbounded near $0$ if $\sum a_n$ diverges?

Now I can almost answer the whole question.
The conclusion is as below:

Theorem 1. For monotone decreasing sequence $a_n$ satisfying $a_n\rightarrow 0$ and $\sum a_n$ diverges, the sum $$\sum_{n=1}^\infty a_n\cos nx $$ must be UNBOUNDED in a neighborhood of $0$.

The proof goes like this:

First we have $a_n\ge 0$. By Dirichlet’s method, the series $$S\left(x\right)=\sum_{n=1}^\infty a_n\cos nx $$ converges uniformly on $\left(\delta,\pi\right]$ for any $\delta>0$, therefore is continuous on it.
If $S$ is not integrable on $\left[0,\pi\right]$, it must be unbounded on $\left(0,\delta\right)$ for some $\delta>0$.
If $S$ is integrable on $\left[0,\pi\right]$, then the Fourier series of $S$ is $S\left(x\right)$ itself (See Hardy Fourier Series §3.10 Thm.46).
By the properties of Fejér kernel, we can write the n-th Cesàro partial sum of $S$ at $x=0$ as $$\sigma_n=\frac{1}{\pi}\int_0^\pi S\left(t\right)F_n\left(t\right)dt$$
where $F_n\ge 0$ is the Fejér kernel.
Suppose $\left|S\left(x\right)\right|\le M$, then $$\sigma_n\le \frac{M}{\pi}\int_0^\pi F_n\left(t\right)dt=M$$ As the series $\sum a_n$ is positive and divergent, the n-th Cesàro partial sum $\sigma_n\rightarrow+\infty$ as $n\rightarrow \infty$(by Stolz’s theorem), which leads to contradiction.
In conclusion, $S$ must be unbounded near $0$. $\blacksquare$

But it remains to prove or disprove $S\left(x\right)\rightarrow+\infty$ as $x\rightarrow0$. It still needs tougher work.


There are also two little theorems about divergence to $+\infty$ of $S\left(x\right)$:

Theorem 2. If $a_n$ is a CONVEX sequence(i.e.$a_n+a_{n+2}\ge 2a_{n+1}\,\forall n$) tends to $0$, and $\sum a_n$ diverges, then $S\left(x\right)\rightarrow +\infty$ when $x\rightarrow 0$.

Theorem 3. If $a_n$ is defined as Thm.1, and $S$ is NOT integrable on $\left[0,\pi\right]$, $S$ must have infinitely many zeroes near $0$, hence does not tend to $+\infty$.

Proof(Thm.2):

Using summation by parts twice and we can get $$S\left(x\right)=\sum_{n=1}^\infty \left(a_n+a_{n+2}-2a_{n+1}\right)\frac{1-\cos\left(n+1\right)x}{4\sin^2 \frac{x}{2}}$$ which is a positive-term series.
There exists a constant $C>0$, for $0<x<\frac{1}{n}$, $$\frac{1-\cos nx}{4\sin^2 \frac{x}{2}}\ge Cn^2$$ Therefore $$S\left(x\right)\ge C\sum_{n=1}^{\left[\frac{1}{x}\right]-1} \left(n+1\right)^2 \left(a_n+a_{n+2}-2a_{n+1}\right)$$ Then we need to prove that RHS is divergent.
We need a lemma: If $b_n$ is decreasing and tends to $0$, $\sum n^k b_n$ diverges, then $\sum n^{k+1}\left(b_n-b_{n+1}\right)$ also diverges.
Since $$\Delta n^{k+1}=n^{k+1}-\left(n-1\right)^{k+1}\sim \left(k+1\right) n^k$$ we know that $\sum \Delta n^{k+1}\,b_n$ diverges.
For $M>0$, There exists $N_0$ s.t. $$\sum_{n=1}^{N_0}\Delta n^{k+1}\,b_n>M+1$$ As $b_n\rightarrow 0$, there exists $N_1$, for all $N>N_1$ we have $N_0^{k+1}b_N<1$.
Then for $N>\max\left\{N_0,N_1\right\}$,$$\begin{aligned}\sum_{n=1}^N n^{k+1}\left(b_n-b_{n+1}\right)&=\sum_{n=1}^N \Delta n^{k+1}\left(b_n-b_{N+1}\right)\\&\ge\sum_{n=1}^{N_0}\Delta n^{k+1} \left(b_n-b_{N+1}\right)\\&=\sum_{n=1}^{N_0} \Delta n^{k+1}\,b_n -N_0^{k+1} b_{N+1}\\&>M+1-1=M\end{aligned}$$ Hence by the lemma we can get $$\sum a_n =+\infty \Rightarrow \sum n \left(a_n-a_{n+1}\right) =+\infty \Rightarrow \sum n^2 \left(a_n+a_{n+2}-2a_{n+1}\right)=+\infty$$ which finally proves the theorem. $\blacksquare $

The proof of Thm.3 needs two lemmas as follow.

Lemma 1. If $b_n$ is decreasing and $nb_n\rightarrow 0$, then $\sum_{n=1}^\infty b_n \sin nx $ converges uniformly on $\mathbb{R}$.
Lemma 2. $S$ has an antiderivative $\sum _{n=1}^\infty \frac{a_n}{n}\sin nx$ and $$\lim_{\delta\rightarrow 0^+}\int _\delta ^\pi 2S\left(x\right) \cos mx dx=\pi a_m$$

The proof of Lemma.1 is a little complex but not difficult, and is taken from an exercise book in mathematical analysis. We will just assume it right.

Proof of Lemma.2:

Notice that the series of $S$ converges uniformly in $\left[\delta,\pi\right]$, hence we can integrate by terms $$\begin{aligned}\int_\delta^\pi 2S\left(x\right)\cos mx\,dx&=\sum_{n=1}^\infty \int_\delta^\pi 2a_n \cos nx \cos mx\,dx\\&=\sum_{n=1}^\infty \frac{a_n}{n+m}\sin\left(n+m\right)\delta +\sum_{n\ne m}\frac{a_n}{n-m}\sin \left(n-m\right)\delta +a_m\left(\pi-\delta+\frac{\sin 2m\delta}{2m}\right)\\&\overset{def}{=}\Theta_1\left(\delta\right)+\Theta_2\left(\delta\right)+a_m\left(\pi-\delta+\frac{\sin 2m\delta}{2m}\right)\end{aligned}$$ Clearly by lemma 1, $\Theta_1$ and $\Theta _2$ both converge uniformly on $\mathbb{R}$, hence continuous at 0.
So we have $$\lim_{\delta\rightarrow 0^+}\int_\delta^\pi 2S\left(x\right)\cos mx\,dx=\pi a_m$$
Letting $m=0$ we can get that $$\int_x^\pi S\left(t\right) dt=\sum_{n=1}^\infty \frac{a_n}{n}\sin nx$$ By the continuity of $S$ we finish the proof. $\blacksquare$

Back to the proof of Thm.3

Note that $S$ is not integrable, that means $$\int_0^\pi \left|S\left(t\right)\right| dt= +\infty$$ But the improper integral of $S$ converges to $0$ as discussed above.
That means $S$ must have infinitely many positive parts and negative parts near $0$, by continuity there must be infinitely many zeroes. $\blacksquare$

So if we are going to find $S$ such that $\lim_{x\rightarrow 0}S\left(x\right)\ne +\infty$, we can just find an unintegrable $S$, and the coefficient $a_n$ must not be convex.


Now I came up with a proof that there EXISTS a counterexample when $S\left(x\right)$ is non-integrable on $\left[0,\pi\right]$, although I still couldn’t find the explicit form for the counterexample.

Theorem 4. There exists a decreasing sequence $a_n$, tending to $0$, such that $S\left(x\right)$ is not integrable.

Proof. First, by summation by parts we get
$$\begin{aligned} S\left(x\right)&=a_1+\sum_{n=1}^\infty \left(a_n-a_{n+1}\right)\frac{\sin\left(n+\frac{1}{2}\right)x}{\sin\frac{x}{2}}\\&=a_1+\sum_{n=1}^\infty \left(a_n-a_{n+1}\right)\sin nx\cot\frac{x}{2}+ \sum_{n=1}^\infty \left(a_n-a_{n+1}\right)\cos nx\end{aligned}$$
Note that $a_1+ \sum_{n=1}^\infty \left(a_n-a_{n+1}\right)\cos nx$ is a continuous function on $\left[0,\pi\right]$, we just need to consider the integrability of $\sum_{n=1}^\infty \left(a_n-a_{n+1}\right)\sin nx\cot\frac{x}{2}$, or equivalently, $\sum_{n=1}^\infty \left(a_n-a_{n+1}\right)\frac{\sin nx}{x}$.

We just need to prove there exists a positive sequence $\left\{c_n\right\}$ with $\sum c_n<\infty$, such that $$\int_0^{\pi}\frac{\left|\sum_{n=1}^\infty c_n \sin nx\right|}{x}dx=+\infty$$

Consider the linear space $T$ consisting of all continuous $2\pi$-periodic odd functions on $\mathbb{R}$ such that $\sum_{n=1}^\infty \left|\int_0^\pi f\left(x\right)\sin nx dx\right|<\infty$, one can prove that $T$ is a Banach space under the norm $$\left\|f\right\|\overset{def}{=}\sum_{n=1}^\infty \frac{2}{\pi}\left|\int_0^\pi f\left(x\right)\sin nx dx\right|$$
We can easily get that $\left\|f\right\|_{\infty}\le\left\|f\right\|$.

We define a family of linear functionals on $T$ by $$F_{u,a}f=\int_a^\pi \frac{f\left(x\right)u\left(x\right)}{x}dx$$
where $u\left(x\right)$ is a measurable function with $\left|u\right|=1\quad a.e.$ and $a>0$.
It can be seen that $\left|F_{u,a}f\right|\le \left|\ln a\right| \left\|f\right\|$, therefore each $F_{u,a}$ is bounded.

Letting $u_n=sgn \sin nx$, $a_n=\frac{1}{n}$ and $f_n=\sin nx$ we can see that $\left\|f_n\right\|=1$ and
$$\left\|F_{u_n,a_n}\right\|\ge \int_{\frac{1}{n}}^\pi \frac{\left|\sin nx\right|}{x}dx$$
which is unbounded.

By the Uniform Boundedness Principle, there must exist an $f\in T$ such that the set $\left\{\left|F_{u,a}f\right|\right\}$ is unbounded. However, $\left\{\left|F_{u,a}f\right|\right\}$ is bounded above by $\int_0^\pi \frac{\left|f\left(x\right)\right|}{x}dx$, therefore we have $\int_0^\pi \frac{\left|f\left(x\right)\right|}{x}dx=+\infty$.

But that is not enough. Since the Fourier coefficient of $f$, denoted by $\left\{a_n\right\}$, may have positive and negative terms, we can define $\left\{a_n^+\right\}$ and $\left\{a_n^-\right\}$ be the positive and negative part of $\left\{a_n\right\}$, and $$f^+\left(x\right)=\sum_{n=1}^\infty a_n^+ \sin nx$$ $$f^-\left(x\right)=\sum_{n=1}^\infty a_n^- \sin nx$$
then either $f^+$ or $f^-$ satisfies the condition, thus finishes the proof. $\blacksquare$


All I can think of at this moment is the following very restricted partial result:

Claim. If $(a_n)$ is non-negative, non-increasing and $n a_n \leq C$ for some constant $C > 0$, then

$$ \lim_{x\to 0} \sum_{n=0}^{\infty} a_n \cos(n x) = \sum_{n=0}^{\infty} a_n, $$

regradless of the convergence of $\sum_{n=0}^{\infty} a_n$.

Since the claim is obvious if $\sum_{n=0}^{\infty} a_n < \infty$, we may focus on the case $\sum_{n=0}^{\infty} a_n = \infty$. To this end, define an auxiliary sequence $(b_n)$ by $a_n - a_{n+1} = b_n$. Then

  • $b_n \geq 0$ and $a_m = a_n + \sum_{k=m}^{n-1} b_k$ for $0 \leq m < n$,
  • $a_n = \sum_{k=n}^{\infty} b_k$, and
  • $\sum_{k=0}^{\infty} (k+1)b_k = \sum_{n=0}^{\infty} a_n = \infty$. (This follows from Tonelli's theorem.)

Moreover, we can apply summation by parts

\begin{align*} \sum_{n=0}^{N} a_n \cos(nx) &= a_N \sum_{n=0}^{N} \cos(nx) + \sum_{n=0}^{N-1} \left( \sum_{k=n}^{N-1} b_k \right) \cos(nx) \\ &= a_N D_N(x) + \sum_{k=0}^{N-1} b_k D_k(x), \end{align*}

where $D_k(x) = \sum_{n=0}^{k} \cos(nx)$. Now if $x \in (0, \pi]$, then $D_n(x)$ is bounded in $n$. So, as $N\to\infty$, the above converges to

\begin{align*} \sum_{n=0}^{\infty} a_n \cos(nx) = \sum_{k=0}^{\infty} b_k D_k(x). \end{align*}

Now notice that $D_k(x) = \cos(kx/2)\sin((k+1)x/2)/\sin(x/2)$. So, if $x \in (0, 1)$ and $k \leq 1/x$, then

$$ D_k(x) \geq \frac{\cos(1/2) \cdot \frac{2}{\pi} (k+1)x/2}{x/2} = c(k+1) $$

for $c = \frac{2}{\pi}\cos(1/2) > 0$. So

\begin{align*} \sum_{n=0}^{\infty} a_n \cos(nx) &\geq \sum_{0 \leq k \leq 1/x} b_k D_k(x) - \sum_{k > 1/x} \frac{b_k}{\sin(x/2)} \\ &\geq c \sum_{0 \leq k \leq 1/x} (k+1)b_k - \frac{a_{\lceil 1/x \rceil}}{\sin(x/2)}. \end{align*}

Since $a_{\lceil 1/x \rceil} = \mathcal{O}(x)$ as $x \to 0^+$, we have $\frac{a_{\lceil 1/x \rceil}}{\sin(x/2)} = \mathcal{O}(1)$, and so, letting $x\to 0^+$ proves the desired claim.