There is a statement in my book that states:
Stochastic integration by parts implies that
$$ \int_t^T x(u)du = Tx(T) - tx(t) - \int_t^T u dx(u) = \int_t^T (T-u) dx(u) + (T-t)x(t) $$
Can someone please explain to me how this happens? I'd really appreciate the help.
Recall that the integration by parts formula follows by applying Itô's lemma to the function $g(x,y) = xy$; from that you get: $$d(XY)_t = X_t dY_t + Y_t dX_t + dX_t dY_t$$
If you now set $dY_t = du$, you get the formula you wrote down.