# Gamma derivation from the expectation

I am trying to derive Gamma from the expectation principle (differentiating under expectation sign). I understand these steps

$\frac{d^2 C}{d x^2} = e^{-r\tau} \mathbb{E} [ \frac{\partial}{\partial x}Y 1_{[xY>K]}] = e^{-r\tau} \mathbb{E} [ Y \delta(x-K/Y)] = e^{-r\tau} \mathbb{E} [ K/U \delta(x-U)]$= $Ke^{-r\tau} \mathbb{E} [\frac{\delta(x-U)}{U}]$, where $U=K/Y$

but the last transformations to $Ke^{-r\tau} \int^{\infty}_0 \frac{\delta(x-u)}{u}\frac{\text{exp}(-\frac{1}{2} d_2(u)^2)}{u\sqrt{2\pi}\sigma \sqrt{\tau}}du=\frac{Ke^{-r\tau}}{x^2}\Phi'(d_2(x))=\frac{\Phi(d_1)}{x\sigma \sqrt{\tau}}$ are very confusing for me.

The problem is illustrated in http://www.gold-saucer.org/math/diff-int/diff-int.pdf at page 11.

The clue was to establish that there are typos in the script. Hence, I should have aimed to prove $\frac{Ke^{-r\tau}}{S^2\sigma\sqrt{\tau}}\Phi'(d_2)=\frac{\Phi'(d_1)}{S\sigma \sqrt{\tau}}$.
From the properties of Dirac delta, we know that $$\int^{\infty}_0 \delta(x-u)h(u)du=h(x)$$ Hence, \begin{equation} \frac{\partial^2 C}{\partial S^2}= \frac{Ke^{-r\tau}}{S^2\sigma \sqrt{\tau}}\frac{1}{\sqrt{2\pi}}e^{-\frac{(d_2(S))^2}{2}} = \frac{Ke^{-r\tau}}{S^2\sigma \sqrt{\tau}} \Phi'(d_2) \end{equation}
This can be shown that $\frac{Ke^{-r\tau}}{S^2\sigma\sqrt{\tau}}\Phi'(d_2)=\frac{\Phi'(d_1)}{S\sigma \sqrt{\tau}}$ holds, as \begin{align*} \Phi'(d_1)=\frac{1}{\sqrt{2\pi}}e^{-\frac{\left(d_1\right)^2}{2}}& =\frac{1}{\sqrt{2\pi}}e^{-\frac{\left(d_2+\sigma\sqrt{\tau}\right)^2}{2}} \\ &= \text{exp}(-d_2\sigma\sqrt{\tau}-\frac{\sigma^2\tau}{2})\frac{1}{\sqrt{2\pi}}e^{-\frac{\left(d_2 \right)^2}{2}} \\ &= \frac{K}{S}e^{-r\tau}\Phi'(d_2) \end{align*}