# How to compute $z'=\frac{\mathrm d}{\mathrm dx}\int_0^x \sin(x-s)f(s) \, \mathrm ds$

If $z=\int_0^x \sin(x-s)f(s) \, \mathrm ds$ can anyone explain to me how you would compute $z'=\frac{\mathrm d}{\mathrm dx}\int_0^x \sin(x-s)f(s) \, \mathrm ds$

Or in general $z'=\frac{\mathrm d}{\mathrm dx}\int_0^x \! f(s,x) \, \mathrm ds$? Thanks!

I considering using Leibniz's rule, but I don't know if it can be applied to this situation.

• $\sin(x-s)=\sin(x)\cos(s)-\sin(s)\cos(x)$ – Peđa Terzić Oct 25 '11 at 12:45

Looking at the wikipedia page of differentiation under the integral sign, you set $a(x) = 0$, $b(x) = x$ and $f(x, s) = \sin(x-s) f(s)$.
Alternatively, consider $z(x) = \int_0^x \sin(x-s) f(s) \mathrm{d} s$, and think of $z(x+ \delta x)-z(x)$:
$$\begin{eqnarray} z(x+ \delta x)-z(x) &=& \int_0^{x+\delta x} \sin(x+\delta x-s) f(s) \mathrm{d} s - \int_0^x \sin(x-s) f(s) \mathrm{d} s \\ &=& \int_0^{x+\delta x} \sin(x+\delta x-s) f(s) \mathrm{d} s - \int_0^x \sin(x+\delta x-s) f(s) \mathrm{d} s + \\&& \int_0^x \sin(x+\delta x-s) f(s) \mathrm{d} s - \int_0^x \sin(x-s) f(s) \mathrm{d} s \\ &=& \int_{x}^{x+\delta x} \sin(x+\delta x-s) f(s) \mathrm{d} s + \int_0^x \left( \sin(x+\delta x -s) - \sin(x-s) \right) f(s) \mathrm{d} s \\ &\sim& \delta x \left( \sin(\delta x) f(x) + \int_0^x \cos(x-s) f(s) \right) \end{eqnarray}$$ In the limit $\lim_{\delta x \to 0} \frac{z(x+\delta x)-z(x)}{\delta x}$ the first term becomes zero, and you are get the answer: $$z^\prime(x) = \int_0^x \cos(x-s) f(s) \mathrm{d} s$$
A general approach to this type of problems might be this: think of $z$ as the composition of the two functions $f:\mathbb R ^2 \to \mathbb R$ and $g:\mathbb R \to \mathbb R ^2$:$$f(x,y)=\int _a ^y p(x,t)\text d t,\qquad g(x)=(x,x).$$ So $z(x)=(f\circ g)(x)$. Applying the chain rule (note that $g'=(1,1)$) you get: $$z'(x)=\partial _x f (x,x)+\partial _y(x,x),$$ so the answer is $$z'(x)=\int _a ^x \partial _x p(x,t)\text d t+p(x,x).$$