• Skip to primary navigation
  • Skip to main content
  • Skip to footer
Basic Mathematics
  • ⌕
Functions, Domain, Codomain and Range

Functions, Domain, Codomain and Range

Written by Jean Carlos Novaes

A function assigns exactly one output to every input in its domain. Two inputs may have the same output. One input cannot have two different outputs. If A is a set of inputs and B is a set of possible target values, their Cartesian product contains all ordered pairs with first entry in A and second entry in B. A relation selects some of those pairs. It is a function from A to B only if each element of A appears exactly once as a first entry.

The range can be smaller than the codomain

Let A contain negative 2, zero and 2. Let the stated codomain B contain 0, 1 and 4. Squaring each input gives 4, 0 and 4. This is a function, since each input has one result. Its range is the set containing 0 and 4. The codomain also contains 1, but no input reaches it. The function is neither injective, because two inputs share output 4, nor surjective, because 1 is missed.

A={−2,0,2}
B={0,1,4}
f(−2)=4,f(0)=0
f(2)=4

A vertical line tests a graph, a horizontal line tests injectivity

Plot the three ordered pairs from the example. A vertical line cannot meet more than one plotted point, which confirms the function rule. The horizontal line at height 4 meets two points, which rules out injectivity. For the real-valued square function on all real inputs, the graph has a whole curve instead of three points and the range contains every nonnegative real number.

Two arrows arrive at output 4 and one at output 0. The codomain value 1 is unused.
Two arrows arrive at output 4 and one at output 0. The codomain value 1 is unused.

Read sign and variation separately

An output can be positive while the function is decreasing. The real square function decreases as x moves from negative values toward zero, yet its outputs stay positive until zero. It then increases for positive x. A constant function has the same output at every input. Squaring is even because opposite inputs give the same value. The cube function is odd because opposite inputs give opposite values.

The restrictions of each family matter. A square root needs a nonnegative argument and a logarithm needs a positive argument. A polynomial rule accepts every real input unless its domain is specified more narrowly.

Related content

  • Composite Functions and the Order of Substitution
  • Inverse Functions, Domains and How to Find the Rule
Jean Carlos Novaes

About Jean Carlos Novaes

I hold a degree in Computer Science from the Federal University of Bahia (2017) and I am the editor and founder of this website.

Footer

Basic Mathematics

Basic Mathematics website with clear school content for elementary and high school students. Learn easily and efficiently!

ABOUT

  • About Us
  • Contact
  • Site Map

LEGAL

  • How to Cite
  • Cookie Policy
  • Privacy Policy
  • Content License
English
  • Portuguese (Português)
  • Danish (Dansk)
  • German (Deutsch)
  • English
  • Spanish (Español)
  • Finnish (Suomi)
  • French (Français)
  • Italian (Italiano)
  • Dutch (Nederlands)
  • Norwegian (Norsk)
  • Polish (Polski)
  • Portuguese (Portugal)
  • Swedish (Svenska)

© 2015–2026 · Basic Mathematics · All rights reserved.