How do you plot the least squared line?

We plot the least squared line using the following steps:

  • Calculate the sum of residuals
  • Differentiate it with respect to slope and intercept
  • Equate the resulting equations with zero and the corresponding values of slope and intercept