= Solution
Put $\omega_n=(n-\tfrac12)\pi$. The deterministic derivative is $g_n'=-\omega_nh_n$, and $g_n(1)=0$, while $W_0=0$. The <Itô product rule> with a deterministic smooth function gives
$$
\xi_n=g_n(1)W_1-g_n(0)W_0-\int_0^1g_n'(t)W_t\,dt
=\boxed{\omega_n\int_0^1h_n(t)W_t\,dt.}
$$
Almost every Brownian path is continuous, hence belongs to $L^2[0,1]$. Its Fourier coefficient in the given <orthonormal basis> $(h_n)$ is therefore $\xi_n/\omega_n$. The <Parseval identity for a Hilbertian basis> gives, pathwise on a probability-one event,
$$
\boxed{\int_0^1W_t^2\,dt=\sum_{n=1}^\infty\frac{\xi_n^2}{(n-\tfrac12)^2\pi^2}.}
$$
This is the squared-norm consequence of the <Brownian half-integer sine expansion>; completeness, rather than pointwise convergence of a Fourier series, is all that is needed.
Back to article page