Cosine series with non-negative coefficients, that is continuous at $0$ but not everywhere Is there an cosine series with non-negative terms, that is continuous at $x=0$, but not continuous everywhere?
More specifically, do there exist $a_n\geq0$ such that 
$$f(x) = \sum_{n=1}^\infty a_n \cos(nx) $$ 


*

*converges for $x=0$

*converges almost everywhere

*is continuous at $x=0$

*is not a continuous function?


For motiviation, see this related question.
 A: If the series converges at $x=0$, then $\sum_na_n$ converges. And since $a_n\ge 0$, it follows that $(a_n)\in\ell^1$. But then the series converges at every $x$ and defines a continuous function $f$. To see the latter, let $(x_k)$ be a sequence in $\Bbb R$ that converges to $x\in\Bbb R$. Then
$$
f(x_k)-f(x) = \sum_na_n(\cos(nx_k)-\cos(nx)).
$$
Now, the $n$-th summand converges to zero as $k\to\infty$ is bounded by $2|a_n|$. Hence, by Lebesgue's majorized convergence theorem, it follows that $f(x_k)\to f(x)$ as $k\to\infty$.
A: For each $n,$ $|a_n\cos (nx)|\le a_n,$ and we're given $\sum a_n <\infty.$ By the Weierstrass M test, $\sum a_n\cos (nx)$ converges uniformly on $\mathbb R.$ Since each summand is continuous on $\mathbb R,$ so is $f(x).$ Thus the answer to your question is no.
A: If $f(x)$ is continous at $x=0$ then we know
$$ \exists L \land  \forall \epsilon \exists \delta \gt 0 \  \land   \ if \ |x| \lt \delta \ then \ |f(x)-L| \lt \epsilon$$
This immediately implies that there exists infinitly many  $x \neq 0$ such that $ |\sum_{n=0}^{\infty} a_n cos(nx) - L| \lt \epsilon $.
