ABSTRACT Accurate mathematical expressions have previously been derived for determining the Young's modulus of thin homogeneous samples on rigid substrates when tested using atomic force microscopy. These equations have generally been applied to determine the mechanical properties (in terms of Young's modulus) of thin biological samples bonded to rigid substrates, such as cells. However, biological materials are highly heterogeneous at the nanoscale, so their mechanical properties vary significantly with indentation depth. Consequently, a crucial question is whether these equations are mathematically valid in such cases and if they can lead to reproducible results. In this paper, a rigorous mathematical analysis is used to investigate the validity of equations derived for homogeneous samples with finite thickness when applied to heterogeneous thin samples on rigid substrates. Using the aforementioned analysis, the classical equations are modified to account for depth-dependent mechanical properties. Consequently, the depth-dependent mechanical properties of heterogeneous samples with finite thickness are characterized using appropriate functions instead of single Young's modulus values. Force–indentation data from human fibroblasts and murine breast cancer cells are processed using the method presented in this paper, resulting in accurate and reproducible results.