# Integration by parts - Brownian motion and non-random function

Let $B$ be a standard one-dimensional Brownian motion. I want to show for a continuously differentiable non-random function $\phi$ that, \begin{align} \int_0^t \phi(s) dB_s = \phi(t) B_t - \int_0^t B_s \phi'(s) ds. \end{align} I am familiar with the integration by parts formula for two semimartingales, \begin{align} X_tY_t = X_0Y_0 + \int_0^t X_s dY_s + \int_0^t Y_s dX_s + \langle X, Y \rangle _t. \end{align} However, I am not sure how to use this identity to prove the above statement. Any ideas?

You need three ingredients: 1. Any continuously differentiable function is a semimartingale, since it is of locally finite total variation, 2. for a Riemann-Stieltjes / Lebesgue-Stieltjes integral you have $d\phi(s) = \phi'(s) ds$ and 3. the covariation is defined in terms of the martingale parts, hence we have $[X,\phi]_t = [X,0]_t = 0$. Hence combining it yields
$\phi(t)B_t = \phi(0)B_0 + \int_0^t \phi(s) dB_s + \int_0^t B_s d\phi(s) = \int_0^t \phi(s) dB_s + \int_0^t B_s \phi'(s) ds$
Using the integration by parts formula we have $$\phi(t)B_t=0+\int_0^t\phi(s)dB_s+\int_0^tB_s d\phi(s)+\langle B_s,\phi(s)\rangle_t=\int_0^t\phi(s)dB_s+\int_0^tB_s \phi'ds$$ using the fact that $B_0=0$ for a Brownian Motion and $\langle B_s,\phi(s)\rangle_t=0$ since $\phi$ is a deterministic function of time.