Compute the first two derivatives of $U_{m,n} ( \phi ) = \int_{\phi}^{\phi + \pi} \sin(\theta - \phi) \Theta(\theta) d \theta$ Given: $$U_{m,n} ( \phi ) = \int_{\phi}^{\phi + \pi} \sin(\theta - \phi) \Theta(\theta) d \theta$$, find $\frac{d U_{m,n}}{d \phi}$ and $\frac{d^2 U_{m,n}}{d \phi^2}$.
I got $$\frac{d U_{m,n}(\phi)}{d \phi} = - \int_{\phi}^{\phi+ \pi} \cos(\theta - \phi) \Theta (\theta) d \theta$$, same as the book.
But, according to the book:
$$\frac{d^2 U_{m,n}(\phi)}{d \phi^2}= \Theta (\phi + \pi)+ \Theta(\phi) - \int_{\phi}^{\pi + \phi} \sin(\theta - \phi) \Theta (\theta) d \theta$$ (Equation 1), which does not make any sense to me.
I got the following:
$\frac{d^2 U_{m,n}(\phi)}{d \phi^2}=- \int_{\phi}^{\pi + \phi} sin(\theta - \phi) \Theta (\theta) d \theta$ (Equation 2). 
Then using integration by parts, 
take $u= \Theta(\theta)$ and $dv=-\sin(\theta - \phi) d \theta$. Then we get:
$$\frac{d^2 U_{m,n}(\phi)}{d \phi^2}=-(\Theta (\phi + \pi)+ \Theta(\phi))-\int_{\phi}^{\pi + \phi} \cos(\theta - \phi) \Theta^{'} (\theta) d \theta$$
Which ultimately gives the Equation 2, and not Equation 1.
Then again integrate by parts with $u=-\cos(\theta - \phi)$ and $dv=\Theta^{'}(\theta) d \theta$, we get:
$$-\int_{\phi}^{\pi + \phi} \cos(\theta - \phi) \Theta^{'}(\theta) d \theta = (\Theta (\phi + \pi)+ \Theta(\phi))-\int_{\phi}^{\pi + \phi} \sin(\theta - \phi) \Theta^{'} (\theta) d \theta$$
Here, $$\Theta^{'}(\theta)=d \Theta(\theta) / d \theta$$
I tried taking $u=\sin(\theta - \phi)$ and $dv= \Theta (\theta) d \theta$ and then got:
$$\frac{d^2 U_{m,n}(\phi)}{d \phi^2}=\int_{\phi}^{\pi + \phi} cos(\theta - \phi) \tilde{\Theta} (\theta) d \theta$$
And then took $u= \tilde{\Theta}(\theta)$ and $dv = \cos (\theta - \phi) d \theta$, and got back to Equation 2!!
Here, $$d \tilde{\Theta} (\theta) / d \theta = \Theta (\theta)$$
Anyone got any ideas where did I go wrong?? Thanks in advance!!
 A: Let's do the first derivative very carefully, as I suspect you got it correct purely by coincidence, which will answer your questions on how to do the second derivative. By the fundamental theorem of calculus (or a version of it called the Leibniz rule or the Reynolds' transport theorem in some contexts):
$$\frac{dU_{m,n}}{d\phi} = \sin(\phi+\pi-\phi)\Theta(\phi+\pi)\frac{d(\phi+\pi)}{d\phi} - \sin(\phi-\phi)\Theta(\phi)\frac{d\phi}{d\phi} - \int_\phi^{\phi+\pi}\cos(\theta-\phi)\Theta(\theta)d\theta$$
$$= \sin(\pi)\Theta(\phi+\pi)\cdot(1) - \sin(0)\Theta(\phi)\cdot(1) - \int_\phi^{\phi+\pi}\cos(\theta-\phi)\Theta(\theta)d\theta$$
$$ = -\int_\phi^{\phi+\pi}\cos(\theta-\phi)\Theta(\theta)d\theta$$
In other words, you have to include the derivative w.r.t. the bounds as well. With that in mind, the second derivative becomes easy:
$$\frac{d^2U_{m,n}}{d\phi^2} = -\cos(\pi)\Theta(\phi+\pi) + \cos(0)\Theta(\phi) - \int_\phi^{\phi+\pi} \sin(\theta-\phi)\Theta(\theta)d\theta$$
$$ = \Theta(\phi+\pi) + \Theta(\phi) - \int_\phi^{\phi+\pi} \sin(\theta-\phi)\Theta(\theta)d\theta$$
