# Proving an integral relationship

$\int_0^n s (\int_0^s f(t) \, dt) \, ds = \int_0^n f(s) (\int_s^n t \, dt) \, ds$

The $s$ and $t$ in $f$ are just dummy variables of the same function.

Is there a way to start from the left hand side of this equation and show it is equal to the right hand side or vice-versa? The author of the paper that uses this relation only mentions the use of Fubini's Theorem to show it.

There is a geometric interpretation of this problem here with $f = 1$: Rearranging double integral and bounds

Edit: I see the process of it shown here without $s$ in the outer integral: Double integral and variable change problem

For convenience write $g(s,t):=s f(t)$. We are integrating $g(s,t)$ over the triangular region in $(s,t)$ space with vertices at $(0,0)$, $(n,0)$ and $(n,n)$. This is done by iterating the integrals: As $s$ is held fixed, you integrate $g(s,t)$ over $t$ from $t=0$ to $t=s$; then integrate the result over $s$ from $s=0$ to $s=n$. So to flip the order of integration you would hold $t$ fixed and integrate $g(s,t)$ over $s$ from $s=t$ to $s=n$; then integrate the result over $t$ from $t=0$ to $t=n$. In symbols: $$\int_{s=0}^n\int_{t=0}^s g(s,t)\,dt\,ds=\int_{t=0}^n\int_{s=t}^n g(s,t)\,ds\,dt\tag{*}$$ Now you can argue step by step: \begin{align} \int_{s=0}^n \left(s \int_{t=0}^s f(t)\,dt\right)ds &=\int_{s=0}^n\int_{t=0}^s sf(t)\,dt\,ds\\ &=\int_{s=0}^n\int_{t=0}^s g(s,t)\,dt\,ds\\ &\stackrel{(*)}=\int_{t=0}^n\int_{s=t}^n g(s,t)\,ds\,dt\\ &=\int_{t=0}^n\int_{s=t}^n sf(t)\,ds\,dt\\ &=\int_{t=0}^nf(t)\left(\int_{s=t}^n s\,ds\right)dt\\ &=\int_{s=0}^nf(s)\left(\int_{t=s}^n t\,dt\right)ds \end{align} In the final step we swap dummy variables $s$ and $t$.