University Year 2 Mathematics ยท Numerical least squares
Let's begin
Use QR methods for stable fitting.
One step at a time. Answers stay hidden until you have had a go.