Variance Ratio Formula I've been trying to minimize/maximize the ratio of quadratic forms given by
$$Q(c)=\frac{c^\top \Sigma c}{c^\top \text{diag}(\Sigma) c}$$
where $\Sigma$ denotes a covariance matrix of some $n$-dimensional vector, $X$. 
I've been able to show that in the $n=2$ case, $Q(c)$ takes values between $1 \pm R$, where $R$ is the correlation coefficient between $X_1$ and $X_2$. But I'm getting stuck trying to optimize this function in the general case. Is there an analytic solution to this optimization problem?
 A: You're right: indeed, there is an algebraic solution.
The optimization must occur over the set of $c$ for which the denominator is nonzero.  I will leave to interested readers the special case where there exist nonzero $c$ for which the denominator nevertheless is zero: this is equivalent to at least one of the components of $X$ being constant.
This leaves us to deal with the generic case where all diagonal elements $\sigma_{ii}^2$ of $\Sigma$ are (strictly) positive.  Writing
$$\Delta = \pmatrix{\sigma_{11} & 0 & \cdots & 0 \\ \vdots & \ddots & \cdots & 0 \\ 0 & 0 & \cdots & \sigma_{nn}}$$
we obtain the usual relationship between the covariance matrix and the correlation matrix $R,$
$$\Sigma = \Delta R\Delta.$$
Given $c\in\mathbb{R}^n\setminus\{0\},$ rescaling $$x = c\Delta \ne 0$$ gives
$$\frac{c^\prime\Sigma c}{c^\prime \operatorname{diag}(\Sigma) c} = \frac{x^\prime R x}{x^\prime x}.$$
Those familiar with PCA will already see the answer, but for the record let's obtain it using more fundamental results of linear algebra.
Because $\Sigma$ represents a positive-definite quadratic form, so does $R$ and therefore (by the Spectral Theorem) $R$ has an orthonormal eigenbasis $e_1, \ldots, e_n$ of eigenvectors with associated eigenvalues $\lambda_i\ge 0.$  Use this basis to express $x\ne 0$ as a linear combination
$$x = x_1 e_1 + \cdots + x_n e_n.$$
Then
$$\frac{x^\prime R x}{x^\prime x} = \frac{x_1^2\lambda_1 + \cdots +x_n^2\lambda_n}{x_1^2 + \cdots + x_n^2}$$
is a linear combination of the eigenvalues with coefficients $x_i^2 / (x_1^2 + \cdots + x_n^2)$ that are not all zero.
This set is (by definition) the convex hull of the eigenvalues, which will be the smallest closest interval containing them all.  Clearly this is maximized by the largest eigenvalue of $R$ and minimized by the smallest one.
This generalizes the $n=2$ case because the eigenvalues of the correlation matrix with correlation coefficient $r$ are $1\pm r.$
Incidentally, because the eigenvalues are the roots of the characteristic polynomial of $R,$ we may consider this  an algebraic solution, even though it's somewhat indirect (you still have to find the roots if you need explicit values).
