We investigate an initial-boundary value problem for a timefractional subdiffusion equation with the Caputo derivatives on N -dimensional torus by the classical Fourier method. Since our solution is established on the eigenfunction expansion of elliptic operator, the method proposed in this article can be used to an arbitrary domain and an elliptic operator with variable coefficients. It should be noted that the conditions for the existence of a solution to the initial-boundary value problem found in the article cannot be weakened, and the article provides a corresponding example.