In this paper, a set of optimal subspaces is specified for L2 approximation of three classes of functions in the Sobolev spaces $$W_{2}^{{(r)}}$$ defined on a segment and subject to certain boundary conditions. A subspace X of a dimension not exceeding n is called optimal for a function class A if the best approximation of A by X is equal to the Kolmogorov n-width of A. These boundary conditions correspond to subspaces of periodically extended functions with symmetry properties. All approximating subspaces are generated by equidistant shifts of a single function. The conditions of optimality are given in terms of Fourier coefficients of a generating function. In particular, we indicate optimal spline spaces of all degrees d $$ \geqslant $$ r – 1 with equidistant knots of several different types.