# Geometric Interpretation of Linear Regression

Original article was published on Artificial Intelligence on Medium # Geometric Interpretation of Linear Regression

## Understand how the cost function of linear regression is derived using geometric interpretation

Linear regression is a linear approach to modeling the relationship between a scalar response (or dependent variable) and one or more explanatory variables (or independent variables). In geometric interpretation terms, the linear regression algorithm tries to find a plane or line that best fits the data points as well as possible. Linear regression is a regression technique that predicts real value.

What does the term “finding plane that best fits the data points” mean?

For the above-given sample 2-dimension dataset (Image 1), the general equation of the line that covers as numbers of points as possible is y = m*x+c, where m is the slope of the line, and c is the intercept term. The linear regression algorithm tries to find a line/plane for which the cost function is minimized. Later in this article, you will know how a cost function is derived.

We will represent the above equation of plane as y = w1*x + w0

Similarly, for sample 3-dimension dataset (Image 3) the equation of the plane which best fits as many points as possible is y = w1*x1 + w2*x2 + w0.

The same equation can be extended for a d-dimension dataset: