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.
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$.