Skip to content

Resource · Guide or article

Square Root (Newton's Method)

Derives the Newton-Raphson iteration and applies it to computing a square root, the approach behind 'implement sqrt without a library' questions. Some calculus (derivatives) is assumed.

Reviewed

Open the original: Square Root (Newton's Method) (opens the original site in a new tab)

Add to a roadmap

Keep this resource with a roadmap you follow. It appears as your own extra resource; the roadmap's steps don't change and it doesn't count toward your tracked steps.

Source content: English

In numerical analysis, a branch of mathematics, there are several square root algorithms or methods of computing the principal square root of a non-negative real number. As, generally, the roots of a function cannot be computed exactly. The root-finding algorithms provide approximations to roots expressed as floating point numbers. Finding is the same as solving the equation for a positive x. Therefore, any general numerical root-finding algorithm can be used. Newton's method (also known as the Newton–Raphson method), named after Isaac Newton and Joseph Raphson, is one example of a root-finding algorithm. It is a method for finding successively better approximations to the roots of a real-valued function.

PrepKit overview

PrepKit editors wrote and reviewed this overview from the source repository. It is not text from the resource itself.

Suited to
The source does not state a level
Format
Lesson

What it covers

  • Newton's Method General Idea: refining a guess with the function and its derivative, and the tangent-line picture.
  • Newton's Method of Finding a Square Root: the update x := x - (x squared - S) / (2x).
  • Why the correction is divided by the derivative 2x.

How to use it

PrepKit study advice, not a claim made by the source.

Code the update with a tolerance check, compare results with Math.sqrt for a few inputs, and explain how you chose the starting guess and stopping rule.

Scope and limitations

Formulas are mostly Wikimedia images. It gives no convergence analysis, integer-only variant, or binary search alternative.

Access and format

English README on GitHub (MIT-licensed trekhleb/javascript-algorithms); free to read.

Reviewed by PrepKit on Oct 2, 2026. Listing source commit: 85293e3e2b88

Evidence behind this overview
  • src/algorithms/math/square-root/README.md

Pages that include this

Get the PrepKit newsletter

Optional. You don't need it to use PrepKit.

How we handle your email