The most accepted theory of how these structures came to be is that all the structure we observe today was formed as a consequence of the growth of the primordial fluctuations, which are small changes in the density of the universe in a confined region. As the universe cooled clumps of dark matter began to condense, and within them gas began to condense. The primordial fluctuations gravitationally attracted gas and dark matter to the more dense areas, and thus the seeds that would later become galaxies were formed. These structures constituted the first galaxies. At this point the universe was almost exclusively composed of hydrogen, helium, and dark matter. Soon after the first proto-galaxies formed the hydrogen and helium gas within them began to condense and make the first stars. Thus the first galaxies were then formed. Recently using the Keck telescope, a team from California Institute of Technology found six star forming galaxies about 13.2 billion light years (light travel distance) away and therefore created when the universe was only 500 million years old.
The universe was very violent in its early epochs, and galaxies grew quickly, evolving by accretion of smaller mass galaxies. The result of this process is left imprinted on the distribution of galaxies in the nearby universe (see image of 2dF Galaxy Survey). Galaxies are not isolated objects in space, but rather galaxies in the universe are distributed in a great cosmic web of filaments. The locations where the filaments meet are dense clusters of galaxies, that began as the small fluctuations to the universe. Hence the distribution of galaxies is closely related to the physics of the early universe. Despite its many successes this picture is not sufficient to explain the variety of structure we see in galaxies. Galaxies come in a variety of shapes, from round featureless elliptical galaxies to the pancake-flat spiral galaxies.
Some notable observed features of galaxy structure (including our own Milky Way) that astronomers wish to explain with galactic formation theories include (but are certainly not limited to) the following:
Preliminary results from the Galaxy Zoo project suggested that there was an unexplained parity violation, with a greater proportion of the galaxies rotating in an anticlockwise direction when seen from the Earth. This was later shown to be a result of human bias: when a subset of classified images were mirrored (so that galaxies rotating in an anticlockwise direction appeared to be rotating in a clockwise direction), anticlockwise classifications still predominated.
The key properties of disk galaxies, which are also commonly called spiral galaxies, is that they are very thin, rotate rapidly, and often show spiral structure. One of the main challenges to galaxy formation is the great number of thin disk galaxies in the local universe. The problem is that disks are very fragile, and mergers with other galaxies can quickly destroy thin disks.
Olin Eggen, Donald Lynden-Bell, and Allan Sandage in 1962, proposed a theory that disk galaxies form through a monolithic collapse of a large gas cloud. As the cloud collapses the gas settles into a rapidly rotating disk. Known as a top-down formation scenario, this theory is quite simple yet no longer widely accepted because observations of the early universe strongly suggest that objects grow from bottom-up (i.e. smaller objects merging to form larger ones). It was first proposed by Leonard Searle and Robert Zinn that galaxies form by the coalescence of smaller progenitors.
More recent theories include the clustering of dark matter halos in the bottom-up process. Essentially early on in the universe galaxies were composed mostly of gas and dark matter, and thus, there were fewer stars. As a galaxy gained mass (by accreting smaller galaxies) the dark matter stays mostly on the outer parts of the galaxy. This is because the dark matter can only interact gravitationally, and thus will not dissipate. The gas however can quickly contract, and as it does so it rotates faster, until the final result is a very thin, very rapidly rotating disk.
Astronomers do not currently know what process stops the contraction, in fact theories of disk galaxy formation are not successful at producing the rotation speed and size of disk galaxies. It has been suggested that the radiation from bright newly formed stars, or from an active galactic nuclei can slow the contraction of a forming disk. It has also been suggested that the dark matter halo can pull the galaxy, thus stopping disk contraction.
In recent years, a great deal of focus has been put on understanding merger events in the evolution of galaxies. Our own galaxy (the Milky Way) has a tiny satellite galaxy (the Sagittarius Dwarf Elliptical Galaxy) which is currently gradually being ripped up and "eaten" by the Milky Way, it is thought these kinds of events may be quite common in the evolution of large galaxies. The Sagittarius dwarf galaxy is orbiting our galaxy at almost a right angle to the disk. It is currently passing through the disk; stars are being stripped off of it with each pass and joining the halo of our galaxy. There are other examples of these minor accretion events, and it is likely a continual process for many galaxies. Such mergers provide "new" gas stars and dark matter to galaxies. Evidence for this process is often observable as warps or streams coming out of galaxies.
The Lambda-CDM model of galaxy formation under predicts the number of thin disk galaxies in the universe. The reason is that these galaxy formation models predict a large number of mergers. If disk galaxies merge with another galaxy of comparable mass (at least 15 percent of its mass) the merger will likely destroy, or at a minimum greatly disrupt the disk, yet the resulting galaxy is not expected to be a disk galaxy. While this remains an unsolved problem for astronomers, it does not necessarily mean that the Lambda-CDM model is completely wrong, but rather that it requires further refinement to accurately reproduce the population of galaxies in the universe.
The most massive galaxies in the sky are giant elliptical galaxies. Their stars are on orbits that are randomly oriented within the galaxy (i.e. they are not rotating like disk galaxies). They are composed of old stars and have little to no dust. All elliptical galaxies probed so far have supermassive black holes in their center, and the mass of these black holes is correlated with the mass of the elliptical galaxy. Elliptical galaxies do not have disks around them, although some bulges of disk galaxies look similar to elliptical galaxies. One is more likely to find elliptical galaxies in more crowded regions of the universe (such as galaxy clusters).
Astronomers now see elliptical galaxies as some of the most evolved systems in the universe. It is widely accepted that the main driving force for the evolution of elliptical galaxies is mergers of smaller galaxies. These mergers can be extremely violent; galaxies often collide at speeds of 500 kilometers per second (over 1 million miles per hour).
Many galaxies in the universe are gravitationally bound to other galaxies, that is to say they will never escape the pull of the other galaxy. If the galaxies are of similar size, the resultant galaxy will appear similar to neither of the two galaxies merging. An image of an ongoing merger of equal sized disk galaxies is shown left. During the merger, stars and dark matter in each galaxy become affected by the approaching galaxy. Toward the late stages of the merger, the gravitational potential, the shape of galaxy, begins changing so quickly that star orbits are greatly affected, and lose any memory of their previous orbit. This process is called violent relaxation. Thus if two disk galaxies collide, they begin with their stars in an orderly rotation in the plane of the disk. During the merger, the ordered motion is transformed into random energy. And the resultant galaxy is dominated by stars that orbit the galaxy in a complex, and random, web of orbits. And this is what we see in elliptical galaxies, stars on random unordered orbits.
Mergers are also locations of extreme amounts of star formation. During a merger some galaxies can make thousands of solar masses of new stars each year, which is large compared to our galaxy which makes about 1 new star each year. Though stars almost never get close enough to actually collide in galaxy mergers, giant molecular clouds rapidly fall to the center of the galaxy where they collide with other molecular clouds. These collisions then induce condensations of these clouds into new stars. We can see this phenomenon in merging galaxies in the nearby universe. Yet, this process was more pronounced during the mergers that formed most elliptical galaxies we see today, which likely occurred 1-10 billion years ago, when there was much more gas (and thus more molecular clouds) in galaxies. Also, away from the center of the galaxy gas clouds will run into each other producing shocks which stimulate the formation of new stars in gas clouds. The result of all this violence is that galaxies tend to have little gas available to form new stars after they merge. Thus if a galaxy is involved in a major merger, and then a few billion years pass, the galaxy will have very few young stars (see Stellar evolution) left. This is what we see in today's elliptical galaxies, very little molecular gas and very few young stars. It is thought that this is because elliptical galaxies are the end products of major mergers which use up the majority of gas during the merger, and thus further star formation after the merger is quenched.
In the Local Group, the Milky Way and M31 (the Andromeda Galaxy) are gravitationally bound, and currently approaching each other at high speed. If the two galaxies do meet they will pass through each other, with gravity distorting both galaxies severely and ejecting some gas, dust and stars into intergalactic space. They will travel apart, slow down, and then again be drawn towards each other, and again collide. Eventually both galaxies will have merged completely, streams of gas and dust will be flying through the space near the newly formed giant elliptical galaxy. M31 is actually already distorted: the edges are warped. This is probably because of interactions with its own galactic companions, as well as possible mergers with dwarf spheroidal galaxies in the recent past - the remnants of which are still visible in the disk populations.
While we have learned a great deal about ours and other galaxies, the most fundamental questions about formation and evolution remain only tentatively answered.