Stochastic integration by parts problem I have a question regarding stochastic integration by parts. I am supposed to show that
\begin{align*}
    \int^t_{t-h} \sigma_s^2 \, ds &= \int_{t-h}^t (t-h-s) \, d\sigma^2_s,
\end{align*}
where $\sigma_t^2$ is an Itô process. By using the integration by parts formula I get
\begin{align*}
    \int^t_{t-h} \sigma^2_s \, ds &= t \sigma_t^2 - (t-h)\sigma_{t-h}^2 - \int^t_{t-h} s \, d\sigma^2_s. 
\end{align*}
If
\begin{align*}
    \int_{t-h}^t (t-h) \, d \sigma^2_s = t \sigma^2_t - (t-h)\sigma_{t-h}^2,
\end{align*}
then the desired equality holds, but I do not understand why this equality holds. Does anyone have any input?
 A: When $S_t=S_0+\int_0^ta_s\,ds+\int_0^tb_s\,dW_s$ is an Ito process, then it follows from Ito's formula applied to $f(t,x)=tx$ that
$$\tag{1}
d(tS_t)=t\,dS_t+S_t\,dt.
$$
This special case is also known as integration-by-parts. In integral form this is
$$\tag{2}
tS_t=\int_0^ts\,dS_s+\int_0^tS_s\,ds.
$$
Therefore,
$$\tag{3}
tS_t-(t-h)S_{t-h}=\int_{t-h}^ts\,dS_s+\int_{t-h}^tS_s\,ds\,.
$$
We can write the left hand side in a form that is more complicated:
$$\tag{4}
\int_{t-h}^tt\,dS_s+\int_0^{t-h}h\,dS_s+hS_0
$$
so that (3) becomes equivalent to
$$\tag{5}
\int_{t-h}^tS_s\,ds=\int_{t-h}^t(t-s)\,dS_s+\int_\color{red}{0}^\color{red}{t-h}h\,dS_s+hS_0\,.
$$

*

*The formula you are supposed to show looks wrong indeed because the integral with integrand $h$ has the wrong sign and the wrong integration limits.

The simplest version of this equation is in my opinion
$$\tag{6}
\int_{t-h}^tS_s\,ds=\int_{t-h}^t(t-s)\,dS_s+hS_{t-h}\,.
$$
A: Let me abbreviate $\sigma^2_s$ to $X_s$. Then (assuming $h>0$)
$$
\eqalign{
\int_{t-h}^t(t-h-s)dX_s 
&= (t-h)(X_t-X_{t-h}) -\int_{t-h}^t s\,dX_s\cr
&= (t-h)(X_t-X_{t-h}) +\int_{t-h}^t X_s\,ds-sX_s\Big|_{t-h}^t.\cr
&= (t-h)(X_t-X_{t-h}) +\int_{t-h}^t X_s\,ds-tX_t+(t-h)X_{t-h}.\cr
&= -hX_t +\int_{t-h}^t X_s\,ds.\cr
}
$$
Your formula is not quite right, in general.
