These are mainly notes to myself (i.e., Siddhartha Gadgil) but are shared in case they are useful.
Consider a collection of points in the plane, or more generally in $R^n$. In many cases, we want to find the line that is closest to this collection of points - or more generally the plane, or affine space of a fixed dimension. Two common reasons for this are: