Demystifying Linear Regression: From Basic Equations to Loss Functions