Suppose that $f$ is integrable, has period $ T $, and Fourier series$$f(t) \sim \sum_{n=-\infty}^{\infty} c_n e^{\frac{2\pi int}{T}}.$$Determine the Fourier series of the so-called $\textit{autocorrelation function}$$ r $ of $ f $, which is defined by$$r(t) = \frac{1}{T} \int_0^T f(t + u) \overline{f(u)} \, du.$$
My approach:I use the Fourier Series expression to obtain
$$r(t) \sim \frac{1}{T} \int_0^T \sum_{n=-\infty}^{\infty} c_ne^{\frac{2\pi in(t+u)}{T}} \sum_{m=-\infty}^{\infty}\overline{c_m}e^{\frac{-2\pi imu}{T}} \, du$$
$$\frac{1}{T} \int_0^T \sum_{n=-\infty}^{\infty} \sum_{m=-\infty}^{\infty}c_n\overline{c_m}e^{\frac{2\pi i (n-m)u}T}e^{\frac{2\pi int}{T}}$$
Then I can integrate termwise we see that $n=m$ because otherwise integral will be zero. Thus I can have one sum instead of two which is dependent on variable $n$.
$$r(t) \sim \frac{1}{T} \int_0^T \sum_{n=-\infty}^{\infty} \lvert c_n \rvert^2 e^{\frac{2\pi int}{T}}\ du= \sum_{n=-\infty}^{\infty} \lvert c_n \rvert^2 e^{\frac{2\pi int}{T}}$$And this concludes the Fourier series for $r(t)$. I am not sure if my integration termwise is justified, I know that we can differentiate termwise regardless if the series actually converges provided it is smooth, so it should also be integrable provided it is smooth as the questions states and hence I can just multiply the series and have one sum. Is this correct? hints tips, thank you!