# different ways to calculate satellite height

I found 2 formulas for calculating height. First is:

height = magnitude(satillate_position_vector) - Earth_radius


Second is:

height = Semimajor_axis * (1 - eccentricity) - Earth_radius


Which of them is correct for calculation? And if them both correct then which of these formulas is used for. Because results are different even if I use satillate_position_vector for calculating orbital elements like Semimajor_axis and eccentricity.