An earthquake causes shaking of ground. So a building resting on it will experience motion at its base. From Newton’s first law of motion, even though the base of the building moves with the ground, the roof has a tendency to stay in its original position. But since the walls and columns are connected to it, they drag the roof along with them.
This is much like the situation that you are faced with when the bus you are standing in suddenly starts, your feet move with the bus, but your upper body tends to stay back making you fall backwards!
This tendency to continue to remain in the previous position is known as inertia. In the building since the walls or columns are flexible, the motion of roof is different from that of ground.
Consider a building, whose roof is supported on columns. Coming back to the analogy of yourself on the bus; when the bus suddenly starts, you are thrown backwards as if someone has applied a force on the upper body. Similarly, when the ground moves, even the building is thrown backwards, and the roof experiences a force, called inertia force. If the roof has the mass M and experiences an acceleration a, then from Newton’s second law of motion, the inertia force F1 is mass M times acceleration a, and its direction is opposite to that of the acceleration.
“More mass means higher inertia force”