This work presents the exact analytical formula for calculation of the longitudinal chromatic aberration of a lens, in contrast with the approximate nature of the traditional approach based only on the dispersion of the optical material. This formula additionally takes into account the radii of curvature of the lens surfaces, lens thickness, object and image distances, and the chromatic aberration of the previous optical system. The presented formula is used for the derivation of rigorous equations for color correction of simple lens systems. To test them, this work presents examples of achromatic and apochromatic lenses that are designed by solving these equations. These results prove the usefulness of the presented approach for color correction and open the way for a broad and rigorous study of chromatic aberrations in various optical systems.