The application of algorithms of the finite element method (FEM) or the boundary element method (BEM) reveals some peculiar properties for a numerical solution of the three-dimensional analysis in infinite domains. Various algorithms offer to avoid such problems at the expense of combining different methods and equations. The algorithm of the 3d analysis developed to solve an external boundary problem by applying the combined method based on incorporating the FEM and Somigliana’s integral formula is considered. The algorithm is modified for the case of the interaction of a structure with an inhomogeneous medium. The efficiency of software implementation of both algorithms has been tested. A stress-strain analysis of an inhomogeneous medium with a cavity has been carried out to illustrate the given approach.