Astronomy, astrophysics and cosmology are three closely related fields of study and are confused to be same. There is a difference between the domains and goals of the study of the three fields. Let us find out what it is.
Astronomy is defined as "The science which treats of the constitution, relative positions, and motions of the heavenly bodies; that is, of all the bodies in the material universe outside of the earth, as well as of the earth itself in its relations to them."
So astronomy deals with the observation of various celestial phenomenon which includes predicting the planet positions, eclipses, path of comets, meteor showers etc. Beyond solar system, astronomy talks about nebulae, stars and galaxies and predicts their position and provides their spectrum (X-ray, Radio, Gamma, Infrared etc.). Astronomy mainly focuses on celestial mechanics and optics to learn the positions and composition of some celestial objects.
Astrophysics is defined as "the branch of astronomy that employs the principles of physics and chemistry to ascertain the nature of the astronomical objects, rather than their positions or motions in space."
So when you apply rigorous laws of physics to celestial objects, you enter the regime of astrophysics. Astrophysics studies the Sun, stars, interstellar medium, galaxies and the cosmic microwave background. Astrophysicists examine the electromagnetic spectrum collected from their spectrometers and deduce the physical and chemical properties of the celestial object. An astrophysicist uses major subjects of physics to decode the universe. Statistical mechanics, quantum mechanics, general relativity, thermodynamics, electrodynamics, nuclear and particle physics are the tools of an astrophysicist to unravel the secrets of the universe.
Cosmology is defined as "the study of the origin, evolution, and eventual fate of the universe."
Cosmology studies the universe on a larger scale. It studies the universe as a whole. Physical cosmology is studied by scientists, such as astronomers and physicists, as well as philosophers, such as metaphysicians, philosophers of physics, and philosophers of space and time. Because of this shared scope with philosophy, theories in physical cosmology may include both scientific and non-scientific propositions, and may depend upon assumptions that cannot be tested. Cosmology differs from astronomy in that the former is concerned with the Universe as a whole while the latter deals with individual celestial objects.