We quantitatively calculate with three-dimensional finite elements the elastic relaxation by surface undulations (consisting of a two-dimensional periodic array of troughs and ridges) of growing heteroepitaxial layers on a low misfitting substrate. Our calculations can generally be applied and are use Si0.97Ge0.03 on Si as an example. The geometrical shapes of the undulations that are introduced into the three-dimensional finite element models are obtained from transmission electron microscopy and atomic force microscopy. Our calculations show that ridges are correlated with a relaxation of the lattice towards the bulk lattice constant (of SiGe), whereas the troughs represent regions of increased strain. The lattice distortion in the SiGe layer is transformed into distortions with opposite sign in the substrate below the interface (i.e. for SiGe/Si: tensile strains at the ridges in the layer are transformed into compressional strain in the substrate below the ridges). The calculations show that it is the free relaxation of the ridges, which makes the elastic relaxation, whereas the substrate does not contribute to elastic strain relaxation. The plastic relaxation starts in the troughs by dislocation nucleation and glide, due to the enhanced shear stresses there. We discuss the pertaining mechanisms with due consideration of the actual layer geometry and strain distribution. Especially, we quantify shear stresses in the substrate, that drive misfit dislocations from the (chemical) interface into the substrate as frequently observed.