# Covariance of time-integrated processes with non-zero expectation

my ultimate goal is to compute the auto-covariance of the time-integrated Ornstein-Uhlenbeck process which has an initial value that is drawn from a Gaussian distribution with the same variance as the long-term variance of the OU process, however my following question is rather generic.

Let $$Y_t = \int_0^t X_s dt$$. Then:

$$\begin{equation} Cov(Y_t,Y_u) = Cov(\int_0^t X_s ds, \int_0^u X_s' ds')\\ = E[\int_0^t X_s ds \int_0^u X_s' ds'] - E[\int_0^t X_s ds] E[\int_0^u X_s' ds']\\ = E[\int_0^t \int_0^u X_s X_s' ds' ds] - E[\int_0^t X_s ds] E[\int_0^u X_s' ds'] \end{equation}$$

So far I believe that I did not make any noteworthy assumptions. Beforehand I computed the case where $$E[X_t]=0$$. In this case the second part of the sum is zero.

Making use of Fubini's theorem to put the expectation into the integral, I obtain $$\begin{equation} Cov(Y_t,Y_u) = \int_0^t \int_0^u E[X_s X_s'] ds' ds \end{equation}$$

using the definition of the covariance in reverse order, this can again be expanded to $$\begin{equation} Cov(Y_t,Y_u) = \int_0^t \int_0^u Cov(X_s,X_s') + E[X_s] E[X_s'] ds' ds = \int_0^t \int_0^u Cov(X_s,X_s') \end{equation}$$

Hence, if the expected value is zero, I can compute the auto-covariance of the time-integrated process by integration of the original auto-covariance.

Now I want to consider an expected value different from zero. From my current viewpoint the relationship $$\begin{equation} Cov(Y_t,Y_u) = E[\int_0^t \int_0^u X_s X_s' ds' ds] - E[\int_0^t X_s ds] E[\int_0^u X_s' ds'] \end{equation}$$ should still hold.

What follows however cannot be correct and I would like to ask for the error in the computation and advice for the correct computation (possibly with respect to the Ornstein-Uhlenbeck process as $$X_t$$).

Please find the error in the following: Using Fubini, we obtain $$\begin{equation} Cov(Y_t,Y_u) = \int_0^t \int_0^u E[X_s X_s'] ds' ds - \int_0^t E[X_s] ds \int_0^u E[X_s'] ds'\\ = \int_0^t \int_0^u E[X_s X_s'] ds' ds - \int_0^t \int_0^u E[X_s] E[X_s'] ds'ds \end{equation}$$

Using the definition of the covariance results in $$\begin{equation} Cov(Y_t,Y_u) = \int_0^t \int_0^u Cov(X_s,X_s') + E[X_s] E[X_s'] ds' ds - \int_0^t \int_0^u E[X_s] E[X_s'] ds'ds \end{equation}$$ Splitting the integral then leads to $$\begin{equation} Cov(Y_t,Y_u) = \int_0^t \int_0^u Cov(X_s,X_s') ds' ds + \int_0^t \int_0^u E[X_s] E[X_s'] ds' ds - \int_0^t \int_0^u E[X_s] E[X_s'] ds'ds \end{equation}$$ which brings me to the same final relationship $$\begin{equation} Cov(Y_t,Y_u) = \int_0^t \int_0^u Cov(X_s,X_s') \end{equation}$$

Again, I strongly suspect that this relationship is only valid for a non-zero expected value, however I also obtain it for a non-zero expected value. Hence: which step is wrong?

If possible, I also would like to know how to tackle in a next step the varying $$X_0$$, if I draw if from a Gaussian distribution with the long-term variance of the OU process.