# Does PCA preserve observations (rows) of the data?

Say I have a data matrix of size $N \times P$ where $N$ is the number of samples and $P$ is the number of features. Now, if I do principal component analysis, I get another data matrix of size $N \times K$ where $K$ was chosen according to some criteria. My question: if I pick a row (sample) from the $\text{PCA}$ matrix, does it still point to the same sample as in the original data matrix?

In my study the data on each row is from one subject, so I want to know if the correspondence still exists if I use $\text{PCA}$ for feature selection. (I think this is correct but better safe than sorry...!)

• Yes, it does. Sep 3, 2014 at 10:51
• Because the question itself deals not with "feature selection" I changed the title and removed unnecessary tags. Sep 3, 2014 at 10:56
• Yes, you can fully reconstruct your original data set using only the output from a PCA analysis of it. Sep 3, 2014 at 10:57
• @Gilles: what could possibly be the reason to change PCA into $\text{PCA}$? Sep 3, 2014 at 11:25

As others said in the comments, yes, it does preserve row order. If you have a standardized data matrix $\mathbf D$ and a rotation matrix $\mathbf \Omega$, you get your rotated samples $\mathbf R$ simply doing:
$$\mathbf D \mathbf \Omega = \mathbf R$$
$\mathbf \Omega$ is a square matrix with $P$ rows and columns. If you want to reduce the number of PCs all you have to do is keep only the first $K$ columns of $\mathbf \Omega$.