For a real function of a real variable, injectivity and surjectivity can be recognised by looking at how horizontal lines meet the graph. Let us compare y=x2y=x^2 (not injective) and y=x3y=x^3 (injective): the line y=3y=3 intersects the first at two points, the second at just one.

y=x2y=x^2 is not injective: the line y=3y=3 meets it at two points, with abscissae x=±3±1,73x=\pm\sqrt{3}\approx\pm 1{,}73.

y=x3y=x^3 is injective: the line y=3y=3 meets it at a single point, with abscissa x=331,44x=\sqrt[3]{3}\approx 1{,}44.

Remark — Graphical tests

For a real function of a real variable, with graph in the Cartesian plane:

  • ff is injective     \iff every horizontal line intersects the graph at at most one point.
  • ff is surjective (onto the codomain R\mathbb{R})     \iff every horizontal line intersects the graph at at least one point.
  • ff is bijective     \iff every horizontal line intersects the graph at exactly one point.

Example

  • f(x)=x2f(x)=x^2 on R\mathbb{R} is neither injective (f(2)=f(2)=4f(2)=f(-2)=4) nor surjective onto R\mathbb{R} (it does not reach negative values).
  • f(x)=x3f(x)=x^3 on R\mathbb{R} is injective and surjective: bijective.
  • f(x)=1xf(x)=\tfrac{1}{x} from R{0}\mathbb{R}\setminus\{0\} to R{0}\mathbb{R}\setminus\{0\} is bijective.

Topics: Functions and properties
Concepts: Bijective function · Injective function · Surjective function · Horizontal line test
Functions: Cubic function · Homographic function · Parabola
Skills: Interpreting a graph · Sketching a graph