An introduction to galaxies and cosmology