I have a quick question that I am having trouble wrapping my head around. The PCA algorithm can be formulated in terms of the correlation matrix (assume the data $X$ has already been normalized and we are only considering projection onto the first PCA). The object function can be written as:
$$ \max_w (Xw)^T(Xw)\; \: \text{s.t.}$$ $$ w^Tw = 1 $$.
This is fine, and we use Lagrangian multipliers to solve it. But this can be rewritten as:
$$ \max_w (Xw)^T(Xw) - \lambda w^Tw $$
which is equivilant to
$$ \max_w \frac{ (Xw)^T(Xw) }{w^Tw} $$
$$= \max_w \sum_{i=1}^n \text{ (distance from point $x_i$ to line $w$ ) }^2 $$ see here
But this is saying to maximize the distance between point and line, and from what I've read here, this is incorrect ( it should be $\min$, not $\max$. Where is my error? Or, can someone show me the link between maximizing variance in projected space and minimizing distance between point and line?