It's pretty much strictly linear unless you're talking about very close focusing distances or macro distances. For everything else, what little you may be off is probably less than the rounding error between the actual focal length and the marketed focal length of the lenses in question. For example, a lens with a focal length of 192mm will probably be sold as a 200mm lens. So will a lens with a 197mm or 203mm focal length.
Assuming you are shooting digital, all you have to do is find the ratio of your total sensor width (or height) and divide it by the pixel width (or height) you have left after cropping, then multiply the result by the focal length of the lens with which you shot the photo. If you crop to a different aspect ratio, use whichever side of the image, width or height, you reduced by the lower ratio.
Suppose you used a 200mm lens on a camera with a 6000x4000 pixel sensor. You then cropped the photo to only 3000x2000 pixels. 6000 divided by 3000 is 2.0. Multiply 2.0 times 200mm and you would have needed a 400mm lens to fill the frame with the same field of view you got after cropping the original image.
Suppose you used an 85mm lens with your 24MP camera with the 6000x4000 pixel sensor. You then cropped the image to 1250x1000 pixels (going from a 3:2 to 5:4 aspect ratio). You reduced the long side by a factor of 4.8. You reduced the short side by a factor of 4.0. 4.0 times 85mm is 340mm, so it would have taken a 340mm lens to fill the short side of the frame with what you had left after you cropped. The long side of your photo with the 340mm lens would contain a slightly wider field of view than your crop of the original image, but when you crop the second image from 6000x4000 pixels to 5000x4000 pixels to get the same aspect ratio as your 1250x1000 pixel crop of the original image you'd have the same field of view in both directions.
In the case of Macro lenses focal lengths aren't directly applicable, since the Minimum Focusing Distance and Reproduction ratio are what matters. Focal length is generally expressed in terms of when the lens is focused at infinity.
Personally, I would divide diagonal by diagonal and then aspect doesn't matter.
Diagonals don't work that way when you are comparing two different crops of images from the same sensor.
The sensor itself doesn't change aspect ratio. If the lens is made for that camera, the width of the image circle will be enough to cover the sensor's diagonal at the camera's original aspect ratio, not the reduced diagonal of the cropped aspect ratio.
Say you crop a 6000x4000 pixel image to 5000x4000 pixels to make an 8x10. You haven't changed the magnification ratio at all, but the diagonal will be shorter. You still need the same focal length lens made for that camera that you started with to produce that cropped image. You can't use a slightly longer focal length and get the same picture, even though the diagonal of the 5000x4000 pixel image is shorter than the diagonal of the 6000x4000 pixel image. If you used a longer focal length on the same camera you'd cut off some of the field of view you left in the original crop along with some of what you cropped off on the long ends.
The same concept scales when you change the magnification ratio as well as the aspect ratio. When using the same sensor, as this question presupposes, you must always base it on the linear measurement of the side you reduced by the lowest ratio.