Let $\sum a_n x^n$ be a power serie having a radius of convergence $1$, with $a_n\geq 0$ for all $n\in\mathbb{N}$. Suppose the associated function $f:(-1,1)\to\mathbb{R}$ such that $f(x)=\sum_{n=0}^\infty a_nx^n$ is bounded. Show that $\sum_{n=0}^\infty a_n$ converges.
I'm not too sure about how I could get to prove this. I know that $f$ is continuous on $(-1,1)$ and that the fact that $f$ is bounded is important. For example, consider $\sum x^n$, which has a radius of convergence of $1$ but which is not bounded. Of course, $\sum_{n=0}^\infty a_n$ in this case is just $\sum_{n=0}^\infty 1$, which diverges to infinity. I can see that proving what is asked is equivalent to proving that the interval of convergence is $(-1,1]$ but I am very unsure of where to even begin.
Is supposing $\sum a_n$ diverges and going for a proof by contradiction a good idea? I can see in my head that since $f$ is continuous on $(-1,1)$, $f(x)$ must go to somewhere that is not $+\infty$ as $x$ goes to $1$ because $f$ is bounded, but I'm not sure how to formalize this.
Edit: here's what I ended up doing. Is this valid?
Since $f$ is bounded on its domain, there exists a positive real number $M$ such that $\forall x \in (-1,1)$, $|f(x)|\leq M$. Then, for $N\in\mathbb{N}$ and for $x\in(-1,1)$, we have that \begin{align} \left|\sum_{n=0}^N a_n\right| &= \left|\sum_{n=0}^N a_n - \sum_{n=0}^N a_nx^n + \sum_{n=0}^N a_nx^n\right| = \left|\sum_{n=0}^N a_n(1-x^n) + \sum_{n=0}^N a_nx^n\right|\\ &\leq \left|\sum_{n=0}^N a_n(1-x^n)\right| + \left|\sum_{n=0}^N a_nx^n\right|\\ &\leq \sum_{n=0}^\infty a_n|1-x^n| + |f(x)| \quad\quad\quad\quad\text{(since each $a_n\geq 0$)}\\ &\leq \sum_{n=0}^\infty a_n|1-x^n| + M. \end{align} It is clear that as $x$ goes to one, $\sum_{n=0}^\infty a_n|1-x^n|$ goes to zero and therefore $|\sum_{n=0}^N a_n|\leq M$ in the limit. Since the right hand side of the inequality is independent of $N$, we also have that $|\sum_{n=0}^\infty a_n|\leq M$ and thus the sum $\sum_{n=0}^\infty a_n$ is bounded. A bounded sum that is only comprised of nonnegative terms converges, thus $\sum_{n=0}^\infty a_n$ converges.
QED(?)
Your idea is good. But using that $a_n \ge 0$ could make that easier. Indeed, $$\sum_{n=0}^N a_n = \sum_{n=0}^N a_n(1-x^n) + \sum_{n=0}^N a_n x^n \le |f(x)| + |\sum_{n=0} a_n (1-x^n)| \le \sup |f(x)| + |\sum_{n=0} a_n (1-x^n)|$$. $x\rightarrow 1$
$$\sum_{n=0}^N a_n \le \left\|f\right\|_\infty$$