Which matrix do we use to calculate principal components in PCA? $X^T X$ or covariance matrix of $X$?

71 Views Asked by At

I am reading Principal Component Analysis (PCA) from Wikipedia. Under the details section, it states that the principal components are just eigenvectors of $X^T X$ where $X$ is the data matrix.

However, this post suggests that principal components are covariance matrix's eigenvectors.

I am confused now. To obtain principal components in PCA, which matrix do we use? $X^T X$ or covariance matrix of $X$?