# Help computing a derivative using Matrix calculus.

I have a set of $N$ data series, which I put together to form a single series using a weights vector $x$. The covariance matrix is known ($\Sigma$).

We know that the volatility of the weighted series is:

$$\sigma(x)=\sqrt{x^T ~ \Sigma ~ x}$$

where $\sigma \in R^N$ and $\Sigma \in R^{\{N \times N\}}$.

I use Euler decomposition to do the following:

$$\sigma(x) = \sum_{i=1}^N x_i \frac{\partial \sigma}{\partial x_i}$$

So far, I'm happy with this.

What I want to do is to use an algorithm so that it finds me the vector $x$ such that all the series have the same contribution $x_i \partial_i \sigma(x)$ to the "global" volatility.

The optimization would be done using the following idea:

$$x^* = \arg \min_x \sum_{i=1}^n \left[\frac{\sigma(x)}{n} - x_i \partial_i \sigma(x) \right]^2$$

But I am struggling to compute the value of $\frac{\partial \sigma}{\partial x_i}$ to be able to run the algorithm.

I'd start by the classic step (1) :

$$\frac{\partial \sigma}{\partial x_i} = \frac{\partial (\sqrt{x^T ~ \Sigma ~ x})}{\partial x_i}=-\frac{1}{2} \sigma(x)^{-\frac{3}{2}} \cdot \frac{\partial (x^T ~ \Sigma ~ x)}{\partial x_i}$$

But I am not even sure this step is right, and I don't know how to carry on.

Could tell me if my initial step (1) is right, and how to proceed to get the value of $\partial_i \sigma(x)$?

-
there is a product rule for differentiation $\partial_i(x^T\Sigma x)=(0,...,0,1,0,...0)\Sigma x+x^T\Sigma(0,...,0,1,0,...0)^T$. I'm not sure what the statement of the problem is. $\sigma^2$ is a homogeneous polynomial so that $\sigma(x)^2=\sum_i x_i2\sigma(x)\partial_i\sigma(x)$ – yoyo Dec 19 '11 at 15:25
Whether your initial step is right depends on what you're trying to achieve, and you haven't explained that. The only thing you write after "the following problem" is a definition, but no explanation of what you want to do with that definition. – Henning Makholm Dec 19 '11 at 15:36
@HenningMakholm: I rephrased the question hopefully it's clearer by what I mean for "first step". – SRKX Dec 19 '11 at 15:42
@yoyo: my problem is that I want to find the value of $\partial_i \sigma(x)$. That's what I'm looking for. – SRKX Dec 19 '11 at 15:44
Is it incompletely edited? You have inserted "I'm trying to compute the following value:", but there's no value after the colon, just a paragraph break followed by the existing definition of your $\sigma$. I'm still lost as to what it is you're trying to do. – Henning Makholm Dec 19 '11 at 15:46

I found the answer I was looking for in a paper, I thought I would post it here, although the question was maybe a bit unclear.

$$\partial_{x_i} \sigma(x) = \frac{(\Sigma x)_i}{\sigma(x)}$$

I can hence compute the vector of the derivates for all $i$ as follows:

$$\frac{\Sigma x}{\sqrt{x^T \Sigma x}}$$

Back to the Euler decomposition, I can verify it by doing:

$$\sum_{i=1}^N x_i \partial_{x_i} \sigma(x)=\sum_{i=1}^N x_i \frac{(\Sigma x)_i}{\sigma(x)}=\frac{1}{\sigma(x)} \sum_{i=1}^N x_i (\Sigma x)_i=\frac{1}{\sigma(x)} x^T \Sigma x=\frac{x^T \Sigma x}{\sqrt{x^T \Sigma x}}=\sqrt{x^T \Sigma x}=\sigma(x)$$

-
For completeness, could you link to the paper you've found? – J. M. Dec 22 '11 at 17:15
@J.M.: I've added the link – SRKX Dec 22 '11 at 17:25
Great, thanks. :) – J. M. Dec 22 '11 at 17:26