This paper presents a theory of residual stresses, with applications to biomechanics, especially to arteries. For a hyperelastic material, we use an initial local deformation tensor K as a descriptor of residual strain. This tensor, in general, is not the gradient of a global deformation, and a stress-free reference configuration, denoted ..., therefore, becomes incompatible. Any compatible reference configuration ... will, in general, be residually stressed. However, when a certain curvature tensor vanishes, there actually exists a compatible and stress-free configuration, and we show that the traditional treatment of residual stresses in arteries, using the opening-angle method, relates to such a situation. Boundary value problems of nonlinear elasticity are preferably formulated on a fixed integration domain. For residually stressed bodies, three such formulations naturally appear: (i) a formulation relating to ... with a non-Euclidean metric structure; (ii) a formulation relating to ... with a Euclidean metric structure; and (iii) a formulation relating to the incompatible configuration ... . We state these formulations, show that (i) and (ii) coincide in the incompressible case, and that an extra term appears in a formulation on ... , due to the incompatibility.