This paper presents a theory of heat transfer in an inhomogeneous medium. Numerical results indicate that the density and thermal conductivity of the medium cannot be assumed to be constant, as such an assumption would lead to results which differed considerably from reality. Moreover, the theory provides a new approach to thickness optimisation for passive buildings by introducing a spatial variation in the density of the building material.