Linear regression with straight lines

Linear regression is a widely used mathematical technique in which a certain function (often a straight line or polynomial) is used to fit a set of data or raw measurements, showing a correlation between 2 or more variables. The idea is that we choose a certain function which represents a measure of the error between the “line of best fit” and the actual data, and then we use techniques from Calculus to minimize that error by choosing the most optimum parameters for that line of best fit. In this article, I will walk the reader through the mathematics of linear regression with straight…