MAT 233 -- Linear Algebra

Mini-Activity on Curve Fitting


Here's a first look at an application of linear algebra to something very useful and popular: fitting trendlines through scatterplots of data.

Suppose you have the points (1,10) and (2, 12) in the xy-plane.


Is it possible to find a line that passes through these two points? If so, how many such lines are there? (Hint: This is easy.)

Is it possible to fit a parabola through these two points? If so, how many such parabolas are there? (Hint: This is also pretty easy if you visualize it.)

Let's find one of those parabolas. A parabola has the form

where a, b, and c are numbers. If we can find the numbers, we have found our parabola. Suppose a parabola passes through the two points above. What y-value do you get when you plug in x = 1? What y-value do you get when you plug in x = 2? Use the results to set up a linear system with two equations and three unknowns (namely, the unknown values of a,b and c). Use MATLAB to find the general solution for this system, and give a particular solution by choosing a value of the free variable.

Now, in addition to (1,10) and (2,12), suppose our parabola should also go through (3,9). Add a new equation into your linear system so that there are now three equations and three unknowns. Use MATLAB to solve the system; is it consistent? How many solutions?

Now suppose that we are adding a fourth point, the point (4,5). Add a fourth equation into the system. Is it consistent? Is it possible to put a parabola through these four points?

Would it be possible to fit a cubic polynomial through these four points?