Minimizing loss for a linear regression

From exercise 4 onwards we are supposed to find the minimal loss above all date with the given functions. though that works I wonder why we don´t use another mathematical approach which seems to give the “right” values without any trial any error when it comes to iterations and so on… I did, while I was do a deeper study for this chapter, solved it with the method of least squares, using the quadratic polynomial that’s derived from the given lists and can then be partially derivated with respect to m and b, hence giving us two equations we can solve to find the exact values for m and b for any given list of x and y values.

From my point of view this looked a bit more accurate and more general to approach and solve this problem, though it was a bit tricky to put things together and using the necessary python modules.