# root-finding methods to invert numerically a function

let be the equation $y-f(x)=0$ the idea is to get $s=g(y)$ that is x as a function of 'y'

can this be made by a root finding algorithm ?? i mean you treat $y$ as a numerical free parameter and find the roots of $y-f(x)=0$ in general these roots will depend on 'y' so we can represent every solution of $y-f(x)$ for different parameters of 'y'

for example in Newton's method

$x_{n+1} (y)=x_{n} (y)- \frac{y-f(x)}{-f'(x)}$

-
It's certainly doable, but your problem is to find a good starting point for your iterative method... –  Ｊ. Ｍ. Jul 28 '12 at 11:01
You are absolutely right, indeed historically right. Newton derives the expansion of $\sin x$ precisely by this method of reversion of series. I read the original paper. Newton uses a numerical root-finding procedure as a mere example to illustrate what he is doing, and actually shows no interest in using the idea for numerical work! That came later, and was not done by Newton. –  André Nicolas Jul 28 '12 at 11:05
OK thanks, we could use a bisection method and then a newton method to imporve the convergence :) –  Jose Garcia Jul 28 '12 at 11:29
@JoseGarcia : See Brent's method for improved convergence if Newton fails (i.e. if the derivative is too small). –  vanna Aug 27 '12 at 17:16
thanks a lot vanna :D –  Jose Garcia Aug 27 '12 at 19:37

The inverse of a single-variable function is a reflection over the line $y = x$. If you want the numerical inverse, just flip the coordinates. For example,

Function:

y = f(x);
plot(x,y);


Inverse

y = f(x);
plot(y,x);

-

If you are interested in getting the values of $x$, given the value of $y$ then your method works fine.

On the other hand if you are interested in obtaining a closed form expression of $x$ in terms of $y$ (treating $x$ and $y$ as symbol parameters) then the problem boils down to computing $f^{-1}$, given $f$ because $y=f(x)\Rightarrow x=f^{-1}(y)$. Now for different $f$, algorithms for computing $f^{-1}$ are different, like if $f$ is linear then the problem boils down to the inversion of a matrix.

-
Though, as André notes in his comment, one could use Newton's method to derive a series expansion for the inverse function... –  Ｊ. Ｍ. Jul 28 '12 at 11:40