Bessel differential equation from integral It is a relatively well-known fact that $$\int_{0}^{2\pi}e^{-ikr\cos\theta}d\theta=2\pi J_{0}(kr),$$ where $J_{0}$ is the Bessel function of the first kind and order zero. I'm trying to show that this is the case not from the definition itself, but from the differential equation it should verify, namely the Bessel differential equation of order zero, $$q^{2}\frac{ d^{2}J_{0}}{dq^{2}}+q\frac{dJ_{0}}{dq}+q^{2}J_{0}=0,$$ where now $q\equiv kr$ is the argument of the Bessel function in order to simplify the notation. However, when I apply differentiation with respect to $q$ two times to the above integral, this yields 
$$\int_{0}^{2\pi}(-q^{2}\cos^{2}\theta-iq\cos\theta+q^{2})e^{-iq\cos\theta}d\theta,$$ and it is not obvious to me why this should be 0. 
Any help is appreciated!
 A: Define $f \colon \mathbb{R} \to \mathbb{C}$ by
$$ f(q) = \int \limits_0^{2 \pi} \mathrm{e}^{-\mathrm{i} q \cos(\theta)} \, \mathrm{d} \theta \, .$$
Then we have $f \in C^\infty (\mathbb{R})$ and we can use integration by parts to prove that
\begin{align}
\left[q^2 \frac{\mathrm{d}^2}{\mathrm{d} q^2} + q \frac{\mathrm{d}}{\mathrm{d} q} + q^2 \right] f(q) &= \int \limits_0^{2 \pi} \left[q^2 \sin^2 (\theta) - \mathrm{i} q \cos (\theta) \right] \mathrm{e}^{-\mathrm{i} q \cos(\theta)} \, \mathrm{d} \theta \\
&= \left[- \mathrm{i} q \sin(\theta) \mathrm{e}^{-\mathrm{i} q \cos(\theta)}\right]_{\theta=0}^{\theta=2\pi} \\
&\phantom{=}+ \int \limits_0^{2\pi} \left[\mathrm{i} q \cos (\theta) - \mathrm{i} q \cos (\theta)\right] \mathrm{e}^{-\mathrm{i} q \cos(\theta)} \, \mathrm{d} \theta \\
&= 0
\end{align}
holds for $q \in \mathbb{R}$. This means that $f$ is a non-singular solution to the Bessel equation of order zero, so it must be a multiple of $\operatorname{J}_0$. Since $\operatorname{J}_0 (0) = 1$ and $f(0) = 2 \pi$, the desired equality $f = 2 \pi \operatorname{J}_0$ follows.
