Welcome to our lecture on Linear Approximation. This idea is fundamental to the concepts of Calculus that you can approximate something with a line that if you zoom in close enough, everything is linear. This is wonderful. We're going to use the tangent line, nothing new here, just a application of our knowledge before. Let's try to motivate this with a picture first before we get into the equations. Consider some function, it's doing its thing, f of x. Let's say we want to study a very specific point a. We know from calculus and otherwise we know how to find hopefully at this point, that if I take the point value of the function at f of a, letÂ´s just call this f of a given the label, then I can draw a tangent line to this curve at the point assuming the function is differentiable; and of course, we know by now that the slope of this tangent line is in fact the derivative plugged in at a, it's very importantly plugging at a. Now, if I want the equation of this line, an old question with a new twist, the equation of the tangent line; I have a point, I have a comma f of a, and I have a slope f prime of a, horizontally abstract. Then I can use the point-slope formula. A friendly reminder with the point-slope formula says, " y minus y naught equals m, x minus x naught". In this context, the y value is f of a, the x value is a, and my slope is the derivative. If I want the equation of this tangent line, I write some things. I say, " y minus the y value f of a is equal to the slope f prime of a, x minus a". Remember, a is the given point, the function is all given, so most of these things are numbers. What you can do is, through a little rearranging, if you add f of a to both sides, you get that y is equal to f of a plus f prime of a, x minus a. This y value, remember this represents the function. This is true for the line, this is on the line; but if you look and kind of zoom in and imagine we were to zoom into this picture, as long as you stay near the point a, the line is pretty close or pretty good approximation of the curve f of x. We'll write this as saying the curve f of x, the y value now of the actual graph that we're studying is close, not equal, there is some gap, you can kind of see it in my picture that there is some gap of the tangent line to the curve to f of a plus f prime of a. So from the function you create the tangent line and then from the tangent line you get information about the curve. Now this is only going to be good if you stay near a. Let's just put that disclaimer in: for x near a. The further away you get, then you're going to have more and more error and depending on your tolerance, you can go as far away as you want, but just keep that in mind. Okay. Let's do an example to sort of put this behind, but this is our formula. There is nothing really you haven't seen before, this is just the point-slope formula. They call this the Linearization or the linear approximation. Call it wherever you want, give it a fancy name but this is the linear approximation and sometimes they write this with an L, just so you say the linear approximation and now once you call it linear approximation, you don't have to use the approximation symbols; so you have f of a plus f prime of a. There it is, write it down, put it down; this is point-slope formula. It's beautiful. Let's do a problem with it on the next slide. Find the linearization or find the linear approximation, pick your favorite way to say this concept, this idea, of f of x is the square root of x at a equals 1. Linearization, remember everything here, we're taking derivatives. What's the idea? The square root graph we know and love goes off something like this: y equals square root of x, starts at the origin, slowly arcs its way to infinity, we pick one. The square root of one is just one, so at the value one, then if we draw the tangent line at the point one, linearization basically says: " What is the equation of this tangent line? " We have our formula, I'll just put it down again so we have it: the linearization is the function plugged in at the given value plus the derivative plugged in at the value, and then x minus the value. X is a variable, so we'll leave x, we find everything else. So what do I need? I need to find f of a, for this case, it's the square root of x and a is 1; so we'll evaluate this at x equals 1. Well, that's the square root of one, that's just one. Then I have the derivative and I also have to plug in here, so let's get the derivative plugged in at x equals a, which is one. Square root is x to the one half; do your thing, bring the one half down x to the minus one half. Here's the plug-in. It's a little weird to write minus one half. You could think of it as one over two root x. The most important thing here is to plug in, a lot of students forget to plug in. Square root of one is one, so you just get a half. At that point, everything's done, so we can go back and find the linearization, which is the output 1 plus the number, dev prime of a, half x minus, and then plug in a is 1 again. This is a line. If you look at this thing, this is going to be mx plus b after you rearrange some things and move it around. You get 1 plus one-half x minus a half. Clean that up, one-half, then one minus a half, so there it is. This is the equation of a line. It's pretty amazing that we're finding the equation of the line at this point. But it's a very special line that takes a lot of work to find, and this is the tangent line. Once you have this, this line then can approximate the function. You can imagine maybe part b of this question, I'll put over here in the corner. Part b says, "Let's approximate 0.98. I would imagine most of us do not know the square root of 0.98. If I asked you to find this number, we will run off to our calculators. Through the magic of technology, you'd have no idea how the calculator does it, but it would kick back a decimal number you'd be like, there's the answer. What we're doing here is looking under the hood. We want to have some idea of what's going on. How is this thing finding that decimal approximation? If you notice I picked a number 0.98. 0.98 is close enough to one, so we're just a little bit before one. I can use the linearization that I found at one. Notice if I picked different values of a, I get different linearizations, the tangent line moves on. We're going to let x equal 0.98, and I want to approximate the function, I'm going to use a linearization at 0.98. The idea is I have no idea where to start, I could try to guess and check and do 0.98, this is square root and try to find some numbers. But instead, to make life much easier, I will do one-half of 0.98. I can do that, plus one-half. I can convert this all to fractions, I can convert this all to decimals. Maybe it's easier if I plug it in up here to the first one. Just because I'm trying to make a point here that we don't need a calculator. So 1 plus one-half, 0.98 minus 1 is negative 0.02. One minus 0.01, so that's 0.99. My guess without a calculator is that the square root of 0.98 is about 0.99. Notice I get two decimals here because I started off with two decimals, that'll usually happen. If you go and check this with the calculator. Let's see if Calculus is actually true, if everything I've been saying, I've been lying to you all this time, if you grab a calculator, which you should, keep it handy for this video, it's good to check. Take the square root of 0.98, you will actually get that the true answer by the calculator is 0.99, which is good 4, 9 and change, dot-dot-dot, it goes on for a while. But you can tell up to two significant digits we're pretty accurate. This is nice in a nice way to see the approximation. It is going to be a little off and you can tell because there's a gap between the tangent line and the actual curve itself. Let me show you an application to this when we're working with data. If I have a bunch of data points in a table. Here we have the following table presents the median home prices P in thousands of dollars from 2001-2010 according to the US Census Bureau. Here's some real data. I remember these are in thousands of dollars, in 2001, I had a $175,000 dollars, 2002, $187,000 dollars, 2003, $195,000 dollars, 2004, $221,000 dollars, and so on. I have all the way from 2001-2010. When you get data discreetly and you have all these tools of calculus that applies to continuous functions, you'd like to fit the model. There's a whole process of what model fits this best. But for no good reason, we're going to pick a model of degree 4. We're going to do a degree 4 polynomial. To fit the mode, you can write this as 0.17, 2001 to the fourth, so there's your degree 4. This is called a quartic, by the way, quartic to four. As usual, when you work with not-so-nice numbers, you get some not so nice numbers back and you could tell them running out of room here, so there's a long formula. Just started off a little left. I used RStudio to get this approximation, but you can pick your favorite one. You get 0.17 parentheses, y minus 2001 to the fourth minus 3.2 parentheses y minus 2001 to the cube, cubed minus 16.7, y minus 2001 squared, minus 10.9 y minus 2001. It is gross, but it is what it is, and when you graph this thing you get a scatter plot with a little bit of a trend line. So whether degree four or not was the right thing to use, probably not, but it's just one of them to use and you can argue what is the best fit. So the idea is this is a nasty function, it's tough to work with, and I'd rather work with something easier. I'd like to find now based on this thing, the linear approximation of the function in the year 2002. So what's happening at the tangent line right around 2002? Let's go ahead and find this approximation. I need a couple of informations from it. Here's our question, using the quadratic approximation, find a linear approximation of p of y, the prices when y is 2002. I have to do some things I need to plug in 2002 into the given function to obtain the output at 2002. I need the y-value, remember, linear approximation is found by taking the y-value. This is like y1 plus the slope f prime of x, x minus a. To find p of 2002, I plug this into the gross formula and you can check me on this, you actually get 180.47. That's coming from the quadratic approximation. Now I find the derivative of this function. I need to differentiate my function and plug in 2002. Now in this setting, the variable y that I'm using here, because it's years, of course this represents the variable x, the independent variable. I have to use the power rule or maybe the general power rule, chain rule going on to find the derivative. But when you do this, if you take the derivative, you use the y-variable, you get and you can check this, you're going to need a calculator for this, 0.68y minus 2001 cubed minus 9.6y minus 2001 squared plus 33.4y minus 2001 minus 10.9. Plug in 2002 to the derivative to get our slope of this tangent line, and this is not a fun thing, to plug out, but you can check you get 13.58. When you're working with real-world data, you get real-world numbers, so pick your poison. Therefore, the linear approximation, when I plug all this in, let's use our variable. I'm using y as a variables, so let's just practice using different variables here. This is going to be 180.47, the y-value at the point, plus the derivative we just found, plugged in 13.58, and then it's the variable minus the x. That is a linear approximation. This is a line, this linear approximation will approximate the curve at the point. All lines have equations, this one takes quite a bit of work and some nasty numbers to get but that is the linear approximation, also known as linearization. Now we get to use this. So we want to compare the value of this linear approximation and the given model when we're at 2002 and a half. So about six months into 2002. You can, here comes part b, to find the first value the model gives the quartic. If you plug in 2002.5, you can check, you get 188.99. That's the quartic function, that is on the curve of best-fit. If you plug into l, the linearization, linear approximation at 2002.5, you will get a different number and that's not surprising, but they should be close, it turns out they are 187.26. They're not exactly equal and that's coming from the fact that the quartic curves and the linear approximation is straight. So you have some error terms, but they're pretty close, and the idea is what would you rather do? I encourage you to try this and check these numbers. Would you rather play around with the nasty degree four quartic polynomial, or use the linear approximation or use the line? This goes into some computer science of what's easier, what takes faster runtime. The linear approximation is always easier to work with. Degree four, you're saying, well I could do it, it's fine. But imagine logs, exponentials, square roots, grosser functions. No matter what nasty function you start with, you can always find the linear approximation and turn something gross into a line using derivatives, using calculus. From that, you can go off and model data as we did here, or approximate and program calculators, and do other things. So very useful little tool for linear approximation. Go over these examples, check my numbers, and I'll see you next time.