AI Glossary / Mathematics and optimization / Intermediate

Co-domain

Definition

The co-domain of a function is the declared set in which its output values lie. If a function is written f:U→V, U is its domain and V is its co-domain. The values the function actually produces form its image, often called its range, which may be smaller than the co-domain.

What it means

A co-domain is part of how a function is specified. It tells readers what kind of output is allowed, but it does not assert that every allowed value is reached.

For example, a square function can be declared from the real numbers to the real numbers. Every output is real, so the declaration is valid, although negative outputs never occur. The same formula can instead be declared to have the nonnegative reals as its co-domain. Its numerical calculations are unchanged, but some mathematical properties of the specified mapping change.

How it works

To define f:U→V, each input in U must have exactly one assigned output in V. Its image is the set of all f(x) as x ranges over U. Consequently, the image is always contained in the co-domain.

A function is surjective, or onto, when its image equals its co-domain. Whether it is surjective therefore depends on the declared target set, not just the formula. A function is injective, or one-to-one, when distinct inputs never share an output. Both properties are needed for a bijection and a two-sided inverse between the specified sets.

In machine learning, the co-domain may be a set of labels, a real vector space, or a set of probability vectors. A finite collection of observed predictions is only an observed subset of the image, not a complete description of the function's possible outputs.

Three practical examples

1. Classification: specify that a hard-label model maps allowed inputs into a defined label set, while recognizing that some labels may never be predicted by a particular trained model.

2. Probability modeling: distinguish a vector of arbitrary real scores from a probability vector whose coordinates are nonnegative and sum to one.

3. Software interfaces: document the mathematical output set of a transformation, including whether missing values or error outcomes are part of the intended interface.

Think of it this way

Think of a delivery service with an officially declared delivery area. The addresses it actually serves may cover only part of that area. The declared area resembles the co-domain; the addresses reached resemble the image.

The analogy does not make the co-domain a promise that every location will receive a delivery. A mathematical function also assigns exactly one output to each input in its domain, which is more precise than an ordinary service description.

Worked example

Take f(x)=x² with domain all real numbers and co-domain all real numbers. For inputs −2, 0, and 3, the outputs are 4, 0, and 9. More generally, the image is the set of nonnegative reals. The function is not onto the declared co-domain because no real input produces −1.

Now define g by the same formula and the same domain, but with the nonnegative reals as its co-domain. This version is onto: for each y≥0, the input √y produces y. It is still not one-to-one because, for example, g(2)=g(−2)=4.

Finally, restrict both the domain and co-domain to the nonnegative reals. The square function is now both one-to-one and onto, and its inverse is the nonnegative square root.

The arithmetic formula has stayed the same throughout. Changing the specified sets changes whether an inverse exists between them. This is why a function's domain and co-domain deserve explicit attention instead of being treated as decorative notation.

Illustrative case study

Fictional case: a team documents an AI service as returning a probability vector over four categories. Reviewers discover that the implementation returns four unrestricted scores before normalization.

The team corrects the interface description and separates the score transformation from the probability-producing transformation. It then checks the conditions on the final output: four coordinates, nonnegative values, and total one within the chosen numerical tolerance. This aligns the stated co-domain with the intended mathematical object. It does not establish that the probabilities are calibrated or that the categories cover every real-world case.

Common misconceptions and mistakes

The co-domain is not necessarily the range. Because some texts use range ambiguously, this entry uses image for the actual set of attainable outputs.

Do not infer the full image from a small test dataset. Nor should a label set be confused with a vector of probabilities over those labels: they are different output spaces. Changing the co-domain to the image can make a function onto, but does not automatically make it one-to-one or repair ambiguity in an inverse calculation.

Business use

Clear output specifications help prevent misunderstandings between model developers and the teams consuming their results. They distinguish labels, scores, probabilities, and structured outputs that may otherwise look superficially similar.

For deployment, connect the mathematical declaration to practical validation: shape, allowed values, and handling of exceptional inputs. A well-specified co-domain makes an interface easier to test, while accuracy, calibration, and usefulness require additional evaluation. Correctly typed output is only one part of a reliable service.

People also ask

Can the co-domain contain values never produced?

Yes. The image may be a proper subset of the declared co-domain.

What does onto mean?

Every element of the co-domain is the output of at least one input in the domain.

Can two mappings use the same formula but different co-domains?

Yes. Their numerical rule may agree while their declared target sets, and properties such as surjectivity, differ.

Check your understanding

Let f map real numbers to real numbers by f(x)=exp(x). Is it onto its co-domain?

Answer: No. Its image consists of positive real numbers, so zero and negative numbers are not reached. Declaring the positive reals as the co-domain would make it onto.

Related terms

  • Domain
  • Image
  • Range
  • Probability simplex
  • function
  • surjection
  • injection
  • bijection
  • inverse function

Learn next

compare domain, co-domain, and image using a few simple functions. Then examine injections, surjections, and bijections, paying attention to how restrictions on input and output sets affect the existence of an inverse.

  • Domain
  • Image

More in Mathematics and optimization

  • Absolute error loss - Absolute error loss measures a numerical prediction's error as the absolute difference between its predicted and reference values: L(y,y-hat)=|y-y-hat|.
  • Active-set method - An active-set method is an optimization approach that works with a changing subset of constraints believed to be tight at the solution.
  • Adjoint state method - The adjoint state method computes how a chosen objective changes when the parameters of a mathematical model change.
  • Σ-algebra
  • Algebraic connectivity - Algebraic connectivity is the second-smallest eigenvalue of a graph's Laplacian matrix.
  • Algorithm IMED - Algorithm IMED, short for Indexed Minimum Empirical Divergence, is a method for choosing actions in a stochastic multi-armed bandit problem.

Sources

Aalto Dictionary of Machine Learning, co-domain entry and domain/image illustration: https://aaltodictionaryofml.github.io/ADictML_Main.pdf . The supplied definition was read. The square-function progression, exponential question, and fictional interface example are original teaching material.

Previous: Co-adaptation Next: co-NP

  • Home
  • Daily AI Updates
  • Blog
  • AIFBL Academy
  • AI Glossary
  • Products and Tools
  • Store
  • Free CFO AI Prompt Pack
  • About Shihan Sheriff
  • Privacy Policy
  • Terms of Use
  • Refund Policy
  • Cookie Policy
  • Earnings Disclaimer