Orthogonal projection onto an affine subspace
If we want to find the distance from a vector $x$ to a subspace $S$, we take $\| (I-P_S) x\|$, where $P_S$ is the orthogonal projection onto the subspace $S$. Obviously we could do the same thing for an affine subspace $A$, although $P_A$ would now not be a linear operator. But how can we find $P_A$? Or perhaps we need not go to the trouble of finding $P_A$ in order to calculate the distance from a point $x$ to $A$?
Once we find $(I - P_A)(0)$, whose norm is the distance from the affine subspace to the origin, we're good, because then if $v = (I - P_A)(0)$, we have $\{a - v \mid a\in A\}$ is a subspace, and the distance from $x$ to $A$ is the distance from $x-v$ to $\{a - v \mid a\in A\}$. But is there an easier way?
- What is the easiest way to describe a projection onto an affine subspace?
- What is the easiest way to find the distance from a point to an affine subspace?
I ask because I am afraid this will come up on some exams in the fall, so I am biased toward "calculation" type answers...
(I apologize if this is a repeat... I didn't find this on the site)
Julien has provided a fine answer in the comments, so I am posting this answer as a community wiki:
Given an orthogonal projection $P_S$ onto a subspace $S$, the orthogonal projection onto the affine subspace $a + S$ is $$P_A(x) = a + P_S(x-a).$$