I know that if we have a vector space $V$ and orthogonally project $x$ onto it to get $\hat x$, then we have $\langle v, x-\hat x \rangle$ for any $v \in V$. However, I do not know whether the same holds for an affine space $S$. It seems that no, because for example if we consider $S = \left\{s \in \mathcal{L}^2(\mathbb{R}) ~|~ s(t) = y(t) \text{ for } t \in [\alpha,\beta]\right\}$, where $\mathcal{L}^2(\mathbb{R})$ denotes the set of finite energy continuous signals, $y$ is an arbitrary signal in $\mathcal{L}^2(\mathbb{R})$, and $\alpha$ and $\beta$ are two constants; then to project $x$ onto $S$, we set $x(t) = y(t)$ for $t \in [\alpha,\beta]$ and leave the rest of $x$ untouched. However, when I looked at the inner product of $s$ and $x - \hat x$, the result was nonzero. Am I making a mistake with the inner product/orthogonal projection onto $S$, or is my guess correct?
Thanks in advance.
For some arbitrary vector space (not necessarily $\mathcal L^2(\mathbb R)$), let $S$ be an affine space and $s_1$ a vector such that $S = s_1 + V$ where $V$ is a subspace.
Let $s_0$ be the orthogonal projection of the zero vector onto $S.$ Then $s_0 \neq 0$ and for $x = 0,$ we have $x - \hat x = -s_0$. Moreover, for $v = s_0$ we have $\langle v, (x - \hat x)\rangle = \langle s_0, -s_0\rangle \neq 0.$
What you do have is that the inner product $\langle v, (x - \hat x)\rangle$ is the same for every vector $v \in S.$