How can we expand this sum? $\sum_{i=1}^n (e^{rt_i-\frac{1}{2}\sigma^2t_i+\sigma w_{t_i}})^2$ where: $w_{t_i}$ is a standard Brownian motion.
If we let $m_t=e^{-\frac{1}{2}\sigma^2t_i+\sigma w_{t_i}}$ is a martingale where $m_0$ = 1, why does it reduce to $\sum_{i,j=1}^n e^{r(t_i+t_j)+\sigma^2\;min(t_i, t_j)}$.
I know that $\sigma w_{t_i} \sim N(0, \sigma^2 t)$ and the $\text{cov}(w_{t_i},w_{t_j}) = \min\;(t_i,t_j)$ so im essentially asking how the expansion of the sum works and how to put it together since $m_t$ is a martingale and $m_0=1$.