Solution (source code)

= Solution

The tangent line to $f$ at $x_n$ is $y=f(x_n)+f'(x_n)(x-x_n)$. Its intersection with the horizontal axis gives <Newton's method>:
$$
\boxed{x_{n+1}=x_n-\frac{f(x_n)}{f'(x_n)}}.
$$
Each step requires $f'(x_n)\ne0$. Convergence to a <zero of a function> additionally depends on the starting point and the local behavior of $f$; the update formula alone is not a convergence guarantee.