# Functions as Mappings

Mathematics I · Mathematical Language and Reasoning · https://tryals.app/learn/mathematics-i/functions-as-mappings

## Rules That Assign

A **function** $f : A \to B$ is a rule assigning to _each_ element of the **domain** $A$ exactly _one_ element of the **codomain** $B$. The **image** (range) is the subset of $B$ actually produced; it may be smaller than the whole codomain.

Functions are classified by how they map:

| Property | Definition | Formal Condition |
| --- | --- | --- |
| **Injective** | One-to-one; no input collisions | $f(a) = f(a') \Rightarrow a = a'$ |
| **Surjective** | Onto; codomain is fully covered | Image equals $B$ |
| **Bijective** | Both injective and surjective | Perfect pairing |

Bijections are **invertible**: a bijection $f$ has a unique inverse $f^{-1}$ satisfying $f^{-1}(f(a)) = a$. They formalize equal cardinality, allowing us to compare even infinite sets.

## Composition & Pitfalls

Functions **compose**: for $f : A \to B$ and $g : B \to C$, the composition $(g \circ f)(x) = g(f(x))$ applies $f$ first, then $g$. Composition is associative, and the composition of two bijections is again a bijection.

$$\text{Order matters: } (g \circ f)(x) = g(f(x))$$

> **Common pitfall:** Confusing **injective** with **surjective**, and reading **composition** left to right. Injective forbids input collisions; surjective requires full codomain coverage. In $g \circ f$, the function on the _right_ ($f$) acts _first_. Reversing this order yields the wrong result.

## Practice questions

8 of this lesson's 13 practice questions, with answers. The full set is in the app.

### 1. Let f have domain {-2, -1, 0, 1, 2} and rule f(n) = n squared. How many distinct elements are in its image?

**Answer:** 3

**Why:** The outputs are 4, 1, 0, 1, 4, so the image is {0, 1, 4}, three elements. The domain has five elements but the image only three, which is exactly the failure of injectivity made visible.

Page: https://tryals.app/practice/mathematics-i/functions-as-mappings/let-f-have-domain-2-1-0-1-2-and-rule-f-n-n-squared-how

### 2. Let f(n) = 2n with domain and codomain the integers. Select every integer that IS in the image of f.

A. 7
B. -4
C. 0
D. 10
E. 3

**Answer:** B. -4; C. 0; D. 10

**Why:** -4, 0 and 10 come from n = -2, 0 and 5. But 2n = 3 needs n = 1.5, which is not in the domain, and likewise for 7. The image is exactly the even integers, so f is not surjective onto the integers.

Page: https://tryals.app/practice/mathematics-i/functions-as-mappings/let-f-n-2n-with-domain-and-codomain-the-integers-select-every

### 3. The rule *"send x to its square root"* is not a function on the reals, but √x is. What was fixed?

A. Only the domain, negatives were excluded and the rest follows
B. Nothing was fixed; the two rules are the same and the notation differs
C. Only the output convention, the positive root was selected by agreement
D. Two things: the domain was restricted and one branch was chosen

**Answer:** D. Two things: the domain was restricted and one branch was chosen

**Why:** −4 breaks totality and 9 breaks uniqueness, so both halves of the definition were violated by one rule. √ repairs both, which is why √9 is 3 and not ±3, and why the ± has to be written explicitly when solving x² = 9. The notation is carrying a decision.

Page: https://tryals.app/practice/mathematics-i/functions-as-mappings/the-rule-send-x-to-its-square-root-is-not-a-function-on-the-reals

### 4. A function must assign exactly one output to each input. Why does the "exactly one" requirement do more work than the "at least one" part?

A. Because 'at least one' is automatically satisfied by any correspondence, so it imposes no condition at all.
B. Because it is what makes f(x) denote a determinate object.
C. Because inverse functions require it, and every function must have an inverse.
D. Because a correspondence with several outputs per input would have too many pairs to write down.

**Answer:** B. Because it is what makes f(x) denote a determinate object.

**Why:** Uniqueness is what turns the notation into a name: if f(3) could be 5 or 7 then f(3) + 1 has no value and nothing built on f can be reasoned about. It is also why an inverse need not be a function, reversing y = x² sends 4 to both 2 and −2, which is exactly the situation ruled out, and why inverses require injectivity.

Page: https://tryals.app/practice/mathematics-i/functions-as-mappings/a-function-must-assign-exactly-one-output-to-each-input-why-does-the

### 5. Order the steps of a proof that f(n) = 3n - 2 is injective.

**Answer:**

1. Suppose f(a) = f(b) for some integers a and b
2. Then 3a - 2 = 3b - 2
3. Add 2 to both sides: 3a = 3b
4. Divide by 3: a = b
5. Since equal outputs force equal inputs, f is injective

**Why:** The standard template: assume f(a) = f(b), unwind the rule algebraically, and conclude a = b. Reaching a = b is exactly the definition of injective, so the proof ends there.

Page: https://tryals.app/practice/mathematics-i/functions-as-mappings/order-the-steps-of-a-proof-that-f-n-3n-2-is-injective

### 6. Every function from the integers to the integers is surjective.

**Answer:** False

**Why:** False. f(n) = 2n has codomain the integers but its image is only the even integers, so odd numbers are never reached. Declaring a codomain does not oblige the function to fill it.

Page: https://tryals.app/practice/mathematics-i/functions-as-mappings/every-function-from-the-integers-to-the-integers-is-surjective

### 7. A function assigns exactly one output to each input. Sort each correspondence.

**Answer:**

- Is a function: To each person, their date of birth, To each integer, its square, To each integer, the constant 7
- Not a function: To each person, their sibling, To each positive number, a number whose square is it

**Why:** f2 fails because a person may have several siblings (or none), and f4 fails because 9 maps to both 3 and -3. f5 is a function despite being constant: 'exactly one output' does not require the outputs to differ.

Page: https://tryals.app/practice/mathematics-i/functions-as-mappings/a-function-assigns-exactly-one-output-to-each-input-sort-each

### 8. Complete the definition of an injective function.

**Answer:** A function is injective when different inputs always give **different outputs**.

**Why:** Injective means distinct inputs give distinct outputs, equivalently, f(a) = f(b) forces a = b. Hitting every element of the codomain is a different property: surjectivity.

Page: https://tryals.app/practice/mathematics-i/functions-as-mappings/complete-the-definition-of-an-injective-function
