📘 CodingMarble Learn

Relations and Functions: Cartesian Product, Domain, Range, Graphs

An ordered pair (a, b) has a first and a second place, so (1, 2) ≠ (2, 1). The Cartesian product A × B is the set of all ordered pairs (a, b) with a ∈ A and b ∈ B, and n(A × B) = n(A) × n(B). A relation from A to B is any subset of A × B; its domain is the set of first elements and its range the set of second elements, while B is the co-domain. A function is a special relation where every element of A has exactly one image. We study constant, identity, polynomial, rational, modulus, signum, exponential, log and greatest integer functions with their graphs, and add, subtract, multiply and divide functions point by point.

🎬 Step-by-step story

  1. Blue set A = {1, 2, 3} on the left, red set B = {4, 5, 6} on the right. An arrow goes from every element of A to every element of B. These 9 arrows are A × B.
  2. Keep only three arrows: 1→4, 1→5, 3→5. This smaller set of pairs is a relation. Its domain is {1, 3}, its range is {4, 5}.
  3. Now each element of A sends exactly one arrow: 1→4, 2→4, 3→5. This relation is a function. Two arrows can land on the same point; that is fine.
  4. Switch to a graph. A green vertical line slides across the modulus graph y = |x|. It always cuts the graph once, so it is a function.
  5. Blue f(x) = x and red g(x) = x². At every x, the orange curve adds their heights: (f + g)(x) = x + x².
  6. Free play: pick any function type and slide x to read f(x).

Tip: drag the 3D scene to turn it. Use two fingers to zoom.

🤔 Common doubts, cleared

Why is A × B not the same as B × A?

A × B has pairs with the first entry from A, like (1, 4). B × A has (4, 1). Different pairs, so different sets (only the counts are equal).

What is the difference between range and co-domain?

Co-domain is the whole set B = {4, 5, 6}. Range is only the points that get an arrow. In step 2 no arrow reaches 6, so range = {4, 5}.

Two inputs go to the same output. Is it still a function?

Yes. In step 3, both 1 and 2 go to 4. The rule is only that no input has two arrows.

How do I check from a graph if it is a function?

Slide a vertical line across it, as in step 4. If it ever cuts the graph twice, it is not a function.

Why is f/g not defined at some points?

We cannot divide by zero. At x = 0, g(x) = x² = 0, so (f/g)(0) is not defined. Try the ÷ button in step 5.

Why is [−1.5] = −2 and not −1?

[x] is the greatest integer that is less than or equal to x. −1 is bigger than −1.5, so it is not allowed. Slide x to −1.5 in free play.

Ordered pairs and Cartesian product

An ordered pair (a, b) has a first place and a second place. (a, b) = (c, d) only when a = c and b = d. So (2, 3) ≠ (3, 2).

The Cartesian product A × B = {(a, b) : a ∈ A, b ∈ B}. In step 1 of the 3D, each arrow is one pair.

Relation, domain, co-domain, range

A relation R from A to B is any subset of A × B. We write (a, b) ∈ R or a R b. It is chosen by some rule, like 'b = a + 3'.

If n(A) = p and n(B) = q, then A × B has pq pairs and there are 2^(pq) relations from A to B.

A function is a special relation

A relation f from A to B is a function if every element of A has one and only one image in B. We write f : A → B and y = f(x).

Step 2 shows a relation that fails (1 has two arrows, 2 has none). Step 3 shows a function.

Vertical-line test

For a real function drawn on a graph, every vertical line must meet the graph at most once (step 4).

Types of real functions and their graphs

In the last step of the 3D pick each one and slide x.

Algebra of real functions

For f, g : X → R:

Step 5 builds f + g by stacking heights at each x. The worked example there opens line by line.

Try it

At home: write the names of 4 family members in one column and their birth months in another. Draw arrows. Is 'person → birth month' a function? Is 'month → person' a function? (Hint: can one month have two people? can a month have none?)

In the 3D: in free play, predict [x] at x = −1.5 before you slide. Then check.

Key formulas and definitions

Worked examples

1. If (x + 1, y − 2) = (3, 1), find x and y.

