# One to One Function — Definition, Graph, Examples

## What Is a One to One Function?

A **one to one function** is a function that sends distinct inputs to distinct outputs: if x1≠x2, then f(x1)≠f(x2). Equivalently — whenever two outputs are equal, the inputs must have been equal too: f(x1)=f(x2)⟹x1=x2. The formal name is an **injective function**, or an **injection**.

## How Do You Know if a Function Is One to One?

There are two standard tests — one visual, one algebraic — and they agree with each other.

**The horizontal line test (visual).** Look at the graph. If no horizontal line crosses it more than once, the function is one to one.

**The algebraic method (proof).** Set f(x1)=f(x2) and solve. If the algebra forces x1=x2, the function is one to one.

## What Does a One to One Function Look Like? (The Graph)

A one to one graph never doubles back to the same height. Straight lines with non-zero slope qualify; so do cubics like f(x)=x3 and exponentials like f(x)=ex, because they climb (or fall) without ever flattening and returning.

## Why Only One to One Functions Have an Inverse

A function has an inverse if and only if it is one to one. This is why f(x)=x2 has no inverse over all real numbers, but does once you restrict it to x≥0: restricting the domain throws away the duplicate arm and leaves a one to one piece.

## Examples of One to One Function

### Example 1

**Is f(x)=5x−7 one to one?**  
Set the outputs equal:  
5x1−7=5x2−7. 
Add 7 to both sides, then divide by 5: x1=x2.  
**Final answer:** yes, f(x)=5x−7 is one to one.

### Example 2

**Is f(x)=x2 one to one over all real numbers?**  
**Final answer:** no, f(x)=x2 is not one to one on R.

### Example 3

**Is f(x)=x3 one to one?**  
**Final answer:** yes. The graph of x3 never flattens and doubles back, so it also passes the horizontal line test.

### Example 4

**Is f(x)=1/(x+2) one to one?**  
Set the outputs equal:  
1/(x1+2)=1/(x2+2).  
Cross-multiplying gives x2+2=x1+2, so x1=x2.  
**Final answer:** yes, this rational function is one to one on its domain.

### Example 5

**Find the inverse of the one to one function f(x)=3x−4.**  
Write y=3x−4, swap the variables, then solve for y: y=(x+4)/3.  
**Final answer:** f−1(x)=(x+4)/3.

### Example 6

**Is a simple cipher one to one?**  
**Final answer:** yes — and being one to one is exactly what makes the message recoverable.

## Where One to One Functions Earn Their Keep

- **Cryptography and encoding.** Any reversible code must be one to one — the shift cipher is a simple version of the bijections behind serious encryption.
- **Databases and identifiers.** A primary key works because the map from record to ID is one to one.
- **Inverse functions everywhere.** Logarithms exist because f(x)=ex is one to one; arcsine exists only on the restricted interval where sine is one to one.

## Key Takeaways

- A **one to one function** sends distinct inputs to distinct outputs.
- The horizontal line test confirms it visually; setting f(x1)=f(x2) and solving confirms it algebraically.
- A function has an inverse if and only if it is one to one.
- The most common error is confusing the horizontal line test (one to one) with the vertical line test (is a function). 
- Injectivity depends on the domain — the same formula can be one to one on one interval and not on another.
