liveBook · Manning

Relation

As explained in Geometry for Programmers

A relation is a rule or set of associations that links elements of one set with elements of another set without requiring unique outputs.

A relation is a rule that links input values with output values. Unlike a function, it may assign multiple outputs to one input, or leave some inputs unmatched. section 2.4.1

Sine and its inverse

The sine relation assigns each real x a y between -1 and 1, so it is also a function. Reverse the relation: a y in [-1, 1] corresponds to infinitely many x values, while values outside that interval correspond to none. The reversed rule remains a relation but is no longer a function. section 2.4.1

Figure 2.20 The sine function: y = sin(x)
02-20

Use the sine graph to see how a relation pairs inputs and outputs, and why reversing those pairings can violate the function rule. section 2.4.1

How Geometry for Programmers covers it

How deep it goes
Defines relations through input-output links and contrasts them with functions using the sine example.
Examples
Uses the sine function and its reversed pairing to demonstrate functional and nonfunctional relations.
What it assumes
Builds from familiar programming functions and introduces domains and codomains through the sine example.
What you can do after
Evaluate whether an input-output rule qualifies as a function or remains a more general relation.
How it connects
Connects relations with functions, domains, codomains, ranges, and the sine function.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Geometry for Programmers. The section links point to the parts of the book it draws on.