An earthquake is caused by a sudden slip on a fault. The tectonic plates are always slowly moving, but they get stuck at their edges due to friction. When the stress on the edge overcomes the friction, there is an earthquake that releases energy in waves that travel through the earth's crust and cause the shaking that we feel.
How are earthquakes measured?
earthquakes is measured on the Richter scale,
What does magnitude mean?
The great size or extent of something
How is magnitude measured?
The Richter scale assigns a magnitude number to an earthquake based on the maximum amplitude of the seismic waves as recorded on a seismometer and the distance of the seismometer station from the epicenter of the earthquake.
P waves are primary seismic waves. They are the fastest seismic waves and they are compression or longitudinal waves, which means the to-and-fro movement of the particles is in the same direction as the wave is traveling. There is an illustration and explanation in the reference below. P waves can propagate through any medium. (solid. liquid or gas)
How do S waves travel?
As these waves move, they displace rock particles outward, pushing them perpendicular to the path of the waves. This results in the first period of rolling associated with earthquakes. Unlike P waves, S waves don't move straight through the earth. They only travel through solid material, and so are stopped at the liquid layer in the earth's core.