# Ito's Lemma for Integral

Let $S$ follow GBM with $dS=(r-q)S\,dt+\sigma S\,dW$ where $W$ is a standard Brownian motion.
Define $I_t=\int_0^t qe^{r(t-u)}S_u \,du$, then how can I determine $dI_t$? The answer should be $dI_t=(rI_t+qS_t)\,dt$. (Oh and this is not homework, I was just reading some papers on stock loan pricing and ran into this formula, whose proof was not given.)

If I'm correct, then $\frac{\partial I_t}{\partial t}=qS_u e^{r(t-t)}=qS_u.$ I just don't know how to proceed with $\frac{\partial I_t}{\partial S}$ and $\frac{\partial^2 I_t}{\partial S^2}$. Any help is greatly appreciated, thank you!

$$I_t=q\mathrm e^{rt}\int_0^t\mathrm e^{-ru}S_u\mathrm du\implies \dfrac{\mathrm dI_t}{\mathrm dt}=rq\mathrm e^{rt}\int_0^t\mathrm e^{-ru}S_u\mathrm du+q\mathrm e^{rt}(\mathrm e^{-rt}S_t)=rI_t+qS_t$$ Your mistake is to believe that $$\frac{\mathrm d}{\mathrm dt}\int_0^tF(t,u)\mathrm du=F(t,t),$$ actually, $$\frac{\mathrm d}{\mathrm dt}\int_0^tF(t,u)\mathrm du=F(t,t)+\int_0^t\frac{\partial F(t,u)}{\partial t}\mathrm du.$$