It is given that $$ f(x) = \sum_{n=1}^\infty \frac{\sin(nx)}{4^n} $$
How would one go about calculating $$ \int_0^\pi f(x)\ dx $$
EDIT:
I was able to calculate the integral of the $ \sin(nx) $ part using $u$ substitution. However, I lack the required knowledge to combine an integral and an infinite sum as this is the first time I am doing this kind of a question.
I am currently studying in 11th in India under the CBSE curriculum. This question appeared in one of my internal tests and I am trying to get an explanation for it.
I'd like to mention that I only posess basic knowledge of integration and differentiation as taught in my coaching center and knowledge of 11th grade NCERT math.
Since the series converges uniformly, we can integrate term-wise. The result is
\begin{align*} \int_{0}^{\pi} f(x) \, dx &= \sum_{n=1}^{\infty} \frac{1}{4^n} \int_{0}^{\pi} \sin(nx) \, dx \\ &= \sum_{n=1}^{\infty} \frac{1}{4^n} \left[ -\frac{\cos (nx)}{n} \right]_{0}^{\pi} \\ &= \sum_{n=1}^{\infty} \frac{1 - (-1)^n}{n \cdot4^n}. \end{align*}
Now using the Taylor expansion $\log(1+x) = \sum_{n=1}^{\infty} \frac{(-1)^{n-1}}{n} x^n$, we can simplify the above series as
$$ = - \log\left(1 - \tfrac{1}{4}\right) + \log\left(1 + \tfrac{1}{4}\right) = \log \left( \tfrac{5}{3} \right). $$
Alternatively, assuming basic knowledge on complex analysis,
\begin{align*} \int_{0}^{\pi} f(x) \, dx &= \operatorname{Im} \left( \int_{0}^{\pi} \sum_{n=1}^{\infty} \left( \frac{e^{ix}}{4} \right)^n \, dx \right) = \operatorname{Im} \left( \int_{0}^{\pi} \frac{e^{ix}}{4 - e^{ix}} \, dx \right) \\ (z=e^{ix}) \quad &= \operatorname{Im} \left( \int_{1}^{-1} \frac{1}{i(4-z)} \, dz \right) = \operatorname{Im} \left[ i \log(4-z) \right]_{1}^{-1} \\ &= \log 5 - \log 3 = \log (5/3). \end{align*}
This provides a natural explanation as to why logarithm appears in the final answer.