I am doing the last part of question 5 on this website although it is in French It can be followed easily.
The question is: Assume that $H=\ell^2(N,C)$, N and C being sets of natural and complex numbers resp. For a fixed integer $n$ suppose: $$M=\left\{x\in H;\ \sum_{k=0}^n x_k=0\right\}.$$
Verify that M is a closed subspace of $H$. Find a subspace N such that $M\oplus N=H$ . Give the distance of the element $(1,0,0,\dots)$ from M.
I am able to prove that M is a closed subspace of $H$ but I do not understand how to search for a complementary subspace $N$. More specifically part of their solution were they decomposed $x$ like $$x=p(x)+k(1,1,\dots,1,0,\dots).$$ From then, their answer states that taking the sum of the first $n$ terms of each member of the above expression, they find that $k=\frac{1}{n+1}$.
That is the step I do not get, my attempt was that the sum of first $n$ terms of that decomposed expression is given by: $$nx=np(x)+kn(1,1,\dots,1,0,\dots).$$
Then from here I am stuck... what am I missing?
Start from the decomposition of $x$ you've found: Let $s_n:H\rightarrow\mathbb C$ be the map $$s(x_j)=\sum_{j=0}^nx_j$$(that is, $s_n(x)$ is the sum of the first $n+1$ terms in $x$). Define the map $P:H\rightarrow H$ by $$(x_j)\mapsto(x_j)-\frac{s_n(x)}{n}(1,\cdots,\underbrace{1}_{n\text{th term}},0,\cdots)$$ Prove that 1) $P$ is a projection (that is, $P^2=P$) 2) $P(x)=x$, for all $x\in M$, and 3) That $M\oplus \ker P=H$. To find $d(x,M)$, use the theorem that states $$d(x,M)=\|x-P(x)\|$$ (that is, the distance between a point and a closed subspace is equal to the distance between the point and its projection).
This is pretty standard. If you have a closed subspace $Y$, try and look for the corresponding projection $P$. Although it's not always easy, sometimes it's immediate how to project by the way the subspace $Y$ is defined, for example, if I gave you $$M=\{(x_j)|x_0=x_1=\cdots=x_n=0\}$$ the projection is (clearly, I think) $(x_j)\mapsto(0,\cdots,0,x_{n+1},x_{n+2},\cdots)$