Linear regression is a supervised learning algorithm which means that we need to have a labeled data set that we can use to train the model.

Linear regression is used to solve regression problems so it must be used to predict a numerical values (as opposed to a classification algorithm).

Linear regression is used when we assume that there is a linear relationship between the independent variables (= features = predictors = input variables = x) and the dependent variable (= output variable = response = target variable = y).

Good materials:

https://towardsdatascience.com/gradient-descent-in-python-a0d07285742f