If our dataset is set in stone, then this total cost is determined by the slope and intercept of our fit line, and we can find the “best fit” by finding the slope and intercept that minimize the total cost. Because the cost of a residual is its square, this is called “least squares fitting,” and it is by far the most common way to fit lines and other curves.