Earthquakes occur when built-up strain within the Earth is released, causing rocks below the surface to suddenly move. This movement releases energy that travels through the Earth in the form of seismic waves. There are three main types of seismic waves: P-waves, which are compression waves that move fastest; S-waves, which are slower shear waves that move the ground from side to side; and surface waves, which cause up and down motion and travel along the Earth's surface. Seismographs are used to detect and measure these different seismic waves to study earthquakes.