Consider an object of mass m at a distance r1 from the Earth's center. Since this object is in the Earth's gravitational field, it possesses gravitational potential energy U1.
Suppose the object moves farther away at a distance r2 such that its potential energy changes to U2.
Following the energy conservation law, the sum of kinetic energy and potential energy at r1 equals the sum of kinetic energy and potential energy at r2.
Considering distance r2 as infinity, where Earth's gravitational field is negligible, the potential energy U2 is zero.
Theoretically, K2 is equal to zero, since the object becomes stationary at infinity. Substituting for kinetic energy and potential energy at r1, the object's velocity at r1 is equal to the square root of two times the product of the gravitational constant and Earth's mass, divided by r1.
Approximating r1 equal to the radius of the Earth, an expression for the object's escape velocity is obtained. It is the minimum initial velocity which an object requires to escape the Earth's gravitational field.
The escape velocity of an object is defined as the minimum initial velocity that it requires to escape the surface of another object to which it is gravitationally bound and never to return. For example, what would be the minimum velocity at which a satellite should be launched from the Earth's surface such that it just escapes the Earth's gravitational field?
To calculate the escape velocity, it is assumed that no energy is lost to any frictional forces. In practice, a satellite launched from the Earth's surface not only has to escape the Earth's gravitational field, but the Earth's atmosphere slows it down as well. Thus, the escape velocity calculated purely from gravitational energy considerations is smaller than the actual escape velocity.
It is also assumed that the satellite has zero velocity at infinity, where the Earth's gravitational force is zero. Since the escape velocity does not depend on the satellite's mass, it would be the same for any object, whether a satellite or a ball.
If an object is at a larger distance from the Earth's surface, for example, the Moon, it would need a smaller velocity to escape the Earth's gravitational field. This is unless the mass is directly heading towards the Earth and collides with it, giving rise to forces that are not just gravitational.
Alternatively, the escape velocity can be calculated by equating the total energy of a system, say the Earth and a satellite, to zero. The gravitational potential energy at large distances is conventionally assumed to be zero. Since the escape velocity is defined as the minimum velocity with which a satellite should be launched from the surface, its kinetic energy at infinity can also be assumed to be zero. Of course, if it is positive, it would go further away and never return. Thus, the velocity of interest is when the kinetic energy at infinity is zero; that is, the body just escapes the gravitational field.
Calculations reveal that the escape velocity from the Earth's surface, assuming no atmosphere, is about 11 km/s. In comparison, the escape velocity from the Sun's gravitational field is about 42 km/s at the Earth's distance. Spacecraft being launched from the Earth to escape the solar system would need to consider both factors.
This text is adapted from Openstax, University Physics Volume 1, Section 13.3: Gravitational Potential Energy and Total Energy.