The atomic force microscope (AFM) is capable of directly probing the mechanics of samples with length scales from single molecules to tissues and force scales from pico to micronewtons. In particular, AFM is widely used as a tool to measure the elastic modulus of soft biological samples by collecting force-indentation relationships and fitting these to classic elastic contact models. However, the analysis of raw force-indentation data may be complicated by mechanical heterogeneity present in biological systems. An analytical model of an elastic indentation on a bonded two-layer sample was solved. This may be used to account for substrate effects and more generally address experimental design for samples with varying elasticity. This model was applied to two mechanobiology systems of interest. First, AFM was combined with confocal laser scanning fluorescence microscopy and finite element analysis to examine stiffness changes during the initial stages of invasion of MDA-MB-231 metastatic breast cells into bovine collagen I matrices. It was determined that the cells stiffen significantly as they invade, the amount of stiffening is correlated with the elastic modulus of the collagen gel, and inhibition of Rho-associated protein kinase reduces the elastic modulus of the invading cells. Second, the elastic modulus of cancer cell nuclei was investigated ex situ and in situ. It was observed that inhibition of histone deacetylation to facilitate chromatin decondenstation result in significantly more morphological and stiffness changes in cancerous cells compared to normal cells. The methods and results presented here offer novel strategies for approaching biological systems with AFM and demonstrate its applicability and necessity in studying cellular function in physiologically relevant environments.