# Show $x-y$ is orthogonal to subspace $Y_n$

$(e_k)$ an orthonormal sequence in an inner product space $X$, with $x \in X$

Show $x-y$, where $$y=\sum_{k=1}^n \langle x, e_k \rangle e_k$$ is orthogonal to the subspace $$Y_n = \operatorname{span}\{e_1, ..., e_n\}.$$

My work:

Attempt 1 $$x=\sum_{i=1}^m \langle x,e_k \rangle e_k,\ z=\sum_{j=1}^n \langle z,e_j \rangle e_j$$

Need $$\langle x-y,z \rangle =0, \ \forall z \in Y_n$$

Let $d=m-n$, then $$\langle x-y,z \rangle = \left\langle \sum_{i=1}^d \langle x,e_i \rangle e_i,\sum_{j=1}^n \langle z,e_k \rangle e_k \right\rangle \\ =\sum_{i=1}^d \langle x,e_i \rangle \overline{\langle z,e_i \rangle}\\?$$ Attempt 2 $$\langle x-y,e_t\rangle =\langle x,e_t \rangle - \langle y,e_t \rangle = \langle x,e_t, \rangle -\left\langle \sum_{k=1}^n \langle x, e_k \rangle e_k,e_t \right\rangle$$ $$= \langle x,e_t\rangle -\langle x,e_t\rangle =0$$

Therefore, I can repeat this process on $$\alpha_1e_1+\cdots+\alpha_ne_n$$ to get the desired result.

I like attempt #2. I would maybe add one more step to show the linearity in the first argument explicitly: $$\langle x,e_t\rangle-\left\langle\sum_{k=1}^n\langle x,e_k\rangle e_k,e_t\right\rangle=\langle x,e_t\rangle-\sum_{k=1}^n\langle x,e_k\rangle\langle e_k,e_t\rangle=\langle x,e_k\rangle-\langle x,e_t\rangle=0$$since $\langle e_k,e_t\rangle=0~\forall k\neq t$ and $\langle e_t,e_t\rangle=1$.
I would also use this to show that $x-y$ and $\alpha_1e_1+\cdots+\alpha_ne_n$ are orthogonal explicitly, because if this is a complex inner product space then you have to use conjugate symmetry and then linearity in the first argument, so there is not technically linearity in the second argument. If this is a real inner product space, then I think it is a lot easier to see the linearity argument.
• You mean to show that $x-y$ and $\alpha_1e_1+\cdots+\alpha_ne_n$ are orthogonal?