# Cross-covariance

In probability and statistics, given two stochastic processes $\displaystyle{ \left\{X_t\right\} }$ and $\displaystyle{ \left\{Y_t\right\} }$, the cross-covariance is a function that gives the covariance of one process with the other at pairs of time points. With the usual notation $\displaystyle{ \operatorname E }$ for the expectation operator, if the processes have the mean functions $\displaystyle{ \mu_X(t) = \operatorname \operatorname E[X_t] }$ and $\displaystyle{ \mu_Y(t) = \operatorname E[Y_t] }$, then the cross-covariance is given by

$\displaystyle{ \operatorname{K}_{XY}(t_1,t_2) = \operatorname{cov} (X_{t_1}, Y_{t_2}) = \operatorname{E}[(X_{t_1} - \mu_X(t_1))(Y_{t_2} - \mu_Y(t_2))] = \operatorname{E}[X_{t_1} Y_{t_2}] - \mu_X(t_1) \mu_Y(t_2).\, }$

Cross-covariance is related to the more commonly used cross-correlation of the processes in question.

In the case of two random vectors $\displaystyle{ \mathbf{X}=(X_1, X_2, \ldots , X_p)^{\rm T} }$ and $\displaystyle{ \mathbf{Y}=(Y_1, Y_2, \ldots , Y_q)^{\rm T} }$, the cross-covariance would be a $\displaystyle{ p \times q }$ matrix $\displaystyle{ \operatorname{K}_{XY} }$ (often denoted $\displaystyle{ \operatorname{cov}(X,Y) }$) with entries $\displaystyle{ \operatorname{K}_{XY}(j,k) = \operatorname{cov}(X_j, Y_k).\, }$ Thus the term cross-covariance is used in order to distinguish this concept from the covariance of a random vector $\displaystyle{ \mathbf{X} }$, which is understood to be the matrix of covariances between the scalar components of $\displaystyle{ \mathbf{X} }$ itself.

In signal processing, the cross-covariance is often called cross-correlation and is a measure of similarity of two signals, commonly used to find features in an unknown signal by comparing it to a known one. It is a function of the relative time between the signals, is sometimes called the sliding dot product, and has applications in pattern recognition and cryptanalysis.

## Cross-covariance of random vectors

Main page: Cross-covariance matrix

## Cross-covariance of stochastic processes

The definition of cross-covariance of random vectors may be generalized to stochastic processes as follows:

### Definition

Let $\displaystyle{ \{ X(t) \} }$ and $\displaystyle{ \{ Y(t) \} }$ denote stochastic processes. Then the cross-covariance function of the processes $\displaystyle{ K_{XY} }$ is defined by::p.172

$\displaystyle{ \operatorname{K}_{XY}(t_1,t_2) \stackrel{\mathrm{def}}{=}\ \operatorname{cov} (X_{t_1}, Y_{t_2}) = \operatorname{E} \left[ \left( X(t_1)- \mu_X(t_1) \right) \left( Y(t_2)- \mu_Y(t_2) \right) \right] }$

(Eq.1)

where $\displaystyle{ \mu_X(t) = \operatorname{E}\left[X(t)\right] }$ and $\displaystyle{ \mu_Y(t) = \operatorname{E}\left[Y(t)\right] }$.

If the processes are complex-valued stochastic processes, the second factor needs to be complex conjugated:

$\displaystyle{ \operatorname{K}_{XY}(t_1,t_2) \stackrel{\mathrm{def}}{=}\ \operatorname{cov} (X_{t_1}, Y_{t_2}) = \operatorname{E} \left[ \left( X(t_1)- \mu_X(t_1) \right) \overline{\left( Y(t_2)- \mu_Y(t_2) \right)} \right] }$

### Definition for jointly WSS processes

If $\displaystyle{ \left\{X_t\right\} }$ and $\displaystyle{ \left\{Y_t\right\} }$ are a jointly wide-sense stationary, then the following are true:

$\displaystyle{ \mu_X(t_1) = \mu_X(t_2) \triangleq \mu_X }$ for all $\displaystyle{ t_1,t_2 }$,
$\displaystyle{ \mu_Y(t_1) = \mu_Y(t_2) \triangleq \mu_Y }$ for all $\displaystyle{ t_1,t_2 }$

and

$\displaystyle{ \operatorname{K}_{XY}(t_1,t_2) = \operatorname{K}_{XY}(t_2 - t_1,0) }$ for all $\displaystyle{ t_1,t_2 }$

By setting $\displaystyle{ \tau = t_2 - t_1 }$ (the time lag, or the amount of time by which the signal has been shifted), we may define

$\displaystyle{ \operatorname{K}_{XY}(\tau) = \operatorname{K}_{XY}(t_2 - t_1) \triangleq \operatorname{K}_{XY}(t_1,t_2) }$.

The cross-covariance function of two jointly WSS processes is therefore given by:

$\displaystyle{ \operatorname{K}_{XY}(\tau) = \operatorname{cov} (X_{t}, Y_{t-\tau}) = \operatorname{E}[(X_t - \mu_X)(Y_{t- \tau} - \mu_Y)] = \operatorname{E}[X_t Y_{t-\tau}] - \mu_X \mu_Y }$

(Eq.2)

which is equivalent to

$\displaystyle{ \operatorname{K}_{XY}(\tau) = \operatorname{cov} (X_{t+\tau}, Y_{t}) = \operatorname{E}[(X_{t+ \tau} - \mu_X)(Y_{t} - \mu_Y)] = \operatorname{E}[X_{t+\tau} Y_t] - \mu_X \mu_Y }$.

### Uncorrelatedness

Two stochastic processes $\displaystyle{ \left\{X_t\right\} }$ and $\displaystyle{ \left\{Y_t\right\} }$ are called uncorrelated if their covariance $\displaystyle{ \operatorname{K}_{\mathbf{X}\mathbf{Y}}(t_1,t_2) }$ is zero for all times.:p.142 Formally:

$\displaystyle{ \left\{X_t\right\},\left\{Y_t\right\} \text{ uncorrelated} \quad \iff \quad \operatorname{K}_{\mathbf{X}\mathbf{Y}}(t_1,t_2) = 0 \quad \forall t_1,t_2 }$.

## Cross-covariance of deterministic signals

The cross-covariance is also relevant in signal processing where the cross-covariance between two wide-sense stationary random processes can be estimated by averaging the product of samples measured from one process and samples measured from the other (and its time shifts). The samples included in the average can be an arbitrary subset of all the samples in the signal (e.g., samples within a finite time window or a sub-sampling of one of the signals). For a large number of samples, the average converges to the true covariance.

Cross-covariance may also refer to a "deterministic" cross-covariance between two signals. This consists of summing over all time indices. For example, for discrete-time signals $\displaystyle{ f[k] }$ and $\displaystyle{ g[k] }$ the cross-covariance is defined as

$\displaystyle{ (f\star g)[n] \ \stackrel{\mathrm{def}}{=}\ \sum_{k\in \mathbb{Z}} \overline{f[k]} g[n+k] = \sum_{k\in \mathbb{Z}} \overline{f[k-n]} g[k] }$

where the line indicates that the complex conjugate is taken when the signals are complex-valued.

For continuous functions $\displaystyle{ f(x) }$ and $\displaystyle{ g(x) }$ the (deterministic) cross-covariance is defined as

$\displaystyle{ (f\star g)(x) \ \stackrel{\mathrm{def}}{=}\ \int \overline{f(t)} g(x+t)\,dt = \int \overline{f(t-x)} g(t)\,dt }$.

### Properties

The (deterministic) cross-covariance of two continuous signals is related to the convolution by

$\displaystyle{ (f \star g)(t) = (\overline{f(-\tau)}*g(\tau))(t) }$

and the (deterministic) cross-covariance of two discrete-time signals is related to the discrete convolution by

$\displaystyle{ (f \star g)[n] = (\overline{f[-k]}*g[k])[n] }$.