Ordered pairs are equal only when places match: x + 1 = 3 → x = 2; y − 2 = 1 → y = 3.

2. A = {1, 2}, B = {a, b, c}. Write A × B and find n(A × B).

A × B = {(1, a), (1, b), (1, c), (2, a), (2, b), (2, c)}. n = 2 × 3 = 6.

3. A = {1, 2}. Write A × A × A. How many triplets?

{(1,1,1), (1,1,2), (1,2,1), (1,2,2), (2,1,1), (2,1,2), (2,2,1), (2,2,2)}: 2³ = 8 triplets.

4. R = {(x, x + 3) : x ∈ {0, 1, 2, 3}}. Write R in roster form and find its domain and range.

R = {(0, 3), (1, 4), (2, 5), (3, 6)}. Domain = {0, 1, 2, 3}, range = {3, 4, 5, 6}.

5. Which is a function from {1, 2, 3}? (i) {(1, 4), (2, 4), (3, 5)} (ii) {(1, 4), (1, 5), (3, 5)}

(i) Each input has exactly one image: function. (ii) 1 has two images and 2 has none: not a function (steps 2 and 3).

6. Find the domain and range of f(x) = 1/(x − 2).

Denominator cannot be 0, so x ≠ 2: domain = R − {2}. 1/(x − 2) can be any real number except 0: range = R − {0}.

7. Find [3.9], [−3.9], sgn(−7), |−4| + |2|.

[3.9] = 3. [−3.9] = −4 (the greatest integer not more than −3.9). sgn(−7) = −1. |−4| + |2| = 4 + 2 = 6.

8. f(x) = x and g(x) = x². Find (f + g)(2), (f − g)(2), (fg)(2), (f/g)(2) and the domain of f/g.

(f + g)(2) = 2 + 4 = 6. (f − g)(2) = 2 − 4 = −2. (fg)(2) = 8. (f/g)(2) = 2/4 = 1/2. g(0) = 0, so domain of f/g is R − {0} (step 5).

Common mistakes

Practice quiz

1. If n(A) = 3 and n(B) = 4, n(A × B) is:
2. The range of the signum function is:
3. [−1.3] equals:
4. Domain of f(x) = log x is:
5. A relation is a function when each element of the domain has:

Practice: answer these yourself

Type or choose your answer, then press Check. Use a hint if you are stuck; the full solution appears after you answer.

Frequently asked questions

What is the difference between a relation and a function?

Every function is a relation, but a function must give each input exactly one output. A relation can give an input many outputs or none.

What is the signum function?

sgn x = 1 for x > 0, 0 for x = 0 and −1 for x < 0. It tells the sign of x.

What is the range of the greatest integer function?

The set of all integers Z. Its graph looks like steps.

Where this is taught

Canada (Ontario)Grade 11A. Characteristics of Functions
Canada (Ontario)Grade 12D. Characteristics of Functions
ItalySecondaria di secondo grado – classe 1ªRelations and functions
ItalySecondaria di secondo grado – classe 1ªRelations and functions
ItalySecondaria di secondo grado – classe 1ªRelations and functions
ItalySecondaria di secondo grado – classe 2ªRelations and functions
ItalySecondaria di secondo grado – classe 2ªRelations and functions
ItalySecondaria di secondo grado – classe 2ªRelations and functions
PolandLiceum ogólnokształcące, klasa IIFunctions
RomaniaClasa a IX-aAlgebra: Functions
Spain4º ESOAlgebraic sense
Spain4º ESOAlgebraic sense
Ukraine10 класAlgebra: functions, polynomials, equations and inequalities (36 h)
Ukraine10 класAlgebra: functions, their properties and graphs (15 h)
CBSE (India)Class 11Sets and Functions
South Korea고등학교 1학년Functions and graphs
South Korea고등학교 1학년Functions and graphs
Germany (Bavaria)Jahrgangsstufe 11Special properties of functions
Russia10 классFunctions and graphs
Russia10 классFunctions and graphs
China高一Ch.3 Functions

Learn first

Learn next

Related lessons

All Maths lessons