I am stuck in this proof... I almost got it, but I must have made a mistake. It is part B that I am getting wrong. Thanks in advance for your help!
QUESTION: Let $X$ satisfy the autonomous SDE $$dX=b(X)dt+\sigma(X)dW,$$ with $X(0)=y$, where $y\in\mathbb{R}$ is a constant, and let $f:\mathbb{R}\to\mathbb{R}$ be an arbitrary smooth function.
(A) Show that $$\mathbb{E}f(X(t))-f(y)=\mathbb{E}\int_0^t\left[f'(X(s))b(X(s))+\frac{1}{2}f''(X(s))\sigma^2(X(s))\right]ds.$$
(B) Deduce that the transition probability $p(x,t|y)$ of $X(t)$ satisfies the forward Kolmogorov (Fokker-Planck) equation $$\partial_tp=-\partial_x(b(x)p)+\frac{1}{2}\partial_{xx}(\sigma^2(x)p).$$
ATTEMPT:
(A) Done using Ito's formula and then taking expectations conditioned on $X(0)=y$.
(B) Expressing the expectations using the transition probability $p(x,t|y)$ of $X(t)$ gives $$\int f(x)p(x,t|y)dx-f(y)=\int\int_0^t p(x,s|y)\left[f'(x)b(x)+\frac{1}{2}f''(x)\sigma^2(x)\right]ds\, dx$$ Taking the time derivative on both sides: $$\int f(x)\partial_t p(x,t|y)dx=\int p(x,t|y)\left[f'(x)b(x)+\frac{1}{2}f''(x)\sigma^2(x)\right] dx=\int \left[f'(x)b(x)p(x,t|y)+\frac{1}{2}f''(x)\sigma^2(x)p(x,t|y)\right] dx$$ (THE END OF THIS PART IS WHAT I GET WRONG)
Integrating by parts (as told by my professor that we should do), we get:
For the first part of the right-hand side of the equation, using $dv=f'(x)dx\implies v=f(x)$ and $u=b(x)p(x,t|y)\implies du=\partial_x\left(b(x)p(x,t|y)\right)$: $$\int f'(x)b(x)p(x,t|y)dx=uv-\int v\,du=f(x)b(x)p(x,t|y)-\int f(x)\partial_x\left[b(x)p(x,t|y)\right]dx$$
And for the second part of the RHS of the equation: $$\frac{1}{2}\int\left[f''(x)\sigma^2p(x,t|y)\right]dx=\frac{1}{2}f'(x)\sigma^2(x)p(x,t|y)-\frac{1}{2}\int f'(x)\partial_x\left[\sigma^2(x)p(x,t|y)\right]dx=\frac{1}{2}f'(x)\sigma^2(x)p(x,t|y)-\frac{1}{2}f(x)\partial_x\left[\sigma^2(x)p(x,t|y)\right]+\frac{1}{2}\int f(x)\partial_{xx}\left[\sigma^2(x)p(x,t|y)\right]dx$$
Therefore, $$\int f(x)\partial_t p(x,t|y)dx=f(x)b(x)p(x,t|y)-\int f(x)\partial_x\left[b(x)p(x,t|y)\right]dx+\frac{1}{2}f'(x)\sigma^2(x)p(x,t|y)-\frac{1}{2}f(x)\partial_x\left[\sigma^2(x)p(x,t|y)\right]+\frac{1}{2}\int f(x)\partial_{xx}\left[\sigma^2(x)p(x,t|y)\right]dx=\int\left[-\partial_x\left[b(x)p(x,t|y)\right]+\frac{1}{2}\partial_{xx}\left[\sigma^2(x)p(x,t|y)\right]\right]f(x)dx+f(x)b(x)p(x,t|y)+\frac{1}{2}f'(x)\sigma^2(x)p(x,t|y)-\frac{1}{2}f(x)\partial_x\left[\sigma^2(x)p(x,t|y)\right]$$
THIS IS WHAT I GET WRONG, the result is supposed to be $$\int f(x)\partial_t p(x,t|y)dx=\int\left[-\partial_x\left[b(x)p(x,t|y)\right]+\frac{1}{2}\partial_{xx}\left[\sigma^2(x)p(x,t|y)\right]\right]f(x)dx\implies \int \partial_t p(x,t|y)dx=\int\left[-\partial_x\left[b(x)p(x,t|y)\right]+\frac{1}{2}\partial_{xx}\left[\sigma^2(x)p(x,t|y)\right]\right]dx,$$ but how do I get that? Because I am sure the equality below is not possible? $$f(x)b(x)p(x,t|y)+\frac{1}{2}f'(x)\sigma^2(x)p(x,t|y)-\frac{1}{2}f(x)\partial_x\left[\sigma^2(x)p(x,t|y)\right]=0$$
You didn't apply the integration by parts formula correctly, e.g.
is not correct (note that the right-hand side depends on $f(x) b(x) p(x,t \mid y)$ whereas the left-hand side does not depend at all on $x$).
Integration by parts gives
$$\int_{-R}^R f'(x) b(x) p(x,t \mid y) \, dx = f(x) b(x) p(x,t \mid y) \bigg|_{x=-R}^R - \int_{-R}^R f(x) \partial_x (b(x) p(x,t \mid y)) \, dx$$
for any $R>0$. Using that $f$ is bounded, $\lim_{|x| \to \infty} p(x,t \mid y)=0$, we get by letting $R \to \infty$
$$\int f'(x) b(x) p(x,t \mid y) \, dx = - \int f(x) \partial_x \big(b(x) p(x,t \mid y)\big) \, dx.$$
Using exactly the same argumentation for the second term gives
$$\int f''(x) \sigma^2(x) p(x,t \mid y) \, dx = \int f(x) \partial_x^2 \big(\sigma^2(x) p(x,t \mid y)\big) \, dx.$$
Adding all up yields
$$\int f(x) \partial_t p(x,t \mid y) \, dx = \int f(x) \left[- \partial_x \big(b(x) p(x,t \mid y)\big) + \frac{1}{2} \partial_x^2 \big(\sigma^2(x) p(x,t \mid y) \big) \right] \, dx.$$
Now choose $$f(x) := \partial_t p(x,t \mid y) + \partial_x \big(b(x) p(t,x \mid y)\big) - \frac{1}{2} \partial_x^2 \big(\sigma^2(x) p(t,x \mid y)\big)$$
to finish the proof.