# Integrated Brownian motion

I occasionally see a post here: Integral of brownian motion wrt. time over [t;T].

This post has the conclusion that $$\int_t^T W_s ds = \int_t^T (T-s)dB_s$$.

However, here is my derivation which is different from him and I don't know where I am wrong.

First, we have:

$$\mathrm{d}(uB_u) = u \mathrm{d} B_u + B_u \mathrm{d} u.$$

Then, integral from $$s$$ to $$t$$, we have:

$$tB_t - sB_s = \int_{s}^{t} u \mathrm{~d}B_u + \int_{s}^{t} B_u \mathrm{~d} u$$

\begin{equation} \begin{aligned} \int_{s}^{t} B_u \mathrm{~d}u &= tB_t - sB_s - \int_{s}^{t} u \mathrm{~d}B_u\\ &= \int_{0}^{t} t \mathrm{~d}B_u - \int_{0}^{s} s \mathrm{~d} B_u - \int_{s}^{t} u \mathrm{~d} B_u\\ &= \int_{0}^{s} t \mathrm{~d} B_u + \int_{s}^{t} t \mathrm{~d}B_u - \int_{0}^{s} s \mathrm{~d}B_u - \int_{s}^{t} u \mathrm{~d}B_u\\ &= \int_{0}^{s}(t - s)\mathrm{~d}B_u + \int_{s}^{t} (t - u) \mathrm{~d} B_u\\ &= (t - s)B_s + \int_{s}^{t} (t - u) \mathrm{~d}B_u. \end{aligned} \end{equation}

Your derivation is correct. Even if we fix your obvious typo the formula $$\textstyle\int_t^TW_s\,ds=\int_t^T(T-s)\,dW_s$$ is wrong.
There is no doubt that \begin{align} TW_T&=\textstyle\int_0^Ts\,dW_s+\int_0^TW_s\,ds\,,\\[2mm] TW_T&=\textstyle\int_0^TT\,dW_s\, \end{align} hold. Therefore, $$\boxed{\phantom{\Bigg|}\quad \textstyle\int_0^TW_s\,ds=\int_0^T(T-s)\,dW_s\,.\quad}\tag{1}$$ Subtracting two such expressions yields \begin{align} \textstyle\int_t^TW_s\,ds&=\textstyle\int_0^T(T-s)\,dW_s-\int_0^t(\color{red}{t}-s)\,dW_s\\[2mm] &=\textstyle\int_t^T(T-s)\,dW_s+\int_0^t(\color{red}{T}-s)\,dW_s-\int_0^t(\color{red}{t}-s)\,dW_s\tag{2}\\[2mm] &=\textstyle\int_t^T(T-s)\,dW_s+\int_0^t(\color{red}{T}-\color{red}t)\,dW_s\\ &=\textstyle\int_t^T(T-s)\,dW_s+(\color{red}{T}-\color{red}t)\,W_t\,.\tag{3} \end{align} Which is what you have shown.
The two terms in (3) are independent due to the independence of the increments of BM. Therefore, the variance of $$\int_t^TW_s\,ds$$ should be $$\frac{(T-t)^3}{3}+(T-t)^2t=(T-t)^2\frac{T+2t}{3}\,.$$