# Nakafa Learning Content

> For AI agents: use [llms.txt](https://nakafa.com/llms.txt) for the site index. Markdown versions are available by appending `.md` to content URLs or sending `Accept: text/markdown`.

URL: https://nakafa.com/en/subjects/mathematics/function-composition-inverse-function/function-and-non-function
Source: https://raw.githubusercontent.com/nakafaai/nakafa.com/refs/heads/main/packages/contents/material/lesson/mathematics/function-composition-inverse-function/function-and-non-function/en.mdx

Distinguish functions from non-functions using arrow diagrams and mathematical definitions. Learn one-to-one mapping rules with visual examples.

---

## Relations Between Sets

In mathematics, a **relation** from a set $$A$$ to a set $$B$$ is a rule that connects members of set $$A$$ with members of set $$B$$. This pairing can be in any form.

Visible text: In mathematics, a **relation** from a set to a set is a rule that connects members of set with members of set . This pairing can be in any form.

**Example:**

The "less than" relation between $$A = \{1, 2, 3\}$$ and $$B = \{1, 2, 3, 4\}$$ yields the pairs $$(1, 2), (1, 3), (1, 4), (2, 3), (2, 4), (3, 4)$$.

Visible text: The "less than" relation between and yields the pairs .

**Explanation:**

We look for all pairs $$(a, b)$$ with $$a \in A$$ and $$b \in B$$ where $$a < b$$.

Visible text: We look for all pairs with and where .

- For $$a=1$$, we get $$1 < 2$$, $$1 < 3$$, $$1 < 4$$. Pairs: $$(1, 2), (1, 3), (1, 4)$$.
- For $$a=2$$, we get $$2 < 3$$, $$2 < 4$$. Pairs: $$(2, 3), (2, 4)$$.
- For $$a=3$$, we get $$3 < 4$$. Pair: $$(3, 4)$$.

Visible text: - For , we get , , . Pairs: .
- For , we get , . Pairs: .
- For , we get . Pair: .

The combination of all these pairs is $$\{(1, 2), (1, 3), (1, 4), (2, 3), (2, 4), (3, 4)\}$$.

Visible text: The combination of all these pairs is .

## Functions as Special Relations

A **function** (or mapping) $$f$$ from a set $$A$$ to a set $$B$$, written $$f: A \to B$$, is a special relation that satisfies two conditions:

Visible text: A **function** (or mapping) from a set to a set , written , is a special relation that satisfies two conditions:

1.  **Every** element $$x \in A$$ must have a pair $$y \in B$$.

    
    
    ```math
    \forall x \in A, \exists y \in B \text{ such that} (x, y) \in f
    ```

2.  Every element $$x \in A$$ has **exactly one** pair $$y \in B$$.

    
    
    ```math
    \text{If } (x, y_1) \in f \text{ and} (x, y_2) \in f, \text{ then} y_1 = y_2
    ```

Visible text: 1. **Every** element must have a pair .

 
 

2. Every element has **exactly one** pair .

This means every member of the domain must be connected, and cannot have more than one connection.

## Arrow Diagram Examples

Here are visual examples of relations using arrow diagrams to distinguish between functions and non-functions.

### Relations That Are Not Functions

Component: ContentStack
Children:
Component: Diagram
Props:
- title: One to Many
- description: Element b has more than one pair.
Children:
Component: RelationVisualizer
Props:
- accessibilityLabel: Arrow diagram of a one-to-many relation
- domainLabel: X
- codomainLabel: Y
- domain: [
{ id: "a", label: "a" },
{ id: "b", label: "b" },
{ id: "c", label: "c" },
]
- codomain: [
{ id: "m", label: "m" },
{ id: "n", label: "n" },
]
- mappings: [
{ from: "a", to: "m" },
{ from: "b", to: "m" },
{ from: "b", to: "n" },
{ from: "c", to: "n" },
]

Component: Diagram
Props:
- title: Domain Element Without a Pair
- description: Element c does not have a pair in the codomain.
Children:
Component: RelationVisualizer
Props:
- accessibilityLabel: Arrow diagram with one unpaired domain element
- domainLabel: X
- codomainLabel: Y
- domain: [
{ id: "a", label: "a" },
{ id: "b", label: "b" },
{ id: "c", label: "c" },
]
- codomain: [
{ id: "m", label: "m" },
{ id: "n", label: "n" },
{ id: "o", label: "o" },
]
- mappings: [
{ from: "a", to: "m" },
{ from: "b", to: "o" },
// 'c' has no mapping
]

### Relations That Are Functions

Component: Diagram
Props:
- title: Exactly One Pair
- description: Each domain element (p, q, r) has exactly one pair.
Children:
Component: RelationVisualizer
Props:
- accessibilityLabel: Arrow diagram of a function relation with exactly one pair
- domainLabel: X
- codomainLabel: Y
- domain: [
{ id: "p", label: "p" },
{ id: "q", label: "q" },
{ id: "r", label: "r" },
]
- codomain: [
{ id: "x", label: "x" },
{ id: "y", label: "y" },
{ id: "z", label: "z" },
]
- mappings: [
{ from: "p", to: "x" },
{ from: "q", to: "y" },
{ from: "r", to: "y" }, // Many-to-one is allowed for functions
]