To understand Ridge Regression we first need to get through the concept of Regularization.
Regularization: There are two types of Regularization, L1 regularization & L2 regularization. L1 regularization adds an L1 penalty equal to the value of coefficients to restrict the size of coefficients, which leads to the removal of some coefficients. On the other hand, L2 regularization adds a penalty L2 which is equal to the square of coefficients.
Using the above method Regularization solves the problem of a scenario where the model performs well on training data but underperforms on validation data.