Principal component analysis "backwards": how much variance of the data is explained by a given linear combination of the variables? I have carried out a principal components analysis of six variables $A$, $B$, $C$, $D$, $E$ and $F$. If I understand correctly, unrotated PC1 tells me what linear combination of these variables describes/explains the most variance in the data and PC2 tells me what linear combination of these variables describes the next most variance in the data and so on. 
I'm just curious -- is there any way of doing this "backwards"? Let's say I choose some linear combination of these variables -- e.g. $A+2B+5C$, could I work out how much variance in the data this describes?
 A: Let the total variance, $T$, in a data set of vectors be the sum of squared errors (SSE) between the vectors in the data set and the mean vector of the data set, 
$$T = \sum_{i} (x_i-\bar{x}) \cdot (x_i-\bar{x})$$
 where $\bar{x}$ is the mean vector of the data set, $x_i$ is the ith vector in the data set, and $\cdot$ is the dot product of two vectors.  Said another way, the total variance is the SSE between each $x_i$ and its predicted value, $f(x_i)$, when we set $f(x_i)=\bar{x}$.  
Now let the predictor of $x_i$, $f(x_i)$, be the projection of vector $x_i$ onto a unit vector $c$.
$$ f_c(x_i) = (c \cdot x_i)c$$  
Then the $SSE$ for a given $c$ is $$SSE_c = \sum_i (x_i - f_c(x_i)) \cdot (x_i - f_c(x_i))$$
I think that if you choose $c$ to minimize $SSE_c$, then $c$ is the first principal component.
If instead you choose $c$ to be the normalized version of the vector $(1, 2, 5, ...)$, then $T-SSE_c$ is the variance in the data described by using $c$ as a predictor.
A: If we start with the premise that all variables have been centred (standard practice in PCA), then the total variance in the data is just the sum of squares:
$$T=\sum_{i}(A_{i}^{2}+B_{i}^{2}+C_{i}^{2}+D_{i}^{2}+E_{i}^{2}+F_{i}^{2})$$
This is equal to the trace of the covariance matrix of the variables, which equals the sum of the eigenvalues of the covariance matrix.  This is the same quantity that PCA speaks of in terms of "explaining the data" - i.e. you want your PCs to explain the greatest proportion of the diagonal elements of the covariance matrix.  Now if we make this an objective function for a set of predicted values like so:
$$S=\sum_{i}\left(\left[A_{i}-\hat{A}_{i}\right]^{2}+\dots+\left[F_{i}-\hat{F}_{i}\right]^{2}\right)$$
Then the first principal component minimises $S$ among all rank 1 fitted values $(\hat{A}_{i},\dots,\hat{F}_{i})$.  So it would seem like the appropriate quantity you are after is 
$$P=1-\frac{S}{T}$$
To use your example $A+2B+5C$, we need to turn this equation into rank 1 predictions.  First you need to normalise the weights to have sum of squares 1.  So we replace $(1,2,5,0,0,0)$ (sum of squares $30$) with $\left(\frac{1}{\sqrt{30}},\frac{2}{\sqrt{30}},\frac{5}{\sqrt{30}},0,0,0\right)$.  Next we "score" each observation according to the normalised weights:
$$Z_{i}=\frac{1}{\sqrt{30}}A_{i}+\frac{2}{\sqrt{30}}B_{i}+\frac{5}{\sqrt{30}}C_{i}$$
Then we multiply the scores by the weight vector to get our rank 1 prediction.
$$\begin{pmatrix}
\hat{A}_{i} \\
\hat{B}_{i} \\
\hat{C}_{i} \\
\hat{D}_{i} \\
\hat{E}_{i} \\
\hat{F}_{i}\end{pmatrix}
=Z_{i}\times\begin{pmatrix}
\frac{1}{\sqrt{30}} \\
\frac{2}{\sqrt{30}} \\
\frac{5}{\sqrt{30}} \\
0 \\
0 \\
0\end{pmatrix}$$
Then we plug these estimates into $S$ calculate $P$.  You can also put this into matrix norm notation, which may suggest a different generalisation.  If we set $O$ as the $N\times q$ matrix of observed values of the variables ($q=6$ in your case), and $E$ as a corresponding matrix of predictions.  We can define the proportion of variance explained  as:
$$\frac{||O||_{2}^{2}-||O-E||_{2}^{2}}{||O||_{2}^{2}}$$
Where $||.||_{2}$ is the Frobenius matrix norm.  So you could "generalise" this to be some other kind of matrix norm, and you will get a difference measure of "variation explained", although it won't be "variance" per se unless it is sum of squares.
A: 
Let's say I choose some linear combination of these variables -- e.g. $A+2B+5C$, could I work out how much variance in the data this describes?

This question can be understood in two different ways, leading to two different answers.
A linear combination corresponds to a vector, which in your example is $[1, 2, 5, 0, 0, 0]$. This vector, in turn, defines an axis in the 6D space of the original variables. What you are asking is, how much variance does projection on this axis "describe"? The answer is given via the notion of "reconstruction" of original data from this projection, and measuring the reconstruction error (see Wikipedia on Fraction of variance unexplained). Turns out, this reconstruction can be reasonably done in two different ways, yielding two different answers. 

