Horizontal line test

In mathematics, the horizontal line test is a test used to determine whether a function is injective (i.e., one-to-one).
In calculus.
A "horizontal line" is a straight, flat line that goes from left to right. Given a function formula_1 (i.e. from the real numbers to the real numbers), we can decide if it is injective by looking at horizontal lines that intersect the function's graph. If any horizontal line formula_2 intersects the graph in more than one point, the function is not injective. To see this, note that the points of intersection have the same y-value (because they lie on the line formula_2) but different x values, which by definition means the function cannot be injective.
Variations of the horizontal line test can be used to determine whether a function is surjective or bijective:
In set theory.
Consider a function formula_4 with its corresponding graph as a subset of the Cartesian product formula_5. Consider the horizontal lines in formula_5 :formula_7. The function "f" is injective if and only if each horizontal line intersects the graph at most once. In this case the graph is said to pass the horizontal line test. If any horizontal line intersects the graph more than once, the function fails the horizontal line test and is not injective.