When a river runs over alternating layers of hard and soft rock, rapids and waterfalls may form.
Waterfalls commonly form where water rushes down steep hillsides in upland areas and quickly erodes the rocks. The height and number of waterfalls along a stream or river depends upon the type of rocks that are being eroded by the water. Some types of rocks (shale, for example) wear away more easily than others (such as sandstone or limestone).
As the river or stream wears away the weak rocks, they travel across the surface of stronger rocks. These more resistant rocks become the capstones to waterfalls. The number and thickness of these stronger rock units in a vertical sequence of rocks controls how many water falls there are and how much vertical drop there is on each waterfall.
source
The diagram above shows the formation of a waterfall. Soft rock is undercut (1). This leaves a layer of hard rock which overhangs the layer of soft rock (2). The water flows over the overhang and creates a plunge pool in the soft rock below (3). Eventually the overhang will collapse due to the erosion of the soft rock beneath it. The waterfall then retreats up stream (4). This creates a steep, gorge-like