 So to recap our least squares method, to minimize the distance AX-B, we can solve the equation A transpose AX equals A transpose B. Now what makes this approach useful is that we can apply our least squares method to other types of functions, any polynomial, exponential functions, and power functions. For example, maybe we want a quadratic function that best matches a given set of data. So we'll assume a function of the form f of x equals A1x squared plus A2x plus A3, where the AIs are the unknowns, and we know our inputs and our observed outputs, and we want the quadratic function to produce the observed outputs from the observed inputs. And so we can obtain our coefficient matrix A, our column vector of the unknowns A1, A2, A3, and our constant vector of the outputs. And we want to minimize AX minus B, and we can do this by solving A transpose AX equals A transpose B. So let's find A transpose A, A transpose B, now we can row-reduce the augmented coefficient matrix, and that gives us our solutions for A1, A2, and A3. And since those are the coefficients of our best fit function, we can write down our best fit function. But an exponential function, let's find an exponential function that best fits a set of data. So again, we'll assume a function of the form f of x equals A1e to power A2x, where the AIs are the unknowns. We want our exponential function to give us the output values, except there's a problem. We do not have a system of linear equations. And because this is linear algebra, we can't handle nonlinear equations. So what can we do? To get a system of linear equations, we can hit it with a log. So let's consider this first equation, A1e to power 2A2 equals 5. If I hit both sides with a log and simplify, I get something that is a linear equation if we think about our unknowns as being log of A1 and A2. And similarly, I can rewrite all of the other equations by hitting them with a log. And so I get my coefficient matrix. Remember, log of A1 is our variable. So the coefficients in this column are all ones. The coefficients in the other columns are the coefficients of A2. Our column vector of variables are log of A1 and A2. Our column of constants are the log values. And we want to solve A transpose Ax equals A transpose B. So let's find A transpose A, A transpose B, and let's row reduce the augmented coefficient matrix, which will give us the solution. And the thing to remember here is that what we're actually solving for are log of A1 and A2. So we know that the log of A1 is about 0.3055. And so that means A1 is e to this value about 1.3574. And so that gives us our best fit exponential function. And we can do something similar if we want a power function. That's a function of the form y equals Ax to power n. So we want our function to give us the output values. And again, these aren't linear equations, but we can hit them with a log. And notice that our unknowns are now log of A and n. So we can write our coefficient matrix A, our column vector of variables x, our matrix of constant values. So we need to find A transpose A, A transpose B, row reducing our augmented coefficient matrix gives us. And again, remember we're actually solving for log of A and n. So we know what log of A is. So that means we know what A is. And that gives us our best fit function.