if $X(t)$ is the Ornstein-Uhlenbeck process and $Y(t)$ the time integrated OU process I am trying to calculate the autocovariance $cov(Y\_t, Y\_s)$.


I have a bunch of results but I don't know how to connect them.
First [in this post](https://mathoverflow.net/questions/84952/time-integral-of-an-ornstein-uhlenbeck-process) they treat the OU process and it's also the result of the variance:
$$ Var(Y\_t) = \mathbb{E} Y\_t^2 = \mathbb{E} \int\_0^t \int\_0^t X\_s X\_u ds du = \int\_0^t \int\_0^t Cov(X\_s, X\_u) ds du = 2 \int\_0^t \int\_0^u Cov(X\_s, X\_u) ds du.$$


and they use $Cov(X\_s, X\_u) = \frac{\sigma^2}{2\theta}\left( e^{-\theta(u-s)} - e^{-\theta(u+s)} \right)$ for $s\leq u$. And in that case the result is 
$$
Var(Y\_t)=\frac{\sigma^2 t}{\theta^2}-\frac{3\sigma^2}{2 \theta^3}+\frac{\sigma^2}{2 \theta^3}(4 e^{-\theta t}-e^{-2 \theta t})
$$


The thing is that (if I am not wrong) the way to calculate the autocovariance is using a similar integral but with different limits. 
I am not sure about this but I was thinking in $
Cov(Y\_t,Y\_v)=\mathbb{E} \int\_0^t \int\_0^v X\_s X\_u ds du
$
but I am not completely sure.


And in that case I don't know how to solve the integral because I have to respect the validity of the formula of the covariance for $s \leq u$


On the other hand I also found the following result[Bhattacharya] :
$$
Cov(Y\_t, Y\_{t+v}-Y\_t)=\frac{\sigma^2}{2 \theta³}(1-e^{-\theta v})
(1-e^{-\theta t})^2
$$


And also I was thinking in using that
$$
Cov(Y\_t, Y\_{t+v}-Y\_t) = Cov(Y\_t, Y\_{v+t}) - Var(Y\_t)
$$
But again, I am not completely sure about this, and if this is true, there is a way to solve the integral and have the same result.


Any help would be really appreciated.


REF:
Bhattacharya, Stochastic Processes with Applications



Autocovariance of time integrated Ornstein-Uhlenbeck process
It's ultimately a simple calculation but it can be hard to see if you haven't done it before.


Since everything in sight has mean zero, the covariance is given by $\mathbb{E}[Y\_t Y\_v]$. Without loss of generality, assume $t \ge v$. Then
$$\begin{align\*}
\mathbb{E}[Y\_t Y\_v] &= \mathbb{E}\left[\int\_0^t X\_s\,ds \int\_0^v X\_u\,du\right] \\
&= \mathbb{E}\left[\int\_0^v \int\_0^t X\_s X\_u\,ds\,du\right] \\
&= \int\_0^v \int\_0^t \mathbb{E}[X\_s X\_u]\,ds\,du && \text{(Fubini)} \\
&= \int\_0^v \left(\int\_0^u \mathbb{E}[X\_s X\_u]\,ds + \int\_u^t \mathbb{E}[X\_s X\_u]\,ds\right)\,du.
\end{align\*}$$
Now use the formula you know for the covariance of $X\_s$ and $X\_u$. In the first integral you have $s \le u$, so use your formula as is, and in the second integral $u \ge s$, so use your formula with $u$ and $s$ reversed. The calculus is then an exercise.


Justifying the use of Fubini's theorem is also an exercise. The Cauchy–Schwarz inequality might be a convenient way to go.


