Arturo O. answered 12/01/19
Experienced Physics Teacher for Physics Tutoring
a = semi-major axis of the ellipse
e = total orbital energy per unit mass (do not confuse this e with eccentricity)
M = mass of primary body at a focus of the ellipse
Using the relation
e = -GM/(2a),
e = v2 / 2 - GM / r
-GM/(2a) = v2 / 2 - GM / r
v2 = 2GM [1/r - 1/(2a)]
v2 = GM (2/r - 1/a)
This is the vis-viva equation.