Formula for distance to the horizon for a satellite in orbit.

d = sqrt(2rh+h^2)

d = distance to the horizon
h = height above sea level for the observer.
r = radius of the earth

----------------------------------
Solve for h.

ie. so I can plug in d and r and get a solution for h.

d^2 = h^2 + 2 r h

h^2 + 2 r h - d^2 = 0

quadratic

h = [ -2r +/- 2 sqrt(r^2+d^2) ]/2

which is

-r +/- sqrt(r^2+d^2)

LOL - only use positive root if above ground.

To solve for h in the formula d = sqrt(2rh + h^2), we need to rearrange the equation to isolate h on one side. Here are the steps to do so:

1. Start with the formula: d = sqrt(2rh + h^2).
2. Square both sides of the equation to eliminate the square root: d^2 = 2rh + h^2.
3. Expand the equation: d^2 = 2rh + h * h.
4. Rearrange the terms: h^2 + 2rh - d^2 = 0.
5. This is a quadratic equation in terms of h. To solve it, you can use the quadratic formula: h = (-b ± √(b^2 - 4ac)) / 2a, where a = 1, b = 2r, and c = -d^2.

Substituting the values into the quadratic formula, we get:

h = (-2r ± √((2r)^2 - 4(1)(-d^2))) / (2(1))
= (-2r ± √(4r^2 + 4d^2)) / 2
= (-2r ± 2√(r^2 + d^2)) / 2
= -r ± √(r^2 + d^2)

Therefore, the solution for h is given by:
h = -r ± √(r^2 + d^2)

Note that there will be two possible solutions for h, one positive and one negative. In the context of satellite orbits, we usually consider the positive value of h.