I would like to calculate the expected variance of the average of a Wiener process from time $0$ to time $1$. The equation I believe I am trying to solve is: $$ \mathbb{E} \left[ \left( \int_0^1 W_t \, dt \right)^2 \right] $$
My answer is:
$$ \frac{t^3}{3} \biggr|_0^1 $$
This matches the numbers I get in a Monte Carlo simulation I coded for what I am trying to do and the discrete time solution to this problem.
Now consider the case where the Wiener process "freezes" at time $s$ where $0<s<1$. At time $s$ the Wiener process value becomes fixed, wherever it is at that moment, and is essentially a horizontal line. More formally, I am solving for:
$$ \mathbb{E} \left[ \left( \int_0^1 Q_t \, dt \right)^2 \right] $$
where
$$ Q_{t} = W_{t}: t<s \\ Q_{t} = W_{s}: t>s $$
How do I solve this problem? Thank you!
As Nate Eldredge already pointed out, the Wiener process is a stochastic process and so the integral of a function of a Wiener process is a random variable. Therefore, the equation
$$\int_0^1 W_t^2 \, dt = \frac{t^3}{3}$$
doesn't make sense at all from the mathematical point of view.
As far as I understand, you are simulating sample paths of the Brownian motion and calculating (numerically) the integral above. By the strong law of large numbers, the average of your results should equal (approximately)
$$\mathbb{E} \left( \int_0^1 W_t^2 \, dt \right)$$
where $\mathbb{E}$ denotes the expectation.
By definition, $W_t$ is normal distributed with mean $0$ and variance $t$. In particular, $$\mathbb{E}(W_t^2) = \text{var}(W_t) = t.$$
So, by applying Fubini's Theorem, we obtain
$$\mathbb{E}\left(\int_0^1 W_t^2 \, dt \right) = \int_0^1 \underbrace{\mathbb{E}(W_t^2)}_{t} \, dt = \int_0^1 t \, dt = \frac{t^2}{2} \bigg|_{t=0}^1$$
Now, if you freeze your process, i.e.
$$Q_t := \begin{cases} W_t & t \leq s \\ W_s & t>s \end{cases}$$
it's the easiest way to split up the integral:
$$\begin{align*} \mathbb{E} \left( \int_0^1 Q_t^2 \, dt \right) &= \mathbb{E} \left( \int_0^s W_t^2 \, dt + \int_s^1 W_s^2 \, dt \right) = \int_0^s t \, dt + \int_s^1 s \, dt \\ &= \frac{s^2}{2} + s \cdot (1-s) = s- \frac{s^2}{2} \end{align*}$$
Hopefully, I haven't misunderstood your purpose, since - as it seems - your simulations match with your calculations.
To calculate
$$\mathbb{E} \left[ \left( \int_0^1 Q_t \, dt \right)^2 \right]$$
it's again the best idea to split up the integral:
$$\int_0^1 Q_t \, dt = \int_0^s W_t \, dt + \int_s^1 W_s \, dt = \int_0^s W_t \, dt + (1-s) \cdot W_s$$
Consequently,
$$\begin{align*} \mathbb{E} \left[ \left( \int_0^1 Q_t \, dt \right)^2 \right] &= \mathbb{E} \left[ \left( \int_0^s W_t \, dt \right)^2 \right] + 2 \mathbb{E} \left[ (1-s) \cdot W_s \cdot \int_0^s W_t \, dt\right] + \mathbb{E}[(1-s)^2 \cdot W_s^2] \end{align*}$$
You already know how to calculate the first addend and also the third one is no harm (note that $W_s \sim N(0,s)$). For the second one, use
$$\mathbb{E} \left[ W_s \cdot \int_0^s W_t \, dt \right] = \mathbb{E} \left[ \int_0^s W_t \cdot W_s \, dt \right] = \int_0^s \underbrace{\mathbb{E}(W_t \cdot W_s)}_{\min\{t,s\}=t} \, dt$$