The mechanical energy of the roller coaster is sum of kinetic energy K and gravitational potential energy U:

where

is the kinetic energy

is the gravitational potential energy
Since the ride is frictionless, the total mechanical energy E is conserved during the ride. Therefore, at the top of the hill, the potential energy is maximum, because h (the height) is maximum, and this means the kinetic energy is minimum (because the sum of K and U is constant), so the velocity will be minimum. Viceversa, at the bottom of the hill, the potential energy will be minimum (because h is minimum), so the kinetic energy K will be maximum, and the velocity v of the roller coaster will be maximum.