My previous post Deriving the Maclaurin Series is a prerequisite for this post.
We’ve just learned how to approximate a function using the Maclaurin Series. It’s a pretty sweet hammer, so let’s start hitting some nails. How about ?
If you care about the region around 0, you’re golden. This is a great approximation. But what if you care about ? It’s… not great. One option is to add more terms. We used the first 5 terms of the Maclaurin Series. We could use 100. That would definitely work. However, if you know beforehand that you care about a particular region that is not the region around 0, there’s a better way.
When might you know beforehand which x-region you care about in real life? Actually, quite often. Let’s say the function you’re approximating is the percentage humidity in the air as a function of temperature. Are you particularly interested in a temperature of 0? Probably not. You’re probably most interested in temperatures that are close to your current temperature. If you come up with real-life examples, there’s often a natural “default” x value and you probably care most about the x-region around that default value.
So what’s the better way? It’s called the Taylor Series, and it’s just two small steps away from the Maclaurin Series.
We want to polynomial that best approximates a function around the point . However, as a first step, we’re first going to solve for a polynomial that is almost the polynomial we want. It’s going to be exactly the Maclaurin Series, except in place of , , etc., we’re going to use , , etc. I.e.
Because we’re now using the function value (and derivatives) around , the resulting polynomial will look very similar to around . The only problem is that it’s still centered around the origin.
A picture is going to be much easier to understand:
Notice how the red line, has the same value and shape around as does around ?
This is the easy step, we need to shift our function to the right by . You may just remember this back from algebra, but if not, we want .
And, not that it will surprise you, but here’s the final picture (re-centered around ):
Notice that is a much worse approximation of around , similar to how the Maclaurin Series was a terrible approximation around . There’s no magic going on here. We traded off accuracy around for accuracy around . If you need more accuracy everywhere, you need more terms.