The exact solution for wavefunctions of six-dimensional Luttinger–Kohn Hamiltonian, describing the valence band of cubic semiconductors in the effective mass approximation, is derived. The problem of space quantization for a rectangular quantum well with finite depth is solved. The wavefunctions of carriers in the quantum well are built up of a complete set of exact wavefunctions for the bulk materials constituting the heterojunction. Obtained formulae for wavefunctions permit one to derive the analytical expression for a determinant, which nulls give the allowed energy values. Comparison of the energy spectra for the Si/Si0.88Ge0.12 quantum well obtained in the framework of the developed technique, and using four-dimensional Luttinger–Kohn Hamiltonian allows us to trace clearly the impact of the spin–orbit interaction on the formation of the energy spectrum for the quantum well.