I’m creating a program for finding the square root of a number, and I came across the Newton-Raphson method, an algorithm that solves my task.
I only saw the pseudocode for the algorithm, but I never really understood why it worked. Can someone explain to me why it works without all the heavy math?
In: Mathematics
There is a [neat animation on the Wikipedia page](https://en.wikipedia.org/wiki/File:NewtonIteration_Ani.gif) which gives an idea of how this works.
Essentially you are pretending that your function is a straight line, not a curve, and then finding where the 0 would be.
You then assume that your new point is closer than your earlier one and try again – finding the new line (tangent to the curve at this point) and finding where that crosses the x-axis. And you repeat.
It doesn’t always work, but when it does, it tends to work fairly quickly.
Latest Answers