# variance of log return

Suppose $C_i$ is i-day's closed price, when drift is small, we have the close to close variance $$\sigma^2 =\dfrac{1}{n}\sum\limits^n_{i = 1}\left(\log\left(\dfrac{C_i}{C_{i-1}}\right)\right)^2.$$ If we adjust this for the drift, $$\sigma^2 =\dfrac{1}{n-1}\sum\limits^n_{i = 1}\left(\left(\log\left(\dfrac{C_i}{C_{i-1}}\right)\right)^2 - \dfrac{\log\left(\left(\dfrac{C_n}{C_0}\right)\right)^2}{n(n-1)}\right).$$ I don't know how to obtain the later one in the bracket? I know the original one should be $$\left(\log\left(\dfrac{C_i}{C_{i-1}}\right) - \dfrac{\log\left(\dfrac{C_n}{C_0}\right)}{n}\right)^2$$

You have the parentheses in the wrong place! The correct formula is $$\sigma^2 = \frac{1}{n-1}\left(\sum_{i=1}^n\ln^2\left(\frac{C_i}{C_{i-1}}\right)\right)-\frac{1}{n(n-1)}\ln^2\left(\frac{C_n}{C_{0}}\right)$$ To see this, start with your original formula and expand. \begin{align} \sigma^2 &= \frac{1}{n-1}\sum\left[\ln\left(\frac{C_i}{C_{i-1}}\right)-\frac{1}{n}\ln\left(\frac{C_n}{C_0}\right)\right]^2 \\ &= \frac{1}{n-1}\left[\sum\ln^2\left(\frac{C_i}{C_{i-1}}\right)-\sum\frac{2}{n}\ln\left(\frac{C_n}{C_0}\right)\ln\left(\frac{C_i}{C_{i-1}}\right)+\sum\frac{1}{n^2}\ln^2\left(\frac{C_n}{C_0}\right)\right] \\ &= \frac{1}{n-1}\left[\sum\ln^2\left(\frac{C_i}{C_{i-1}}\right)-\frac{2}{n}\ln^2\left(\frac{C_n}{C_0}\right)+\frac{1}{n}\ln^2\left(\frac{C_n}{C_0}\right)\right] \\ &= \frac{1}{n-1}\left[\sum\ln^2\left(\frac{C_i}{C_{i-1}}\right)-\frac{1}{n}\ln^2\left(\frac{C_n}{C_0}\right)\right] \\ &= \frac{1}{n-1}\sum_{i=1}^n\ln^2\left(\frac{C_i}{C_{i-1}}\right)-\frac{1}{n(n-1)}\ln^2\left(\frac{C_n}{C_{0}}\right) \end{align}