I'm recently reading a book about rocket science which involved orbital mechanics. I know that in an elliptical orbit, the energy $ E=-\frac{GMm}{2a}$, and therefore can get the vis-viva equation: $ v^2=GM(\frac{2}{r}-\frac{1}{a}) $. But now I'm facing a hyperbolic orbit, and its energy and vis-viva equation are a bit different from the previous one. In this case, $ E=\frac{GMm}{2a}$ and the vis-viva equation becomes $v^2 = GM(\frac{2}{r}+\frac{1}{a}) $.
I want to know where the formula $ E=\frac{GMm}{2a}$ comes from. The book I'm reading, Introduction to Rocket Science and Engineering by Travis S Taylor, doesn't provide a satisfying explanation. Here's a screenshot:
And I searched through the web, asked ChatGPT and still got no answers. I read https://users.physics.ox.ac.uk/~harnew/lectures/lecture20-mechanics-handout.pdf and find it hard to understand its contents(especially page 4). Understanding this involved angular momentum and vector cross products which I'm not familiar with(I can learn though!). Also I have a limited knowledge on calculus, so please don't get too many derivatives or integrals involved in the calculation.
I'm puzzled about how to calculate the angular momentum of the spacecraft when it's very far away from focus. Given the conservative energy and the angular momentum stays constant, I still failed combining these formulas together to get the desired $ E=\frac{GMm}{2a}$.
Can someone give me a not-so-hard explanation? I will be very thankful!