# Identity and One-to-One Functions

### Identity Function

The identity function for the operation of composition is $f(x) = x$.

The identity function is the function for which the output is equal to the input. If the input is $x$, then the identity function is $f(x)=x$.

Although composition of functions is not generally commutative, composition with $f(x)=x$ is commutative. This is because any function composed with the identity function is itself, regardless of the order of the composition. For $f(x)=x$ and any function $g(x)$:
$f(g(x))=g(f(x))=g(x)$
The graph of the identity function is a line with a slope of 1 and a $y$-intercept of zero. For every point on the line, the $x$-value is the same as the $y$-value.

### One-to-One Functions

A function is one-to-one if every output value has a unique input value. The horizontal line test and algebraic methods are used to determine whether a function is one-to-one.

For all functions, each input corresponds to exactly one output, which can be determined by a vertical line test. In a one-to-one function, each output corresponds to exactly one input.

In a mapping diagram, this means that every element of the domain is mapped to only one element in the range, and vice versa. On a graph, the horizontal line test uses horizontal lines to determine whether a function is one-to-one; if any horizontal line intersects the graph in more than one point, the graph is not one-to-one.

For example, a simple function is:
$f(x)=x^2$
Any two opposite values, such as 1 and –1, will have the same output. So, the function is not one-to-one. For other functions, it may be easier to determine whether the function is one-to-one using the horizontal line test on a graph.
Not a Function Function, Not One-to-One One-to-One Function
The mapping shows that one domain value has two different range values.
The mapping shows that every domain value has exactly one range value, but a range value has two different domain values.
The mapping shows that every domain value has exactly one range value and that each range value only has one domain value.
The graph shows that an $x$-value has two different $y$-values.
The graph shows that every $x$-value has exactly one $y$-value but that a $y$-value has two different $x$-values.
The graph shows that every $x$-value has exactly one $y$-value and that each
$y$-value has only one $x$-value.