Functions

Every vending machine obeys one silent rule: press button B3, and you get exactly one snack — never two, never none. That rule is what mathematics calls a function: a relation from a set AA to a set BB in which every input is tied to exactly one output. It is the single most useful idea in the "Relations and Functions" chapter, because almost every equation you will meet from here on — y=2x+1y = 2x+1, y=x2y = x^2, y=sin⁡xy = \sin x — is really a compact machine of this kind. This article builds the definition from the relation you already know, gives you the vertical line test to spot a function on a graph, shows how two functions can be added, multiplied or divided to make new ones, and works a full numeric example so the rule stops being abstract and starts being arithmetic.

The core insight

A function f:A→Bf : A \to B is a relation in which every element of AA has exactly one image in BB, checked visually by the vertical line test and combined algebraically through pointwise operations like (f+g)(x)=f(x)+g(x)(f+g)(x) = f(x) + g(x).

The core idea

A relation becomes a function the moment it obeys strict discipline. Formally, f:A→Bf : A \to B is a function if every a∈Aa \in A has an image in BB, and that image is unique — no element of AA is ever sent to two different places. Written as ordered pairs, ff is a subset of A×BA \times B satisfying:

(i) ∀a∈A, ∃ b∈B:(a,b)∈f,(ii) (a,b1),(a,b2)∈f  ⟹  b1=b2.\text{(i) } \forall a \in A,\ \exists\, b \in B: (a,b) \in f, \qquad \text{(ii) } (a,b_1), (a,b_2) \in f \implies b_1 = b_2.

where: condition (i) says nothing in AA is left unpaired, and condition (ii) says nothing in AA is paired twice with different outputs. For each aa, the unique matching value is f(a)f(a), called the image of aa; aa is the pre-image of f(a)f(a). Three sets travel with every function. The domain is AA itself. The co-domain is the declared target set BB. The range is {f(a):a∈A}\{f(a) : a \in A\}, the collection of values actually hit — always a subset of the co-domain, sometimes a proper one.

Reading a graph. For f:R→Rf : \mathbb{R} \to \mathbb{R} plotted on the Cartesian plane, condition (ii) has a beautifully visual twin: the graph represents a function only if every vertical line x=cx = c crosses it at most once. Two crossings on one vertical line would mean one input mapped to two outputs — exactly what a function forbids.

Figure
Two graphs side by side, a curve crossed once by every vertical line labelled a function, and a circle crossed twice by one vertical line labelled not a function
The vertical line test function — one crossing not a function — two crossings

Algebra of functions. Once two functions ff and gg share a common domain, new functions can be built pointwise, by combining the two output numbers at each shared input:

(f+g)(x)=f(x)+g(x),(f−g)(x)=f(x)−g(x),(fg)(x)=f(x) g(x),(fg)(x)=f(x)g(x)  for g(x)≠0.(f+g)(x) = f(x)+g(x), \qquad (f-g)(x) = f(x)-g(x), \qquad (fg)(x) = f(x)\,g(x), \qquad \left(\frac{f}{g}\right)(x) = \frac{f(x)}{g(x)}\ \text{ for } g(x)\neq 0.

where: each new rule is evaluated by first computing f(x)f(x) and g(x)g(x) separately, then combining the two numbers; the quotient additionally drops every xx where g(x)=0g(x) = 0, since division by zero is undefined. For a scalar kk, (kf)(x)=k⋅f(x)(kf)(x) = k\cdot f(x) scales every output by kk.

Derivation

Derivation AWhy the vertical line test is equivalent to the function definition

The goal is to show, without any new machinery beyond the definition of a function and the meaning of a Cartesian graph, that "every vertical line meets the graph at most once" is not a separate rule to memorise but a direct restatement of condition (ii) — so a student can trust the picture exactly as much as the algebra.

Step 1. Set up the correspondence. For f:R→Rf : \mathbb{R} \to \mathbb{R}, the graph of ff is the set of points {(x,f(x)):x∈domain}\{(x, f(x)) : x \in \text{domain}\}, plotted with xx horizontal and y=f(x)y = f(x) vertical. A vertical line x=cx = c is the set of all points with first coordinate cc, for every possible yy.

Step 2. Translate "the line meets the graph" into function language. A point (c,y)(c, y) lies on both the vertical line x=cx=c and the graph exactly when y=f(c)y = f(c) for some valid yy — that is, exactly when cc is in the domain and produces the image f(c)f(c).

Step 3. Count the crossings. Suppose the vertical line x=cx = c met the graph at two distinct points, (c,y1)(c, y_1) and (c,y2)(c, y_2) with y1≠y2y_1 \neq y_2. By Step 2 this means y1=f(c)y_1 = f(c) and y2=f(c)y_2 = f(c) simultaneously — the same input cc mapped to two different outputs. That is precisely a violation of condition (ii), the "exactly one image" rule.

