Friday, June 6, 2008

Inverse Quadratic Function

Today I have another question in the genre of "short question, long answer". Today's question deals with inverse functions, more accurately the inverse of a quadratic function (or more accurately, what becomes a quadratic function). This is not some simple quadratic function, but rather something more difficult to solve.

Find the inverse of y = 2x + sqrt(x)

Short, isn't it? However, the solution isn't that short.

To find the inverse, we need to substitute x and y and then solve for y. Let's do it:
x = 2y + sqrt(y)

To eliminate the square root, move the 2y to the right side and square:
x - 2y = sqrt(y)
x2 - 4xy + 4y2 = y

Subtract y from both sides and use the distributive property:
x2 - 4xy - y + 4y2 = 0
x2 - y(4x + 1) + 4y2 = 0

This calls for the friend of any math student: the quadratic formula. Notice that squaring may add a solution, but there is only one inverse function, so we'll need to eliminate one:
y = ((4x + 1) ± sqrt((4x + 1)2 - 16x2)) / 8

Yes, not a pleasant look. Let's work with that a little so see if it gets any better:
y = ((4x + 1) ± sqrt(16x2 + 8x + 1 - 16x2)) / 8
y = ((4x + 1) ± sqrt(8x + 1)) / 8

That's the best it gets, but there's still a problem: there are two possible inverse functions here, but only one is right. To find out which one is right, remember that we reached the following conclusion:
x - 2y = sqrt(y)

This means x - 2y must be non-negative. Let's plug the two possible y values to see what we get:
x - ((4x + 1) + sqrt(8x + 1)) / 4 = 4x / 4 - ((4x + 1) + sqrt(8x + 1)) / 4
= (4x - ((4x + 1) + sqrt(8x + 1))) / 4 = (-1 - sqrt(8x + 1)) / 4
In one word: negative. Not good.

Let's plug the other one now to see if it works:
x - ((4x + 1) - sqrt(8x + 1)) / 4 = 4x / 4 - ((4x + 1) - sqrt(8x + 1)) / 4
= (4x - ((4x + 1) - sqrt(8x + 1))) / 4 = (-1 + sqrt(8x + 1)) / 4

As you can clearly see, sqrt(8x + 1) > 0 if x > 0, just like the domain of the original function. That means the inverse of the original function is:
y = ((4x + 1) - sqrt(8x + 1)) / 8

Here is a little confirmation test:
Plug 9 for x in the original function. You get y = 2*9 + sqrt(9) = 21. Now plug 21 in the inverse function and see if it gives back 9:
y = ((4 * 21 + 1) - sqrt(8 * 21 + 1)) / 8
y = (85 - sqrt(168 + 1)) / 8
y = (85 - sqrt(169)) / 8
y = (85 - 13) / 8
y = 72 / 8 = 9

Yes, it is the inverse.

You can find many more interesting math tricks like that on super math tips.

Hope you liked it.
Nadav

nadavs