The angles and distances between a satellite and a ground station are easy enough to calculate with trig, but I made this calculator to save me the trouble of re-deriving the equations every time.
Diagram from here
I think the most intuitive way of solving this problem is to start with the law of sines:
If you are trying to calculate the satellite nadir angle α from elevation angle ε and altitude a, you can observe that:
Once you have that, you can calculate β easily from:
And you can plug β back into the law of sines relationship to determine d: