Jump to content
• Advertisement

# 1 to 1 test for functions

This topic is 4106 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

## Recommended Posts

Is there a quick mathematical test for checking whether a function is 1 to 1? I'm going through one of my old calculus books, and in the first chapter I came across inverse functions. Anyway, the suggestion in the text is to use a horizontal line test to figure out whether a function is 1 to 1. ie.) f(x) = x^2 is not one to one because there are two x values for each y value. ie.) f(x) = 2x - 3 is one to one because there is a different result for every input. Anyways being a programmer, I don't really like the idea of having to do a visual check for something like that. I don't want to cycle through all the numbers in the entire domain to find out if it is 1:1. An example being done where the result is that the function is not 1 to 1 would be most helpful. I know this sounds like homework, but I'm not in school and it's really just for my own knowledge.

#### Share this post

##### Share on other sites
Advertisement
Well, another way of testing to see if a function is one to one is to check if f(a) == f(b) implies a == b.

So for x2:
a2 = b2 a = ±b

x2 is not one to one.

For 2x - 3:
2a - 3 = 2b - 3    2a = 2b     a = b

2x - 3 is one to one.

#### Share this post

##### Share on other sites
y = f(x) is not one-to-one if there are any maxima or minima. This describes the test: Wikipedia: Higher order derivative test.

Unless you know that y = f(x) is a function, you need to do the same test for x = g(y) (where g is the inverse of f).

#### Share this post

##### Share on other sites
Thanks for your help. I really appreciate it.

I saw this in the book too. But, I still don't understand how it can be tested for?

I do see the relationship here and I understand that a squared value could have been either negative or positive originally. My main thought, is that I don't see how I could change that formula into an algorithm (where most of the time I do).

Unless... is the main point here that the definition of a squared value could have been originally + or -? (Meaning that the algorithm would be related in some way to a test of the degree of the polynomial) And if that's the case, how does the given formula help solve the problem?

Anyways, thanks again for the help.

#### Share this post

##### Share on other sites
Symbolic mathematics is a tricky thing to program. It's what software packages like Maple and Mathematica do. Automatically generating proofs is harder still. If your functions have some fixed form and you know how to determine if functions of that form are one-to-one, then it probably isn't difficult to write a program to implement the algorithm. As you try handling more cases it becomes more difficult.

If all your functions are polynomials then the algorithm is fairly simple (just detect minima and maxima). As the functions become more complicated, automatically finding the derivatives becomes more difficult, but it can still be completely automated without too much trouble as long as you're dealing with nicely behaved functions. Solving for the roots of the derivatives is another tricky problem, as is solving for roots in general. Numeric methods for solving them can be badly behaved, and symbolic methods are once again a tricky thing to implement.

If the domain is finite then you can exhaustively scan the entire domain.

#### Share this post

##### Share on other sites

• Advertisement
• Advertisement

• ### Popular Contributors

1. 1
2. 2
Rutin
16
3. 3
4. 4
5. 5
• Advertisement

• 26
• 11
• 9
• 9
• 11
• ### Forum Statistics

• Total Topics
633704
• Total Posts
3013460
×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!