This is a problem from the book Stochastic Calculus for Finance II: Continuous-Time Models by S, Schreve.
Exercise 5.9 (Implying the risk-neutral distribution). Let S(t) be the price of an underlying asset, which is not necessarily a geometric Brownian motion (i.e., does not necessarily have constant volatility). With $S(0) = x$, the risk-neutral pricing formula for the price at time zero of a European call on this asset, paying $(S(T) - Kt)^+$ at time T, is \begin{equation} c(0,T,x,k)=e^{-rT}\int_K^{\infty}(y-K)\tilde{p}(0,T,x,y)dy \end{equation} Differentiate the last equation with respect to $K$ to obtain the equation \begin{equation} \tilde{p}(0,T,x,K)=e^{rT}\frac{d^2}{dK^2}c(0,t,x,K) \end{equation} where $\tilde{p}(0,T,x,y)$ is the irsk neutral density in the $y$ variable of the distribution of $S(T)$ when $S(0)=x$.
My try is using $(y-K)^+$, so \begin{equation} \begin{aligned} \frac{d}{dK}c(0,t,x,K)&=e^{-rT}\frac{d}{dK}\int_{-\infty}^{\infty}(y-K)^+\tilde{p}(0,T,x,y)dy\\ &=-e^{-rT}\int_{K}^{\infty}\tilde{p}(0,T,x,y)dy \end{aligned} \end{equation} and uses the fundamental thoerem of calculus and the fact that $\lim_{y\rightarrow\infty}\tilde{p}(y)=0$ \begin{equation} \frac{d^2}{dK^2}c(0,t,x,K)=-e^{-rT}\tilde{p}(0,T,x,K)dy \end{equation} but I am not very sure about if I can introduce the differential operator into the integral because the function $(y-K)^+$ is not differentiable in $y=K$. If someone knows about another way to solve the problem I really appreciate the help. Thank you very much.
Define the sequence of functions, $\displaystyle F_n(K) = \int_K^n (y-K)\tilde{p}(y) \, dy,$ converging pointwise as
$$\lim_{n \to \infty}F_n(K) = F(K) = \int_K^\infty (y-K) \tilde{p}(y) \, dy$$
Since the integrand is continuously differentiable with respect to $K$ and the interval of integration is finite, we can directly apply the Leibniz integral rule to obtain
$$F_n'(K) = - \int_K^n\tilde{p}(y) \, dy,$$
which also converges pointwise as
$$\tag{*}\lim_{n \to \infty}F_n'(K) = G(K) = - \int_K^\infty \tilde{p}(y) \, dy$$
If we can show that the convergence in (*) is uniform for all $K$ in any interval, then by a basic theorem (found in any analysis textbook) we have the desired result,
$$\frac{d}{dK}\int_K^\infty (y-K) \tilde{p}(y) \, dy= F'(K) = G(K) = -\int_K^\infty\tilde{p}(y) \, dy$$
Uniform convergence: $F_n'(K) \to G(K)$
By convergence of the improper integral $ \int_{0}^\infty \tilde{p}(y) \, dy$, there exists $N \in \mathbb{N}$, which does not depend on $K$ such that if $n \geqslant N$, then
$$\left|\int_n^\infty \tilde{p}(y) \, dy\right| < \frac{\epsilon}{2}$$
When $K \leqslant N$, we have for all $n \geqslant N$,
$$\left|\int_K^n \tilde{p}(y) \, dy - \int_K^\infty \tilde{p}(y) \, dy\right| = \left|\int_n^\infty \tilde{p}(y) \, dy\right| < \frac{\epsilon}{2} < \epsilon$$
When $K > N$, we have for all $n \geqslant K>N$,
$$\left|\int_K^n \tilde{p}(y) \, dy - \int_K^\infty \tilde{p}(y) \, dy\right| = \left|\int_n^\infty \tilde{p}(y) \, dy\right| < \frac{\epsilon}{2} < \epsilon$$
Finally, when $K > N$, we have for all $N \leqslant n < K$,
$$\left|\int_K^n \tilde{p}(y) \, dy - \int_K^\infty \tilde{p}(y) \, dy\right| = \left|-\int_n^K \tilde{p}(y) \, dy- \int_K^\infty \tilde{p}(y) \, dy\right|\\ \leqslant \left|\int_n^K \tilde{p}(y) \, dy\right|+\left| \int_K^\infty \tilde{p}(y) \, dy\right|\leqslant \int_n^\infty \tilde{p}(y) \, dy + \int_N^\infty \tilde{p}(y) \, dy < \frac{\epsilon}{2} + \frac{\epsilon}{2} = \epsilon$$
Therefore, we have uniform convergence since for all $n \geqslant N$ amd all $K$,
$$\left|\int_K^n \tilde{p}(y) \, dy - \int_K^\infty \tilde{p}(y) \, dy\right| = \left|\int_n^\infty \tilde{p}(y) \, dy\right| < \epsilon$$