# Calculate first principal component direction and scores

Given that x1 = (9, 9, −18)^T and x2 = (18, 9, 9)^T with eigendecomposition of its sample covariance matrix Σ = cov(X) How do I calculate the first two principal component direction and the principal component scores of x1 and x2 corresponding to the first two principal component direction

## 1 Answer

The columns in the first matrix of the expansion corresponds to principal components of yours, corresponding to eigenvalues in the diagonal, in the same order. Note that they're unit norm, i.e. direction vectors. So, the first two largest eigenvectors, i.e. principal components, are the third and first ones; and the scores of $$x_i$$ are the dot products of $$x_i$$ with these components.

• I'm having trouble following this, because you seem to be asserting that the $x_i$ are eigenvectors of $\Sigma$--but they are not. – whuber Apr 26 '19 at 13:31
• If i understand this correctly, first principal component direction is 4 and second principal component direction is 2, the scores are (4 2)^T ⋅ (9, 9, −18) ⋅ (4 2) and (4 2)^T ⋅ (18, 9, 9) ⋅ (4 2) respectively? – user6308605 Apr 26 '19 at 13:51
• Principal components are vectors with same dimension as your data vectors. First PC is [1/3,2/3, -2/3] for example, which is the third column of the first matrix. @whuber, I corrected a terrible verbal mistake of mine, but I don't seem to understand if it addresses your comment. – gunes Apr 26 '19 at 13:59
• It does, thank you: I had hoped to see the term "dot product" appear somewhere in the answer! – whuber Apr 26 '19 at 14:00
• Ok so first PC direction is dot product of the following, (9, 9, −18) ^T ⋅ (1/3 2/3 -2/3) ⋅ (9, 9, −18) @whuber. Sorry, I am really struggling to understand the application. – user6308605 Apr 26 '19 at 14:07