Igneous rocks are sometimes considered primary rocks because they crystallize from a liquid. In that case, sedimentary rocks are derived rocks because they are formed from fragments of pre-existing rocks.
Sedimentary rocks are the product of 1) weathering of preexisting rocks, 2) transport of the weathering products, 3) deposition of the material, followed by 4) compaction, and 5) cementation of the sediment to form a rock. The latter two steps are called lithification.
When rocks (igneous, sedimentary, or metamorphic) are at or near the surface of the earth they are exposed to the processes of weathering.
In mechanical weathering rocks are broken up into smaller pieces by frost-wedging (the freezing and thawing of water inside cracks in the rock), root-wedging (tree and other plant roots growing into cracks), and abrasion caused by, for example, sand-blasting of a cliff face by blowing sands in the dessert, or the scouring of water transported sand, gravel, and boulders on the bedrock of a mountain stream. Mechanical weathering breaks rocks into smaller and smaller pieces but without otherwise altering the minerals.
In chemical weathering minerals are changed into new minerals and mineral byproducts. Some minerals like halite and calcite may dissolve completely. Others, especially silicate minerals, are altered by a chemical process called hydrolysis. Hydrolysis is the reaction of minerals in weakly acidic waters. Most natural surface waters are slightly acidic because carbon dioxide from the air dissolves in the water. Some of the dissolved CO2 reacts with the water forming the chemical compound carbonic acid.
Complete weathering of silicate rocks will yield:
2) quartz sand (if the rock originally contained quartz)
3) soluble silica
4) metal cations
Rock fragments will also remain where the rocks are not completely weathered.
Not only is quartz the most stable of the common rock forming minerals in chemical weathering, its high hardness and lack of cleavage make it quite resistant to mechanical weathering. Quartz is itself an agent of mechanical weathering in the form of blowing dessert sand.
As the process of weathering proceeds the products are carried off. The most important transporting agent is water. Water carries or rolls particles in rivers, from the smallest suspended clay particles to the largest boulders. Boulders and smaller rock fragments continue to be broken up and chemically altered as they tumble downstream. Water also carries dissolved minerals, such as silica and cations downstream as well as in the groundwater. Other transporting agents include wind which blows dust and sand, glaciers, which carry large amounts of gravel and huge boulders in addition to smaller particles, and mass wasting on hillslopes. In addition to decreasing the particle size, as sedimentary material is transported it is also sorted into similar sized particles as a result of changing energy (velocity) in the transporting medium (water or wind), and rounded by continued abrasion.
Sediments are transported only when there is enough energy in the transporting medium, for example, when a stream is flowing rapidly enough to carry a given size of sedimentary particle. Steep mountain streams can move large boulders during spring flood but these boulders will never be transported out into a placid lowland river. So the largest sediments (boulders, cobbles, and pebbles) which survive the weathering process, tend to be deposited near to their source, for example at the point where a mountain stream flows out onto a valley floor. Sediments of a given size are deposited whenever they move into an environment with insufficient energy to transport them. For example, silt carried by a flooding river will settle out in the quiet backwaters outside the river banks (perhaps enriching someone's farmland - while wrecking their home).
Sediments are deposited layer upon layer. The layers are deposited horizontally.
Sorting. When a river encounters the ocean it begins to deposit its suspended sediments. Progressively finer sediments are deposited moving away from the shoreline. All fine materials are winnowed out leaving sands in the wave-dominated beach and nearshore environment. The sands remain in this high energy environment. In deeper/calmer water silt settles out. In water deep enough not to be affected by surface wave action the clay fraction begins to settle out.
The dissolved load in water will precipitate out (crystallize) if it encounters a supersaturated environment. Gypsum, halite, and other salts, precipitate out of seawater in arid areas, like the eastern Mediterranean, where evaporation is high (thus increasing the salinity) and influx of fresh seawater is low.
Compaction and Cementation
As sedimentation continues, the earlier deposited sediments are laden with an increasing overburden. They are compacted, reducing the available pore space and expelling much of the pore-water.
Dissolved minerals in the ground water precipitate (crystallize) from water in the pore spaces forming mineral crusts on the sedimentary grains, gradually cementing the sediments, thus forming a rock. Calcite (calcium carbonate), silica, and hematite (red iron oxide) are the most common cementing agents. You may be familiar with calcite (or lime) encrustation on old plumbing fixtures, showerheads, and inside hot water heaters.
Sedimentary rocks may be divided into three basic categories:
1) Clastic (detrital) sedimentary rocks are composed of the solid products of weathering (gravel, sand, silt, and clay) cemented together by the dissolved weathering products.
2) Biogenic (biochemical) sedimentary rocks are those composed of materials formed by the activity of living organisms such as coal (compacted undecayed plant matter) and many limestones which are made up of the shells or other skeletal fragments from marine organisms.
3) Chemically precipitated (chemical) sedimentary rocks are those such as halite and gypsum, and some limestones, which form direct precipitation (crystallization) of the dissolved ions in the water.
Clastic Sedimentary Rocks
Clastic sedimentary rocks may first be classified according to their grain size. Clay-sized particles are too small to be seen with a microscope. Rock formed from clay-size particles are called shale. Silt-sized particles are visible with a microscope. Rock formed from these are called siltstone. Sand-sized grains are visible to the naked eye and range from 1/16 mm to 2 mm. Sand is further subdivided into very fine, fine, medium, coarse, and very coarse. Rock formed from these are called sandstone. "Gravel"-sized grains range from > 2 mm granules to very large boulders. Rock containing these large size particles are called conglomerate and are typically very poorly sorted (e.g., they may contain, sand, gravel, and boulders all in one rock). If the gravel particles are little weathered and are still angular (un-rounded) the rock is called breccia.
Biogenic Sedimentary Rocks
Carbonate Rocks (based on CO3). While some carbonate rocks form as simple chemical precipitates most carbonate rocks are the product of marine organisms such as molluscs and corals. They precipitate calcite (calcium carbonate, CaCO3) or other similar carbonate minerals directly from the dissolved chemicals in the water to create their shells. Limestone is the product. At some later time (e.g.,. after burial) calcite may be transformed into dolomite, CaMg(CO3)2. Calcite will react vigorously with dilute hydrochloric acid (HCl). Powdered dolomite will react sluggishly with HCl.
Coal is also formed by biological activity but in this case the material is organic matter from decaying plants that may accumulate if plant growth is faster than the rate of decay. The organic matter will be buried and compacted by layer upon layer of partially decayed plants, eventually becoming coal.
Chemically Precipitated Sedimentary Rocks
Where the dissolved ions encounter supersaturated conditions they come out of solution and combine together forming an orderly arrangement of atoms (that's right - minerals). They are said to precipitate - go from the liquid, dissolved state to the solid crystal state. Rocks formed in this way include halite, gypsum, anhydrite, and some limestones. Layers of precipitated rocks are called evaporite deposits because they typically form where evaporation is high in arid regions like the desert southwest and in the eastern Mediterranean. Salt flats in the desert southwest and elsewhere contain vast deposits of chemically precipitated layers that formed as spring runoff from the surrounding mountains carried dissolved ions out onto the flats where the waters then evaporated in the summer sun, leaving behind the salts.
Most sedimentary rocks contain internal layering called bedding or stratification. Stratification may range from a bed thickness of many meters down to fine millimeter-size laminations. Bedding is generally horizontal or nearly so.
Internal stratification within a larger bed may be parallel or there may be cross-stratification caused by ripples, sand bars, and dune structures. Ripple marks, a few millimeters to centimeters in size, are common features in water laid sediments. Large scale cross-bedding in sandstone, within horizontal layers a few to many feet thick, indicates deposition in sand dunes.
Ripple marks indicate deposition in a current. Assymetric ripples (one side steeper than the other) indicates a consistent current direction as in streams. Symetric ripples indicate oscillating (waves) or weak currents.
Mudcracks are produced by drying of wet muds. Raindrop impression may also be preserved in sediments. They indicate deposition in a terrestrial setting.
Fossils are very important indicators of depositional environment. Fossils include preserved skeletal fragments, plant roots, etc., and also trace fossils such as burrows, footprints, leaf impressions, etc. Coral and many shell fossils indicate marine deposition. Leaves indicate terrestrial deposition.