Understanding a Definitional PCA Equation I am trying to understand the following about Principal Component Analysis (PCA):

Together, the first $M$ principal component score vectors, $z_{im}$, and the first $M$ principal component loading vectors, $\phi_{jm}$, provide the best $M$-dimensional approximation (in terms of Euclidean distance) to the $i$th observation $x_{ij}$. This representation can be written as $$x_{ij}\approx\sum_{m=1}^M z_{im} \phi_{jm},$$ assuming the original data matrix $\vec{X}$ is column-centered.

This equation makes conceptual sense to me, but it does not make sense mathematically. By definition, the $m$th principal component scores are given by $$z_{im} = \phi_{1m}x_{i1}+\dots+\phi_{pm}x_{ip}=\sum_{j=1}^p \phi_{jm}x_{ij}$$
Do these two equations not contradict each other? Is there some other relationship between these two equations?

The first equation describes
$$X=Z\Phi^T$$
The loading matrix has orthogonal columns (typically orthonormal, which we'll assume here as well), i.e. $\Phi\Phi^T=I$, so when you multiply both side by $\Phi$ from right, you obtain
$$Z=X\Phi$$
and this is the last equation you shared.
