# Covariance

Covariance generalizes the concept of variance to multiple random variables. Instead of measuring the fluctuation of a single random variable, the covariance measures the fluctuation of two variables with each other. The covariance of random variables $$X$$ and $$Y$$ is defined as $\text{cov}(X, Y) = E\Big[\big(X - E[X]\big)\big(Y - E[Y]\big)\Big].$ This can be expanded out as $\text{cov}(X,Y)=E(XY)-E(X)E(Y).$ It is particularly important in quantitative finance since many assets are correlated with each other, so understanding how they fluctuate with respect to each other becomes important for using one asset to help price another, or to use one asset as a hedge for another.

## Covariance

### Variance

# Covariance

Which of the following is always equal to $$\text{cov}(X,X)$$?

## Covariance

### Variance

# Covariance

Let $$X$$ be a number chosen uniformly at random from the set $$\{1,2,3,4,5\}$$ and let $$Y=\frac{1}{X}.$$ What is $$\text{cov}(X,Y)$$?

## Covariance

### Variance

# Covariance

Let $$X$$ be the result of rolling a fair six-sided dice. What is $$\text{cov}(X^2, X)$$?

## Covariance

### Variance

# Covariance

Once we know the covariance of two dependent random variables, we can use it to find the variance of their sum: $\text{var}(X+Y) = \text{var}(X)+\text{var}(Y) + 2\text{cov}(X,Y).$

## Covariance

### Variance

# Covariance

Let $$X$$ be the result of rolling a fair six-sided die. What is $$\text{var}(X^2+X)$$?

## Covariance

### Variance

# Covariance

Covariance can also be used to study models of stock prices.

## Covariance

### Variance

# Covariance

Every day, the price of a stock increases with probability $$\frac13$$ and decreases with probability $$\frac23$$. Let $$U$$ be the number of days it goes up, and $$D$$ be the number of days it goes down, over the course of a 10 day period. Is $$\text{cov}(U,D)$$ positive, negative, or zero?

## Covariance

### Variance

# Covariance

Every day, the price of a stock increases with probability $$\frac13$$ and decreases with probability $$\frac23$$. Let $$U$$ be the number of days it goes up, and $$D$$ be the number of days it goes down, over the course of a 10 day period. What is $$\text{cov}(U,D)$$?

## Covariance

### Variance

# Covariance

Suppose that the price of stock A has variance 4 and the price of stock B has variance 9. If the correlation between their prices is 0.5, what is the variance of the sum of their prices?

## Covariance

### Variance

×