I have a function $s = 1/T \int_0^T r(x) dx$ for the time average of a periodic function. (So r is a periodic function). Now I have a formula $p(t) = \int_0^t r(x)dx - st$. I have to show that $p(t)$ is a periodic function.
When I try out $r(x)=1 + cos(x)$ (which is periodic), (with antiderivative $x + sin(x)$) that the constant $x$ will vanish when I fill it in the formula $p(t)$. I also see when $r(x)$ is periodic around $x=0$ that $s = 0$. But how can I go further? Does somebody have a hint to show that the function $p(t)$ is periodic?
We have $$ \begin{align} p(t+T)-p(t) &= \int_0^{t+T} r(x) \, dx - s(t+T) - \int_0^t r(x) \, dx -st \\ &= \int_t^{t+T} r(x) \, dx - sT \\ &= \int_t^{(n+1)T} r(x) \, dx - \int_{(n+1)T}^{t+T} r(x) \, dx - sT \\ &= \int_{t-nT}^T r(x-nT) \, dx - \int_{0}^{t-nT} r(x-(n+1)T) \, dx -sT \\ &= \int_{t-nT}^T r(x) \, dx - \int_{0}^{t-nT} r(x) \, dx -sT \\ &= \int_0^T r(x) \, dx -sT = 0, \end{align}$$ where $nT \leq t< (n+1)T$, and using the periodicity of $r$ in the penultimate line and the definition of $s$ at the end.