CalculatorSignAll calculators

How a Square Root Calculator Approximates the Answer

Follow the Babylonian or Newton iteration for a nonnegative square root, with the sequence of guesses and their errors.

How a Square Root Calculator Approximates the Answer

Result
—

Use this calculator on your site

Paste the full code, including the CalculatorSign credit, into a Custom HTML block on your site.

Preview widget

A square root is a number which, when multiplied by itself, gives the original value. For values that are not perfect squares, a calculator can approximate the positive square root with a series of improving guesses. This tool shows the Babylonian method, also known as Newton's method for this problem, next to the computed square root.

Start with a nonnegative number and a positive guess

Enter the value whose square root you want to find. This page uses real numbers, so the value under the square root must be zero or positive. Then enter a positive initial guess. It can be a convenient number close to the root, such as an integer chosen from nearby perfect squares. The first row of the table is your guess before any refinement.

Choose how many steps to display. At each iteration, the calculator divides the original input by the current guess. Then it averages that quotient with the current guess to produce the next estimate. A positive guess allows the division to proceed. The operation repeats with the new estimate.

The third column shows the current guess squared minus the original number. A positive result in that column means the guess squared is above the input. In the negative case, the squared approximation falls short of the original number. Values close to zero show that the guess gives a square close to the number you entered.

Follow the first few steps for the square root of 45

Squares of six and seven are 36 and 49, so a starting guess of seven is reasonable. The original guess squared exceeds 45 by four. Divide 45 by seven to get about 6.428571. Averaging that quotient with seven gives approximately 6.714286 as the next guess.

The square of 6.714286 is about 45.081633. Its error is much smaller than the original four-unit error. Divide 45 by the unrounded first approximation and average again. The next value is about 6.708206687. That guess has a squared error of approximately 0.00003695.

Another refinement gives about 6.708203932, matching the displayed digits of the reference square root. The internal numbers can still differ slightly after the display matches. The table may continue showing a small error until the values can no longer be distinguished by ordinary floating-point arithmetic.

Understand why the averaging step works

For a positive target, a guess above the square root has a quotient below the square root when you divide the target by that guess. A guess below the root produces a quotient above it. The two values have the original target as their product. Averaging them gives a closer starting point for another pass in typical cases.

A very large starting guess may first spend several iterations roughly halving. A good guess between neighboring integer roots can converge much more quickly. Changing the starting guess while keeping the number fixed affects the sequence of approximations but does not change the intended positive root.

For zero, the computed square root is exactly zero. With a positive starting guess, each refinement of zero averages the current guess and zero, so the guesses halve. A finite list of such positive guesses approaches zero without having to reach it. That is one example where the table and the directly computed result tell different parts of the numerical story.

Relate the approximation to the exact expression

For a perfect square such as 49, the positive root is exactly seven. If you start the iteration at seven, the quotient is also seven, and averaging leaves it unchanged. For a non-perfect square, an exact radical can still be written symbolically. The square root of 45 is three times the square root of five, even though its decimal expansion continues.

The displayed approximation uses a fixed number of significant digits or scientific notation for extreme values. The squared error is computed before the display rounding. Multiplying the printed guess by itself can therefore give a slightly different error than the one shown in the table.

If you are using this example in a class, keep enough digits during each manual step to see the refinement. Rounding every intermediate guess to one or two places can hide the improvement after the first few iterations.

Frequently asked questions

Why must the initial guess be positive?

The next step divides by the current guess. A positive starting number avoids division by zero and directs the model toward the positive root.

How many iterations are needed?

It depends on the starting guess and desired precision. Compare the squared error and successive guesses to decide whether the displayed approximation has stabilized.

Does the table produce a negative square root?

It shows the nonnegative principal square root. Both signs can solve an equation such as x squared equals 45, but this calculation follows the positive one.

What do scientific notation values in the error column mean?

They represent very small or very large differences using powers of ten. A small error indicates that the current estimate squared is close to the original input.