Question: > 
> $(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.

Answer: 
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.
Attempt 2 looks like a pretty good start, you can then use that result to inductively prove it for all n, if you don’t fancy trying to get that result with a general n directly.