We discuss numerical algorithms for the determination of periodic surface structures from light diffraction patterns. With decreasing feature sizes of lithography masks, increasing demands on metrology techniques arise. Scatterometry as a non-imaging indirect optical method is applied to simple periodic line structures in order to determine parameters like side-wall angles, heights, top and bottom widths and to evaluate the quality of the manufacturing process. The numerical simulation of diffraction is based on the finite element solution of the Helmholtz equation. The inverse problem seeks to reconstruct the grating geometry from measured diffraction patterns. Restricting the class of gratings and the set of measurements, this inverse problem can be reformulated as a non-linear operator equation in Euclidean spaces. The operator maps the grating parameters to special efficiencies of diffracted plane wave modes. We employ a Gauss-Newton type iterative method to solve this operator equation. The reconstruction properties and the convergence of the algorithm, however, is controlled by the local conditioning of the non-linear mapping. To improve reconstruction and convergence, we determine optimal sets of efficiencies optimizing the condition numbers of the corresponding Jacobians. Numerical examples are presented for "chrome on glass" masks under the wavelength 632.8 nm and for EUV masks.