Mathematics.

relations

Functions

Foundations25 minDifficulty2 out of 10

You should know: natural numbers

Overview

A function is a rule that assigns exactly one output to each input from a given set. Functions are the central object of essentially all of mathematics beyond arithmetic — calculus studies how functions change, linear algebra studies a special class of functions (linear transformations), and analysis studies which functions are continuous, differentiable, or integrable.

Intuition

Think of a function as a machine: you feed it an input, it processes it, and exactly one output comes out the other side. Put the same input in twice, you always get the same output — that determinism is the whole definition. A vending machine is a function from button-presses to snacks; it would be broken (not a function) if pressing B4 sometimes gave you chips and sometimes gave you nothing.

Interactive Graph

Explore any function f(x)

Loading visualization…

Formal Definition

Definition

A function f from a set A (the domain) to a set B (the codomain) assigns to every element of A exactly one element of B.

f:ABf: A \to B

f is a function from A to B

aA, !bB such that f(a)=b\forall a \in A,\ \exists! b \in B \text{ such that } f(a) = b

Every input has exactly one output (the ! means 'exactly one')

Notation

NotationMeaning
f(x)f(x)The output of function f when the input is x
dom(f)\operatorname{dom}(f)The domain: the set of valid inputs
range(f)\operatorname{range}(f)The set of actual outputs produced
f:ABf: A \to Bf maps elements of A to elements of B

Properties

Injective (one-to-one)

f(a1)=f(a2)a1=a2f(a_1) = f(a_2) \Rightarrow a_1 = a_2

Example: f(x) = 2x is injective; f(x) = x^2 on all reals is not (f(-2)=f(2)).

Surjective (onto)

bB, aA with f(a)=b\forall b \in B,\ \exists a \in A \text{ with } f(a) = b

Bijective

Both injective and surjective – has a well-defined inverse function.\text{Both injective and surjective -- has a well-defined inverse function.}

Applications

Every pure function in programming is a mathematical function: same input, same output, no side effects.

Worked Examples

  1. Every real x squared gives exactly one real output, so yes, it's a function.

    f:RRf: \mathbb{R} \to \mathbb{R}
  2. But f(-3) = 9 = f(3), two different inputs give the same output.

    f(3)=f(3)=9f(-3)=f(3)=9

Answer: It is a function, but not injective.

Practice Problems

Difficulty 2/10

Which of the following relations is NOT a function of x?

Difficulty 4/10

A parking garage charges a $5 base fee plus $2 per hour. Write the cost as a function C(h) of hours parked, and find the cost for 3.5 hours.

Difficulty 5/10

A projectile's height is h(t) = 20t − 5t² (metres, t in seconds). What is the realistic domain of this function, and why?

Common Mistakes

Common Mistake

Assuming every equation relating x and y is a function of x.

A relation is only a function if every x-value maps to exactly one y-value (the vertical line test).

Quiz

What property must every function satisfy?

Flashcards

1 / 2

Historical Background

The word 'function' was introduced by Gottfried Wilhelm Leibniz in 1673, though the underlying concept — a quantity depending on another — appears implicitly in Descartes' analytic geometry. The modern set-theoretic definition (a function as a set of ordered pairs) was formalized in the early 20th century, notably through the work of Nicolas Bourbaki.

  1. 1673

    Leibniz introduces the term 'function'

    Gottfried Wilhelm Leibniz

  2. 1837

    Dirichlet gives the modern general definition: a function is any rule assigning outputs to inputs

    Peter Gustav Lejeune Dirichlet

  3. 20th century

    Set-theoretic formalization as a set of ordered pairs (Bourbaki)

Summary

  • A function assigns exactly one output to each input.
  • Domain = valid inputs, range = actual outputs, codomain = the target set.
  • Injective: no two inputs share an output. Surjective: every codomain element is reached. Bijective: both.
  • The vertical line test checks whether a graph represents a function of x.
  • Functions are the basic object of study in calculus, analysis, and much of modern mathematics.

References