Solution (source code)

= Solution

Let $X=(X^1,\ldots,X^d)$ be a <continuous semimartingale>, with $X^j=X_0^j+M^j+A^j$, where $M^j$ is a zero-starting <continuous local martingale> and $A^j$ is a continuous <finite-variation process> starting at zero. For $f\in C^{1,2}([0,\infty)\times\mathbb R^d)$, the <Itô formula> is
$$
\boxed{\begin{aligned}
f(t,X_t)=f(0,X_0)
&+\int_0^t\partial_sf(s,X_s)\,ds
+\sum_{j=1}^d\int_0^t\partial_jf(s,X_s)\,dX_s^j\\
&+\frac12\sum_{j,k=1}^d\int_0^t\partial_{jk}f(s,X_s)\,d[M^j,M^k]_s.
\end{aligned}}
$$
Here $[M^j,M^k]$ is the <quadratic covariation>; the <finite-variation process> parts contribute no such term. The integrals against the <finite-variation processes> are understood pathwise, and those against the <continuous local martingales> are <Itô integrals> after localization.

For $d$-dimensional <Brownian motion> with <independent> standard coordinates, $d[B^j,B^k]_s=\delta_{jk}ds$. In particular, if $f\in C^2$ is independent of time,
$$
f(B_t)=f(B_0)+\sum_j\int_0^t\partial_jf(B_s)\,dB_s^j
+\frac12\int_0^t\Delta f(B_s)\,ds,
$$
where $\Delta$ is the <Laplace operator>. The same formulas hold up to exit from an open domain on which $f$ is smooth.