A problem about the Hilbert subspace $K = \{ f \in \text{L}^2(\mathbb{R}) \quad | \quad \text{for every $n \in \mathbb{Z} : \int_{[n,n+1]} f = 0$} \}$

We have to find $K^\perp$ and the orthogonal projection $\pi_K$ of $H := \text{L}^2(\mathbb{R})$ onto $K.$ It's not that hard to show that $K$ is a closed subspace. I do have some problems with finding $K^\perp,$ although I have found that the functions that are almost constant on every $[n,n+1]$ are a subset (actually, subspace, let's call it $S$) of $K^\perp$ (showing this is also not very hard); I have been unable the show that they are also a superset of $K^\perp.$

However, I do have found an answer to the second question. We can write every $f \in H$ as $f = g + h,$ where $g$ is defined as $f-\int_{[n,n+1]}f$ on $[n,n+1),$ for every integer $n,$ and $h$ as the piecewisely constant function $\int_{[n,n+1]}f,$ again on every $[n,n+1).$ Then $g\in K$ and $h \in S \subseteq K^\perp.$ So $g$ is precisely $\pi_K(f).$ Now my question is, since I can write every $f$ as the sum of unique $g \in K$ and $h\in S$--so we, intuitively speaking, don't need any vectors in $K^\perp \setminus S$ for $K + K^\perp$ to span the space--, must $K^\perp$ then be a subset of $S?$ thereby answering the first question?

All integral used are Lebesgue.

Thanks a lot in advance!


Yes, you have answered both questions. You proved that $H=K+S$, and that $S\subset K^\perp$. The orthogonality makes the decomposition unique. So if $h\in K^\perp$, then $h=0+h$ and so $h\in S$, showing that $K^\perp=S$.

A similar way to see the same is to note that $K^\perp=(I-\pi_K^\vphantom K)H=S$.