Ridders’ method is a single-variable root-finding method that is more efficient than the basic regula falsi method. The formula is easy enough to find online (e.g. the first link), but its derivation is not. This post fills in the blanks.
Suppose the function $f$ has a zero between $x_L$ and $x_R$, i.e. $f(x_L)f(x_R) < 0$. Then let:
$$\displaystyle \begin{aligned} x_M &= \frac{x_L + x_R}{2} \\ f_M &= f(x_M) \end{aligned}$$
There is an exponential function $e^{a(x-x_L)}$ such that $g(x) = e^{a(x-x_L)} f(x) $, evaluated at the three points $x_L, x_M, x_R$ all lie on the same line. That is:
$$\displaystyle 0 = g_L – 2g_M + g_R = f_L – 2Q f_M + Q^2 f_R $$
where $Q = e^{a(x_M – x_L)} $. All we really need is $Q$, not $a$, and we have right here a quadratic equation for $Q$ which has the solution:
$$\displaystyle Q = \frac{f_M \pm \sqrt{f_M^2 – f_L f_R}}{f_R} $$
Note that since $f_L$ and $f_R$ have opposite signs, the quantity inside the square root will never be negative. Now we do a regula falsi step on $g$ using $x_M$ to estimate the actual root $x^*$:
$$\displaystyle x^* – x_M = \frac{0-g_M}{g_R-g_L}(x_R-x_L) $$
Now since $x_M$ is halfway between $x_R – x_L$, $x_M – x_L = (x_R – x_L)/2$. And since $g_M$ is the average of $g_L$ and $g_R$ (by the construction of $Q$), we know that $g_R – g_L = 2(g_R – g_M)$. Therefore we can rewrite the regula falsi step as:
$$\displaystyle x^* – x_M = \frac{0-g_M}{2(g_R – g_M)}2(x_M – x_L) = \frac{g_M}{g_R – g_M}(x_L – x_M) $$
Now rewrite this in terms of $f$ using $Q$:
$$\displaystyle x^* – x_M = \frac{Q f_M}{Q^2 f_R – Q f_M}(x_L – x_M) = \frac{f_M}{Q f_R – f_M}(x_L – x_M)$$
The denominator can be rewritten using the known expression for $Q$:
$$\displaystyle Qf_R – f_M = \pm\sqrt{f_M^2 – f_L f_R} $$
So we end up with the iteration for $x^*$
$$\displaystyle x^* = x_M + \frac{\pm f_M}{\sqrt{f_M^2 – f_L f_R}}(x_M – x_L) $$
The last question is the choice of $\pm$, which has to be made accounting for the sign of $f_M$ such that $x^*$ ends up on the correct side of $x_M$:
Sign of $f_L – f_R$ | Sign of $f_M$ | Desired sign of $\pm f_M$ |
+ | + | + |
+ | – | – |
– | + | – |
– | – | + |
So to get the right sign for $\pm f_M$ we need the $\pm$ to be the sign of $f_L – f_R$. This leads to the formula found online:
$$\displaystyle x^* = x_M + \frac{\text{sign}(f_L-f_R) f_M}{\sqrt{f_M^2 – f_L f_R}}(x_M – x_L) $$
Since $f_L$ and $f_R$ have opposite signs we could just as well use $\text{sign}(f_L)$, but I think the $f_L – f_R$ shows the purpose of the sign term more clearly.