Length of a vector in 3 dimension spaces

69 Views Asked by At

while I'm studying principal-component analysis, I have misunderstanding about principal component, I was think that it's orthogonal and has a single point,which I mean by single points is if we have p dimensions then the vector will be represented with p points which is come together to represent a single points in the space, for example for two dimensions the points 2,2 represents a single points a(2,2), and that's how we represent a vectors in p dimension we draw a line from origin up to that point(which is represented by p coordinates points).


lets assume that we have 3 dimension space(I denotes the dimension by the number of rows, and the coulomns are just another points, some people denotes the the dimension with number of coulomns) as shown :

 4     5     6     7    14     7
 4     5     8     2     1     0
 7     9     8     8     4     5

then by applying pca (this function will return the principal components)

PC =pca_by_svd([4 5 6 7 14 7 ; 4 5 8 2 1 0 ; 7 9 8 8 4 5])

PC =

    0.0273    0.4183    0.8079
    0.0364    0.5578   -0.1657
    0.1346    0.1091    0.1948
   -0.2821    0.5638   -0.4897
   -0.8479   -0.2911    0.1352
   -0.4258    0.3152    0.1544

and each Coulomn are represented the principal components. My question is how the vector(or any of the two vectors above) :

    0.8079 
   -0.1657
    0.1948
   -0.4897
    0.1352
    0.1544

could be represented in 3 dimension space? does PCA find p orthogonal vectors, with each vector has a P point?


The matlab code for pca_by_svd is

function [PC Y varPC] = pca_by_svd(X)
    %# PCA_BY_SVD
    %#   X      data matrix of size n-by-p where n<<p
    %#   PC     columns are first n principal components
    %#   Y      data projected on those PCs
    %#   varPC  variance along the PCs
    %#

    X0 = bsxfun(@minus, X, mean(X,1));     %# shift data to zero-mean
    [U,S,PC] = svd(X0,'econ');             %# SVD decomposition
    Y = X0*PC;                             %# project X on PC
    varPC = diag(S'*S)' / size(X,1);       %# variance explained
end