I am trying to understand the code given here, which calculates the Legendre-Gauss-Lobatto nodes via the Newton-Raphson method. These nodes are given by the zeros of $(1 - x^2)\,P'_{N}(x)$ where $P_N(x)$ is the Nth Legendre polynomial.
The code calculates these zeros via the Newton-Raphson method, which is used for finding the zeros of functions. For example, the zero of a function $f(x)$ may be found by iterating
$$x_{n+1} = x_{n} - \frac{f(x_n)}{f'(x_n)}$$
until the difference between $x_{n+1}$ and $x_n$ is sufficiently small. In the code, this update seems to be given by
$$x_{n+1} = x_n - \frac{x_n\,P_N(x_n) - P_{N-1}(x_n)}{N\,P_N(x_n)}.$$
The term on the right seems very similar to Bonnet's recursion formula
$$(x^2 - 1)\,P'_N(x) = N(x\,P_N(x) - P_{N-1}(x))$$
which mostly explains the numerator, but I am lost on the denominator.
If I differentiate Bonnet's recursion formula, I obtain
$$\frac{d}{dx} [(x^2 - 1)\,P'_N(x)] = N(x\,P'_N(x) + P_N(x) - P'_{N-1}(x))$$
which doesn't match the denominator. At the very least, I would expect there to be an $N^2$.