Horizontal line test (source code)

= Horizontal line test
{wiki}

For a real-valued <function> drawn in the plane, the <horizontal line test> asks whether every horizontal <line> intersects its <function graph> at most once. This is exactly <injectivity>, since two intersections at the same height mean two inputs have the same output. A missing height is compatible with <injectivity>, so an <inverse function> is then defined on the <image of a function>; it is an inverse on the entire specified <codomain> only when <surjectivity> also holds.