Sunday Function

Here's a very simple function:

i-d4bb9fe09d6b78eb832985821d8a307f-1.png

You give it a positive real number, it gives you the square root. It maps 81 to 9, 100 to 10, 2 to 1.414..., and so on and so forth. It's pretty much the only one-argument function that's built into most pocket calculators, which says something about its utility and ubiquity. But let's say we did want to come up with an easy way to get approximate square roots. Maybe our calculator is broken, or (much more likely) maybe we're looking for an analytic approximation that's easier to deal with than the square root in and of itself. To generate our approximation, let's take a look at the function:

i-7b7142f1efa09b47c3b8242f89bcb9f4-graph.png

It starts off rather dramatically curved, but as x gets larger and larger, the increasing value of the square root smooths out and begins to look more and more like a straight line of constant slope. We can imagine that if we drew a straight line tangent to this curve at a point of exactly known square root, we could use that line to estimate the value of the square root in the immediate neighborhood of this point. For instance, we know that the square root of 64 is 8. Therefore if we draw a line just touching that point on the graph, we might just have developed a pretty good approximation for finding the square root of numbers near 64. Actually carrying this out, we have a graph that looks like this:

i-3fdee7de4197c08986e3407853fa09fa-graph2.png

To actually do anything useful with this, we need to find the equation of that line. Using the point-slope form of the equation of a line, we know that our line will have the following form. I'll explain the constants after I print it:

i-88516ca505d84f969b7ab15a965c3fb3-2.png

The line itself is a function, and since f is already taken we'll call it g. The constant m is just the slope of the line, and the constants x0 and y0 are the coordinates of the point on the original curve to which the line is tangent. (x0 = 64 and y0 = 8, because 8 is the square root of 64)

The slope m is the part that we don't yet know a priori. To find it we need a little bit of calculus. Calculus tells us that the slope of the tangent line is equal to the derivative of the original function, evaluated at that point. So calculating the derivative, we find that:

i-d18063683dcc0d42b9be45451a84d1e3-3.png

Putting x = 64 in that expression, we find that our particular m is 1/16. Therefore for numbers near 64, their square root is roughly g(x):

i-8d7070ce28f0af28047c7a5fb8246d53-4.png

Let's check it. Plugging in (say) x = 65, we get that the square root of 65 is about 8.0625. The actual answer is 8.062257748... Which is pretty close.

The procedure works anywhere, you are by no means limited to the vicinity of x = 64. You can redo the calculation and put the tangent line anywhere convenient. For instance, if you want to calculate square roots in the vicinity of x = 100, just recognise that the new x0 = 100, the new y0 = 10, and the new m = 1/(2*10) = 1/20. In fact it will turn out that the higher x0, the broader the range of accuracy of this approximation about that point.

I admit this application for a linear approximation is a little contrived. But it does work, and if it didn't physics would have been very hard-pressed indeed to have developed past the pre-Newton dark ages.

More like this

This is the graph of the line y = x: If you put your finger down on any point on that line, and then put another finger on another point on that line, you find that the total change in the y-coordinate divided by the total change in the x-coordinate between those two positions is 1. Move two…
I'm teaching a lot of calculus this term, and we just spent the last class period or two talking about straight lines. That makes sense. Calculus is especially concerned with measuring the slopes of functions, and straight lines are just about the simplest functions there are. Now, the textbook…
Again I have to apologize for the sparseness of posting lately, but I've got two research projects going full blast and time has not been something I have a lot of. I'll still be writing at least a few times a week, and you can't beat the price. ;) In any case once things cool down just a little…
It is time to continue our quest to prove that the sum of the reciprocals of the primes diverges. We have one more ingredient to put into place. I am referring to the notion of a Taylor series. The idea is this: Some functions, like those from trigonometry, are difficult to evaluate precisely.…

There is a method for calculating square roots longhand (see, e.g., this explanation with example). The method appears to be equivalent to iterated application of the technique you describe above.

By Eric Lund (not verified) on 07 Dec 2009 #permalink

It may be contrived, but the point about how the range of validity of the linear approximation depends on where you start has an application to lots of areas of physics.

In mechanics, the reason we never noticed the need for relativity until well after the theory was developed was that the approximation we were using for the kinetic energy followed the true function until well past where any experiments were being done.

Elsewhere, it is common to use a linear approximation that is valid around, say, room temperature when working with empirically determined 'functions'. Knowing where your model breaks down is critical.

The y-intercept (x=0) of g(x) is y sub 0/2, a quick hint for drawing your tangent line.

By Zippy the Pinhead (not verified) on 07 Dec 2009 #permalink

Um, this is just a two term Taylor Series, and is by no means unique to sqrt(x).

By Jesse Pino (not verified) on 07 Dec 2009 #permalink

I guess this is how I do it in my head, but, rather than deriving the method as you did, I just used the formula from jr. high algebra X^2=(A+B)^2=(A^2+2AB+B^2). Find the closest A^2, assume B^2 to be insignificant, and divide the difference of X^2-A^2 by 2A. This is one of the ways I keep myself amused. Sad.

Indeed that's true by definition, Jesse. But in my experience a concrete example is a lot more interesting than abstract generalities. If I were teaching a class instead of writing a blog, I'd take the more general approach. Here however, that's likely to bore everyone to death. That's what textbooks are for.

Brad, that's a lot of things but "sad" ain't among them. It's an excellent way to demonstrate the power of this method without invoking calculus at all. You could easily adapt it for other roots as well via the binomial theorem.

Newton's iterative method for square roots is also cool.

r' = (r + x/r)/2

By Ambitwistor (not verified) on 07 Dec 2009 #permalink