Let's write $S(T) = S_T$ and $S(0) = S_0$. We want to compute $\frac{d}{dS_0}\mathbb{E}[f(S_T)]$. From a previous discussion this is equal to $$\mathbb{E}_{S_0}\left[f(S_T)\frac{g'_{S_0}(S_T)}{g_{S_0}(S_T)}\right]$$ where $f(S_T) = e^{-rT}(S_T - K)^{+}$. We need to find $g_{S_0}(S_T)$, the density of $S_T$ which is given by $$g(x) = \frac{1}{x\sigma\sqrt(T)}\phi\left(\frac{ln(x/S_0) - (r - \sigma^2/2)T}{\sigma\sqrt{T}}\right)$$ where $\phi$ is the standard normal density. In my notes it states that through algebra and calculus gives $$\frac{g'_{S_0}(x)}{g_{S_0}(x)} = \frac{ln(x/S_0) - (r - \sigma^2/2)T}{S_0 \sigma^2 T}$$
I am a bit confused but the mix of notation of $g(x)$ and $g_{S_0}(x)$, I want to show the detail of this to convince myself that this is true through "algebra and calculus". This is not an exercise for homework, I just do not understand the notation which is not allowing me to proceed. Any suggestions or comments are appreciated.
Attempted Derivation:
Through some algebra I was able to do expand $g(x)$:
\begin{align*} g(x) &= \frac{1}{x\sigma\sqrt(T)}\phi\left(\frac{ln(x/S_0) - (r - \sigma^2/2)T}{\sigma\sqrt{T}}\right)\\ &= \frac{1}{x\sigma\sqrt{T}}\cdot \frac{1}{\sqrt{2\pi}}\exp\left(-\left(\frac{ln(x/S_0) - (r-\sigma^2/2)T}{\sigma\sqrt{T}}\right)^2/2\right)\\ &= \frac{1}{x\sigma\sqrt{T}}\cdot \frac{1}{\sqrt{2\pi}}\exp\left(-\frac{r}{2\sigma^2} + \frac{ln(x/S_0)}{2\sigma^2 T} + \frac{1}{4}\right) \end{align*} Thus, $$g'(x) = \frac{ \exp\left(-\frac{r}{2\sigma^2} + \frac{ln(x/S_0)}{2\sigma^2 T} + \frac{1}{4}\right)}{2\sqrt{2\pi}\sigma^3 T^{3/2}x^2} - \frac{ \exp\left(-\frac{r}{2\sigma^2} + \frac{ln(x/S_0)}{2\sigma^2 T} + \frac{1}{4}\right)}{\sqrt{2\pi}\sigma\sqrt{T}x^2 } $$
As you can see this seems to be turning into an algebra nightmare. Unless I did something wrong I do not see how we will get $$\frac{g'_{S_0}(x)}{g_{S_0}(x)} = \frac{ln(x/S_0) - (r - \sigma^2/2)T}{S_0 \sigma^2 T}$$