Great question — the answer has to do with the amount of material in the universe and the type of material. It turns out that if you look at how fast the matter which makes up the universe is moving that it leads to collapsed objects which have the mass and size of galaxies. If there were less mass or a different form of mass, we would not have the same types of galaxies we have now.
Comments