# Is there an inverse for a quartic function?

For a programming project, I'm trying to figure out the inverse of a quadratic function: $f(x) = ax^4 + bx^3 + cx^2 + dx + e$. In my case, the numbers $a$, $b$, $c$, $d$ and $e$ are all known constants, but rather annoying non-integers going about five places past the decimal point.

I have a function that returns the result when $x$ is processed through the equation, but what I now need is a function that will return the result back to the original input.

Is there an inverse to the function above, which I would be able to re-use the same constants? If I have to go about finding this solution myself, are there any resources that will explain the steps involved in simple language?

It's been twenty years since my last math class, and I don't recall ever getting into solving fourth degree equations. I've found all sorts of information about trying to solve and find the roots for quartic equations, although I don't quite understand what they're doing, but nothing on a plain old inverse of the function.

The main problem you're going to have is a general forth degree polynomial will not be one-to-one, so you'll have to be careful to restrict the domain of your function. Take for example the most basic quartic:

$$f(x)=x^4$$ If $f(x)=1$, what is $x$? Well (if you're only considering real numbers), $x$ could be either $1$ or $-1$. So which is it? If you restrict your domain to only positive numbers, then the inverse is $1$.

The problem becomes more complex, of course, when you consider the "general" case, since the function will look like a "W" in general (you might have 4 possible solutions!)

If you're okay with inexact answers (as this is for programming, I'm guessing this might be the case?), you can always solve the equation $y=f(x)$ for $x$ by using a numerical method such as Newton's method. Of course, yet again, you'll have to worry about multiple solutions.

• I'm going to accept this answer for succinctness, and for the fact that it pointed me towards Newton's method, which I can't see how to use in a programming environment, but it did inspire a different programmatic solution to my problem. – clam Apr 12 '13 at 13:33

Well it would help if you post the polynomial coefficients and also what is the domain of the function. Like is the domain all real numbers?

The problem is that because of the even degree (degree 4), on the domain of all real numbers the inverse relation won't be a function (which means we say "the inverse doesn't exist").

For example, consider $f(x)=x^4$ on all of the real numbers. Clearly $f(2)=f(-2)=16$. So when I ask you to give me $x$ such that $f(x)=16$ what do you return? The inverse relation is multi-valued (meaning it isn't a function).

But on the other hand if I consider $f(x)=x^4$ on all of the positive real numbers, now we do have an inverse and $f(x)=16 \Rightarrow x=2$.

Easy way to check for invertibility, just plot the function on your domain. If it passes the horizontal line test (yes the horizontal line test...because we want the inverse to be a function) then the inverse does exist.

Another issue is, even if our function is invertible in whatever domain, to find the actual expression for $f^{-1}(x)$ may not be easy. In my example above, the inverse is $f^{-1}(x)=x^{1/4}$. But if I want to invert $f(x)=x^4-x-1$ on the domain $[-1,0]$, it'll get a bit hairy. It probably won't be a polynomial and even if you find an expression using a CAS like Mathematica it might still not be worth it...well maybe if you can simplify it enough.

So then you can fall back on the root finding problem. So for example if you want to find $x$ such that $$f(x)=x^4-x-1=\frac{1}{2}$$ then you numerically solve $$x^4-x-\frac{3}{2}=0$$ using Newton's method or whatever. In this case there are four distinct solution, two are real and two are complex. But since we restrict ourselves to $x\in [-1,0]$ our answer is $x=-0.456553...$.