Step 4. Conclude the equivalence. If ff is a genuine function, condition (ii) rules out two different yy-values for the same cc, so every vertical line meets the graph at most once. Conversely, if some vertical line meets a curve twice, that curve encodes two outputs for one input, so it cannot be the graph of a function. The graphical test and the algebraic definition check the same fact from two directions.

Worked example

Let A={1,2,3,4}A = \{1,2,3,4\}, with f:A→Rf : A \to \mathbb{R} given by f(x)=2x+1f(x) = 2x+1, and let g(x)=x+3g(x) = x+3 with domain R\mathbb{R}. Verify ff is a function and find its range; then compute (f+g)(x)(f+g)(x) and (fg)(x)(fg)(x), and evaluate both at x=2x=2.

Step 1. Compute the images of ff on AA: f(1)=3, f(2)=5, f(3)=7, f(4)=9f(1)=3,\ f(2)=5,\ f(3)=7,\ f(4)=9, so f={(1,3),(2,5),(3,7),(4,9)}f = \{(1,3),(2,5),(3,7),(4,9)\}. Every element of AA appears exactly once as a first entry, each tied to a single output — both conditions of a function hold. Domain =A={1,2,3,4}=A=\{1,2,3,4\}, range ={3,5,7,9}=\{3,5,7,9\}.

Step 2. Build the sum: (f+g)(x)=(2x+1)+(x+3)=3x+4(f+g)(x) = (2x+1)+(x+3) = 3x+4. At x=2x=2: using f(2)=5f(2)=5 and g(2)=2+3=5g(2)=2+3=5, the sum is 5+5=105+5=10, matching 3(2)+4=103(2)+4=10.

Step 3. Build the product: (fg)(x)=(2x+1)(x+3)=2x2+7x+3(fg)(x) = (2x+1)(x+3) = 2x^2+7x+3. At x=2x=2: directly, f(2)⋅g(2)=5×5=25f(2)\cdot g(2) = 5 \times 5 = 25, matching 2(4)+14+3=252(4)+14+3=25.

Answer: ff is a function with range {3,5,7,9}\{3,5,7,9\}; (f+g)(x)=3x+4(f+g)(x) = 3x+4 giving 1010 at x=2x=2; (fg)(x)=2x2+7x+3(fg)(x) = 2x^2+7x+3 giving 25\mathbf{25} at x=2x=2.

Common traps

  • Treating every relation as a function. A relation only qualifies once every element of AA has exactly one image — missing outputs or repeated outputs for the same input both disqualify it.
  • Mixing up range and co-domain. The co-domain is the declared target set BB; the range is only what actually gets hit, so range ⊆\subseteq co-domain, not always equal.
  • Forgetting the domain restriction on a quotient. (fg)(x)\left(\dfrac{f}{g}\right)(x) is undefined wherever g(x)=0g(x)=0; leaving those points in the domain is a scoring error.
  • Reaching for one-one, onto, or inverse language. These classifications belong to a later class; this syllabus asks only for the basic definition, domain and range, and the four algebraic operations.

Ask the tutor: Want to try a relation that almost passes the function test, or practise building (f−g)(x)(f-g)(x) and (f/g)(x)(f/g)(x) from a fresh pair of formulas? Ask the AI tutor to walk through more with you.

How is a function different from a relation, in one line I can remember?

A relation is just any pairing between two sets — inputs can repeat, be missing, or point to several outputs at once. A function tightens this to one strict rule: every input in the domain must have an output, and it must have only one. So every function is a relation, but not every relation is a function; the extra "exactly one" condition is the whole difference.

Why does the quotient of two functions need g(x) not equal to zero, but the sum and product do not?

Addition, subtraction and multiplication of two real numbers are always defined, so as long as f(x)f(x) and g(x)g(x) both exist, (f+g)(x)(f+g)(x), (f−g)(x)(f-g)(x) and (fg)(x)(fg)(x) automatically exist too. Division is different: f(x)/g(x)f(x)/g(x) asks you to divide by g(x)g(x), and division by zero has no meaning. So the quotient function's domain is the shared domain of ff and gg with every zero of gg removed.

Do I need to worry about one-one or onto functions for this chapter?

No — injective (one-one), surjective (onto) and bijective functions, along with inverse functions, are Class 12 topics and are not tested here. For this chapter, focus on the core definition of a function, identifying domain, co-domain and range, using the vertical line test, and computing the algebra of functions (sum, difference, product, quotient). Composition of functions may be mentioned briefly but is not examined at this level.

Before this

Where this leads