MAT 242 Chap.13 Curve Fitting with Linear Algebra
Curve Fitting with Linear Algebra
Unknown coefficients enter linearly
Curve fitting works because the unknowns are the coefficients, not x. In y = ax² + bx + c the unknowns a, b and c appear linearly, so each data point supplies one linear equation.
Three points with different x values determine a parabola exactly, found by inverting a three-by-three matrix whose columns are x², x and 1. The same idea fits any sum of known functions with unknown multipliers, such as combinations of 1/x, cos(πx) and x.
Best fits by least squares
With more points than coefficients an exact fit usually does not exist, so the course takes the least squares solution from the previous chapter.
For a line, the matrix has an x column and a column of 1s, and the result is linear regression. Other models change the columns: a parabola with no constant term drops the 1s, one with no linear term drops the x column.
Curves that are not linear in their coefficients can often be rewritten: taking logarithms linearises exponential and power curves, and a circle becomes linear in its centre and a combined constant.
What earns full credit
The paid chapter fits an exact parabola and a least squares line with figures, then lists the traps that sample solutions penalise: a column that does not match the model, coefficients reported without the final equation, and a projection vector reported in place of the coefficients.
On the Final, answers are exact or carry at least four decimal places, and the fitted equation should be written out in full.
What the Final asks
The Final Exam skills list asks for the best-fitting line, the best-fitting parabola and restricted parabolas without a linear or constant term, and the course applications cover exact fitting through three points.
Sample solutions split credit between building A, building B, finding the coefficients and writing the equation. A clean habit is to write the model with its unknown coefficients in brackets, then read each column of A straight off it.
Transforming a nonlinear model
Some models are not linear in their coefficients but become linear after a change of variables.
For y = C·aˣ, taking logarithms gives ln y = ln C + x ln a, a line in the unknowns ln C and ln a. For a power curve y = a·xᵇ, logarithms give ln y = ln a + b ln x. After fitting, exponentiate to recover the original coefficients, and remember that the fit minimises squared errors in ln y, not in y. The data must have positive y values for the logarithm to exist.
What this chapter covers
- 01
Exact curve fitting through data points
- 02
Models that are linear in their coefficients
- 03
Least squares lines and linear regression
- 04
Restricted parabolas and log transforms
- 05
Fitting a circle
Worked example · free
Best-fitting line through three points
- 2Columns x and 1: AᵀA = [14 6; 6 3] and AᵀB = (11, 5).
- 3Solve: a = (3·11 − 6·5)/6 = 1/2 and b = (14·5 − 6·11)/6 = 2/3.
- 1State the curve: y = 0.5x + 0.6667.
Key terms
- Linear Regression
- Linear regression finds the least squares line through a set of data points.
- Design Matrix
- A design matrix has one column per model term, each evaluated at every data point.
- Exact Fit
- An exact fit is a curve of the chosen type that passes through every data point.
Curve Fitting with Linear Algebra FAQ
Why can a parabola be fitted with linear algebra when it is not a straight line?
The unknowns a, b and c multiply known quantities x², x and 1, so each point gives an equation that is linear in the unknowns, even though the curve itself bends.
How do I fit an exponential curve with these methods?
Take the natural logarithm of both sides so that ln y = ln C + x ln a, fit that line by least squares, then exponentiate the two coefficients to recover C and a.
What is the difference between an exact fit and a best fit?
An exact fit passes through every point and needs as many coefficients as points. A best fit uses fewer coefficients than points and minimises the sum of squared vertical errors instead.
Exam move
Before each fit, write the model with every term's multiplier in brackets. Build A from that line and B from the y values, and the setup errors disappear. Fit the same small data set with a line, a parabola and a restricted parabola, and compare how the columns of A change from model to model.
Working through Curve Fitting with Linear Algebra in MAT 242? Sia is AskSia’s AI Mathematics tutor — ask any MAT 242 Curve Fitting with Linear Algebra question and get a clear, step-by-step explanation grounded in how MAT 242 is taught and assessed. Read this chapter free, then take your hardest questions to Sia.