Approach #1
Let $\newcommand{\S}{\boldsymbol \Sigma} \newcommand{\w}{\mathbf w} \newcommand{\v}{\mathbf v}\newcommand{\X}{\mathbf X} \X$ be the centered dataset ($n$ rows correspond to samples, $d$ columns correspond to variables), let $\S$ be its covariance matrix, and let $\w$ be a unit vector from $\mathbb R^d$. The total variance of the dataset is the sum of all $d$ variances, i.e. the trace of the covariance matrix: $T = \mathrm{tr}(\S)$. The question is: what proportion of $T$ does $\w$ describe? The two answers given by @todddeluca and @probabilityislogic are both equivalent to the following: compute projection $\X \w$, compute its variance and divide by $T$: $$R^2_\mathrm{first} = \frac{\mathrm{Var}(\X \w)}{T} = \frac{\w^\top \S \w}{\mathrm{tr}(\S)}.$$
This might not be immediately obvious, because e.g. @probabilityislogic suggests to consider the reconstruction $\X \w \w^\top$ and then to compute $$\frac{\|\X\|^2 - \|\X-\X \w \w^\top\|^2}{\|\X\|^2},$$ but with a little algebra this can be shown to be an equivalent expression.

Approach #2
Okay. Now consider a following example: $\X$ is a $d=2$ dataset with covariance matrix $$\S = \left(\begin{array}{c}1&0.99\\0.99&1\end{array}\right)$$ and $\mathbf w = (\begin{array}{}1&0\end{array})^\top$ is simply an $x$ vector:

The total variance is $T=2$. The variance of the projection onto $\w$ (shown in red dots) is equal to $1$. So according to the above logic, the explained variance is equal to $1/2$. And in some sense it is: red dots ("reconstruction") are far away from the corresponding blue dots, so a lot of the variance is "lost".
On the other hand, the two variables have $0.99$ correlation and so are almost identical; saying that one of them describes only $50\%$ of the total variance is weird, because each of them contains "almost all the information" about the second one. We can formalize it as follows: given projection $\X\w$, find a best possible reconstruction $\X\w\v^\top$ with $\v$ not necessarily the same as $\w$, and then compute the reconstruction error and plug it into the expression for the proportion of explained variance: $$R^2_\mathrm{second}=\frac{\|\X\|^2 - \|\X-\X \w \v^\top\|^2}{\|\X\|^2},$$ where $\v$ is chosen such that $\|\X-\X \w \v^\top\|^2$ is minimal (i.e. $R^2$ is maximal). This is exactly equivalent to computing $R^2$ of multivariate regression predicting original dataset $\X$ from the $1$-dimensional projection $\X\w$.
It is a matter of straightforward algebra to use regression solution for $\v$ to find that the whole expression simplifies to $$R^2_\mathrm{second}=\frac{\|\S \w\|^2}{\w^\top \S \w \cdot \mathrm{tr}(\S)}.$$ In the example above this is equal to $0.9901$, which seems reasonable.
Note that if (and only if) $\w$ is one of the eigenvectors of  $\S$, i.e. one of the principal axes, with eigenvalue $\lambda$ (so that  $\S \w = \lambda \w$), then both approaches to compute $R^2$ coincide and reduce to the familiar PCA expression $$R^2_\mathrm{PCA} = R^2_\mathrm{first} = R^2_\mathrm{second} = \lambda/\mathrm{tr}(\S) = \lambda/\sum \lambda_i.$$
PS. See my answer here for an application of the derived formula to the special case of $\w$ being one of the basis vectors: Variance of the data explained by a single variable.

Appendix. Derivation of the formula for $R^2_\mathrm{second}$
Finding $\v$ minimizing the reconstruction $\|\X-\X \w \v^\top\|^2$ is a regression problem (with $\X \w$ as univariate predictor and $\X$ as multivariate response). Its solution is given by $$\v^\top = \left((\X \w)^\top (\X \w)\right)^{-1}(\X \w)^\top \X = (\w^\top \S \w)^{-1} \w^\top \S.$$
Next, the $R^2$ formula can be simplified as $$R^2=\frac{\|\X\|^2 - \|\X-\X \w \v^\top\|^2}{\|\X\|^2} = \frac{\|\X \w \v^\top\|^2}{\|\X\|^2}$$ due to the Pythagoras theorem, because the hat matrix in regression is an orthogonal projection (but it is also easy to show directly).
Plugging now the equation for $\v$, we obtain for the numerator: $$\|\X \w \v^\top\|^2 = \mathrm{tr}\left(\X \w \v^\top (\X \w \v^\top)^\top\right) = \mathrm{tr}(\X\w\w^\top\S\S\w\w^\top\X^\top)/(\w^\top\S\w)^2=\mathrm{tr}(\w^\top\S\S\w)/(\w^\top\S\w) = \|\S\w\|^2 / (\w^\top\S\w).$$
The denominator is equal to $\|\X\|^2 = \mathrm{tr}(\S)$ resulting in the formula given above.
