This question already has an answer here:
I'm curious if there is any math formula for this.
Let's take a close-up of a human face for instance, given the human face is about 20cm/8 inches, how do I choose the right focal length and from what distance a camera with a APS-C sensor should be so that it fits in the top and the bottom of the frame with the whole face?
I just want to know how to mathematically calculate this. It doesn't matter the effects or distortions caused by a telephoto or a wide-angle lens.