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?

  1. What is the easiest way to describe a projection onto an affine subspace?
  2. 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)

  • 3
    $\begingroup$ Concretely, if $A=a+S$ is your afffine subspace, and if $p_S$ is the projection onto the linear subspace $S$, then $p_Ax=a+p_S(x-a)$. And the distance from $x$ to $A$ is the distance from $x-a$ to $S$, that is $\|(I-p_S)(x-a)\|$. There is no easier way because that's just an immediate extension of what you do when $a=0$. $\endgroup$
    – Julien
    Jul 26, 2013 at 19:42
  • 1
    $\begingroup$ Note that what I said is true for any choice of $a\in A$. So you don't need to bother with the distance from $A$ to the origin. Just pick any $a\in A$. $\endgroup$
    – Julien
    Jul 26, 2013 at 19:53
  • 1
    $\begingroup$ I don't have enough reputation to comment, but I just posted how to actually compute the projection matrix (since that information sometimes gets buried) in the answer to a duplicate question: math.stackexchange.com/questions/619879/… $\endgroup$
    – yig
    Jan 25, 2018 at 17:12

1 Answer 1


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).$$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.