MathMaroc Apprendre, Comprendre, Réussir
Sets and Functions — 1st Year Baccalaureate, Mathematical Sciences - 6 sections
🎲 Parcours interactifmathematiques1bac

Sets and Functions — 1st Year Baccalaureate, Mathematical Sciences

Interactive English course on sets and functions: notation, operations, proofs, images and preimages, injectivity, surjectivity, bijectivity and composition.

mohamed Lagzouli

mohamed Lagzouli

Créateur de ce parcours interactif.

Level1bac Track1bac_sm ModuleALGEBRE - 1bac-sm
Course language Français English Português

Home

Mathematics • 1st Year Baccalaureate, Mathematical Sciences

Sets and Functions

MathMaroc Team

Welcome to this interactive course on sets and functions.

In the first part, you will learn to describe, compare and work with sets.

In the second part, you will discover how a function assigns to each element of one set an element of another set, then the notions of injectivity, surjectivity, bijectivity and composition.

The goal is not only to know the definitions: you will observe, try, reason, solve problems and check your understanding step by step.

Course objectives

By the end of this lesson, you should be able to:

  • use \( \in \), \( \notin \) and \( \subset \) correctly;
  • write a set in roster form or in set-builder form;
  • compare two sets;
  • determine the power set of a set;
  • compute an intersection and a union;
  • use the complement and the difference;
  • understand the Cartesian product;
  • prove an inclusion or an equality of sets;
  • recognise a function;
  • identify the domain and the codomain;
  • determine images and preimages;
  • determine a direct image or an inverse image;
  • understand restriction and extension;
  • study injectivity and surjectivity;
  • recognise a bijection;
  • determine the inverse function of a bijection;
  • compose two functions.

Prerequisites

Before starting, it helps to know the usual number sets:

\[ \mathbb{N},\quad \mathbb{Z},\quad \mathbb{Q},\quad \mathbb{R} \]

You will also use the logical connectives:

  • “and”;
  • “or”;
  • “not”;
  • implication.

Quick diagnostic

This diagnostic is not graded. It simply tells you which ideas deserve a reminder.

Question 1

\[ 5\in\mathbb{N} \]

True or false?

Show the answer

Question 2

Consider:

\[ E=\{1,2,3,4\} \]

Which statement is correct?

  1. \(2\in E\)
  2. \(2\subset E\)
Show the answer

Question 3

\[ \{1,3\}\subset\{1,2,3,4\} \]

True or false?

Show the answer

Question 4

Let:

\[ f(x)=x^2 \]

What is the image of \(3\)?

Show the answer

Question 5

If:

\[ f(2)=5 \]

then \(2\) is:

  1. the image of \(5\)
  2. a preimage of \(5\)
Show the answer

Question 6

We know that:

\[ f(2)=4 \qquad\text{and}\qquad f(-2)=4 \]

Can we already suspect that \(f\) is not injective?

Show the answer

Reading your diagnostic

5 or 6 correct answers

A very good start. You can move straight on.

3 or 4 correct answers

A good start. Some ideas will be consolidated during the course.

0 to 2 correct answers

A few basics need strengthening. Take your time with the reminders and the examples.

Free preview

Discover a few key ideas before starting the full course.

Activity 1 — Membership or inclusion?

Consider:

\[ E=\{1,2,3,4,5\} \]

\(3\in E\)

True

\(\{3\}\subset E\)

True

\(3\subset E\)

False

\(\{3\}\in E\)

False

\(\varnothing\subset E\)

True

\(x\in E\) is about an element.

\(A\subset E\) is about a set.

Activity 2 — Union and intersection

Consider:

\[ A=\{1,2,3\} \]
\[ B=\{2,3,4\} \]

The elements common to both sets are:

\[ A\cap B=\{2,3\} \]

The elements belonging to at least one of the two sets are:

\[ A\cup B=\{1,2,3,4\} \]

Activity 3 — A first example of a function

Consider:

\[ f:\{1,2,3\}\to\{2,4,6,8\} \]
\[ f(1)=2,\qquad f(2)=4,\qquad f(3)=6 \]

Question 1

What is the image of \(2\)?

Show the answer

Question 2

What is a preimage of \(6\)?

Show the answer

Question 3

Does \(8\) have a preimage in \(\{1,2,3\}\) under this function?

Show the answer

You have just met three key ideas of this chapter. The full course will help you understand these concepts, apply them and prove related properties.

Continue the lesson

Core lesson

This chapter has two main parts: sets, then functions.

Part A — Sets

A1 — Set, element and notation

A set is a collection of objects called its elements.

Example:

\[ E=\{1,2,3\} \]

We write:

\[ 2\in E \]

and:

\[ 5\notin E \]

The empty set

The set with no element at all is written:

\[ \varnothing \]

Careful:

\[ \varnothing\neq\{\varnothing\} \]

\(\varnothing\) has no element, whereas \(\{\varnothing\}\) has one element.

Singleton

\[ \{5\} \]

is a singleton.

Pair

\[ \{3,7\} \]

is a pair.

A2 — Roster form and set-builder form

Roster form

The elements are listed explicitly.

\[ A=\{0,2,4,6,8\} \]

Set-builder form

The elements are described by a property.

\[ A= \{x\in\mathbb{N}\mid x<10\text{ and }x\text{ is even}\} \]

One and the same collection can therefore be described in several ways.

A3 — Inclusion

We say that \(A\) is included in \(B\) if every element of \(A\) belongs to \(B\).

\[ A\subset B \]

means:

\[ x\in A\Rightarrow x\in B \]

Example:

\[ E=\{0,2,4,6,8,10\} \]
\[ F=\{10,2,8\} \]

Then:

\[ F\subset E \]

Properties

\[ \varnothing\subset A \]
\[ A\subset A \]
\[ A\subset B \text{ and } B\subset C \Rightarrow A\subset C \]

A4 — Equality of two sets

Two sets are equal when they have exactly the same elements.

\[ A=B \]

A fundamental method is to establish two inclusions:

\[ A\subset B \]

then:

\[ B\subset A \]

We then conclude:

\[ A=B \]

A5 — The power set

The set of all subsets of \(E\) is written:

\[ \mathcal{P}(E) \]

Example:

\[ E=\{1,2,3\} \]

Then:

\[ \mathcal{P}(E)= \{ \varnothing, \{1\}, \{2\}, \{3\}, \{1,2\}, \{1,3\}, \{2,3\}, \{1,2,3\} \} \]

A6 — Intersection

The intersection of \(A\) and \(B\) contains the elements that belong to both sets at the same time.

\[ A\cap B= \{x\mid x\in A\text{ and }x\in B\} \]

Example:

\[ A=\{2,5,7\}, \qquad B=\{1,5,7,9\} \]
\[ A\cap B=\{5,7\} \]

A7 — Union

The union of \(A\) and \(B\) contains the elements belonging to \(A\) or to \(B\).

\[ A\cup B= \{x\mid x\in A\text{ or }x\in B\} \]

With:

\[ A=\{2,5,7\}, \qquad B=\{1,5,7,9\} \]

we obtain:

\[ A\cup B=\{1,2,5,7,9\} \]

A8 — Complement

Let \(A\subset E\). The complement of \(A\) in \(E\) contains the elements of \(E\) that do not belong to \(A\).

\[ \overline{A} = \{x\in E\mid x\notin A\} \]

A9 — Difference

The difference \(A\setminus B\) contains the elements belonging to \(A\) but not to \(B\).

\[ A\setminus B = \{x\mid x\in A\text{ and }x\notin B\} \]

A10 — Symmetric difference

This idea may be studied as an extension.

\[ A\triangle B = (A\setminus B)\cup(B\setminus A) \]

We can also write:

\[ A\triangle B = (A\cup B)\setminus(A\cap B) \]

A11 — Properties of intersection and union

Commutativity

\[ A\cap B=B\cap A \]
\[ A\cup B=B\cup A \]

Associativity

\[ A\cap(B\cap C) = (A\cap B)\cap C \]
\[ A\cup(B\cup C) = (A\cup B)\cup C \]

Distributivity

\[ A\cap(B\cup C) = (A\cap B)\cup(A\cap C) \]
\[ A\cup(B\cap C) = (A\cup B)\cap(A\cup C) \]

A12 — De Morgan's laws

\[ \overline{A\cup B} = \overline A\cap\overline B \]
\[ \overline{A\cap B} = \overline A\cup\overline B \]

A13 — Cartesian product

The Cartesian product of \(A\) and \(B\) is the set of ordered pairs \((x,y)\) such that \(x\in A\) and \(y\in B\).

\[ A\times B \]

Example:

\[ A=\{1,2\}, \qquad B=\{a,b,c\} \]
\[ A\times B= \{ (1,a),(1,b),(1,c), (2,a),(2,b),(2,c) \} \]

A14 — Reasoning with sets

To prove a property about sets, we often translate membership into logical statements.

For example:

\[ x\in A\cap(B\cup C) \]

means:

\[ x\in A \text{ and } (x\in B\text{ or }x\in C) \]

which is equivalent to:

\[ (x\in A\text{ and }x\in B) \text{ or } (x\in A\text{ and }x\in C) \]

Therefore:

\[ x\in (A\cap B)\cup(A\cap C) \]

Part B — Functions

B1 — The idea of a function

Let \(E\) and \(F\) be two non-empty sets.

A function from \(E\) to \(F\) assigns to each element of \(E\) exactly one element of \(F\).

In this course, “function” always means this: every element of the starting set has one and only one image. Some textbooks call it a map; the two words mean the same thing here.

\[ f:E\to F \]
\[ x\longmapsto f(x) \]
  • \(E\): the domain (starting set);
  • \(F\): the codomain (arrival set);
  • \(f(x)\): the image of \(x\).

B2 — Image and preimage

If:

\[ f(x)=y \]

then \(y\) is the image of \(x\), and \(x\) is a preimage of \(y\).

An element of the codomain may have:

  • no preimage;
  • one preimage;
  • several preimages.

B3 — Equality of two functions

Two functions are equal when they have:

  • the same domain;
  • the same codomain;
  • the same image for every element of the domain.
\[ \forall x\in E,\quad f(x)=g(x) \]

B4 — Direct image of a subset

Let:

\[ f:E\to F \]

and:

\[ A\subset E \]

The direct image of \(A\) is:

\[ f(A)=\{f(x)\mid x\in A\} \]

Example:

\[ f(x)=x^2 \]
\[ A=\{-2,-1,0,1,2\} \]

Then:

\[ f(A)=\{0,1,4\} \]

B5 — Inverse image of a subset

For \(B\subset F\), we define:

\[ f^{-1}(B) = \{x\in E\mid f(x)\in B\} \]

Example:

\[ f(x)=x^2 \]

Then:

\[ f^{-1}(\{1\}) = \{-1,1\} \]

Careful: here \(f^{-1}(B)\) denotes the inverse image of a subset.

This does not necessarily mean that \(f\) has an inverse function.

B6 — Restriction

A function can be limited to a subset of its domain.

For example:

\[ f:\mathbb{R}\to\mathbb{R} \]
\[ f(x)=x^2 \]

We may consider the restriction of \(f\) to:

\[ [0,+\infty[ \]

Reading the interval notation: a bracket turned inwards includes the endpoint, a bracket turned outwards excludes it. So \([0,+\infty[\) contains \(0\) and every number greater than \(0\). This is the notation used in the Moroccan curriculum; some English textbooks write the same set differently.

B7 — Extension

An extension consists in extending a function to a larger set while keeping its values on the set where it was already defined.

A restriction is determined uniquely, whereas a function can generally admit several extensions.

B8 — Injectivity

A function \(f:E\to F\) is injective if every element of \(F\) has at most one preimage.

\[ f(x)=f(x') \Rightarrow x=x' \]

Example:

\[ f(x)=2x+1 \]

If:

\[ f(x)=f(x') \]

then:

\[ 2x+1=2x'+1 \]

so:

\[ x=x' \]

The function is therefore injective.

B9 — Surjectivity

A function \(f:E\to F\) is surjective if every element of \(F\) has at least one preimage.

\[ \forall y\in F,\quad \exists x\in E \text{ such that } f(x)=y \]

B10 — Bijectivity

A function is bijective when every element of the codomain has exactly one preimage.

\[ f\text{ bijective} \Longleftrightarrow f\text{ injective and surjective} \]

B11 — Inverse function

If:

\[ f:E\to F \]

is bijective, it has an inverse function:

\[ f^{-1}:F\to E \]

because:

\[ f^{-1}(y)=x \Longleftrightarrow f(x)=y \]

B12 — Composition of functions

Let:

\[ f:E\to F \]

and:

\[ g:F\to G \]

The composite of \(f\) followed by \(g\) is:

\[ g\circ f:E\to G \]

with:

\[ (g\circ f)(x)=g(f(x)) \]

In general:

\[ g\circ f\neq f\circ g \]

Composition of functions is therefore generally not commutative.

B13 — Inverse and composition

If \(f:E\to F\) is bijective, then:

\[ f^{-1}\circ f=Id_E \]

and:

\[ f\circ f^{-1}=Id_F \]

Worked examples

Watch the method before trying on your own. Use the hints only if you need them.

Example 1 — From set-builder form to roster form

Write in roster form:

\[ A= \{x\in\mathbb{Z}\mid -2\leq x\leq3\} \]
Hint 1

Look for all the integers between \(-2\) and \(3\).

Solution
\[ A=\{-2,-1,0,1,2,3\} \]

Key point: set-builder form gives a condition; roster form lists the elements.

Example 2 — Proving an equality of sets

To prove:

\[ A=B \]

a very important method is to prove in turn:

\[ A\subset B \]

then:

\[ B\subset A \]

We can then conclude:

\[ A=B \]

Key point: this method is called double inclusion.

Example 3 — Intersection and union of intervals

Let:

\[ A=[1,3] \]
\[ B=[2,4] \]

Determine \(A\cap B\) and \(A\cup B\).

Hint

For the intersection, keep the real numbers belonging to both intervals at the same time.

Solution
\[ A\cap B=[2,3] \]
\[ A\cup B=[1,4] \]

Example 4 — Using one of De Morgan's laws

Complete:

\[ \overline{A\cup B} = \ldots \]
Solution
\[ \overline{A\cup B} = \overline A\cap\overline B \]

Example 5 — Image and preimage

Let:

\[ f(x)=2x+1 \]

Determine the image of \(3\).

Solution
\[ f(3)=2\times3+1=7 \]

So \(7\) is the image of \(3\), and \(3\) is a preimage of \(7\).

Example 6 — Inverse image

Let:

\[ f:\mathbb{R}\to\mathbb{R}, \qquad f(x)=x^2 \]

Determine:

\[ f^{-1}(\{1\}) \]
Hint 1

Solve:

\[ x^2=1 \]
Solution
\[ x=-1 \quad\text{or}\quad x=1 \]

Therefore:

\[ f^{-1}(\{1\}) = \{-1,1\} \]

Example 7 — Testing injectivity

Let:

\[ f:\mathbb{R}\to\mathbb{R}, \qquad f(x)=x^2 \]

We observe:

\[ f(2)=4 \]
\[ f(-2)=4 \]

but:

\[ 2\neq -2 \]

So two distinct elements have the same image.

\(f\) is not injective on \(\mathbb{R}\).

What happens if we restrict \(f\) to \([0,+\infty[\)?

Example 8 — Composition

Let:

\[ f(x)=2x+1 \]
\[ g(x)=x^2 \]

Then:

\[ (g\circ f)(x) = g(2x+1) = (2x+1)^2 \]

whereas:

\[ (f\circ g)(x) = 2x^2+1 \]

Therefore:

\[ g\circ f\neq f\circ g \]

Interactive exercises

Work your way from elementary checks to exercises that call for genuine reasoning. Look for each answer yourself before revealing it.

Level 1 — Consolidation

Quick check — Operations on sets

Four checks to do in your head. If one of them resists, go back to Part A of the Core lesson before continuing.

Let:

\[ A=\{1,2,3\},\qquad B=\{0,1,2,3\},\qquad E=\{1,2\} \]

a) Determine \(A\cap B\).

Show the answer

b) Determine \(A\cup B\).

Show the answer

c) Determine \(\mathcal{P}(E)\).

Show the answer

d) Determine the complement of \(]-\infty,0]\) in \(\mathbb{R}\).

Show the answer

Exercise 1 — Images and preimages of an affine function

Consider the function:

\[ f:\mathbb{R}\to\mathbb{R},\qquad f(x)=3x+2 \]

a) Compute \(f(2)\), \(f(0)\) and \(f(-1)\).

Show the answer

b) Determine the preimage of \(8\) under \(f\), then that of \(0\).

Show the hint
Show the answer

c) Show that every real number \(y\) has a unique preimage under \(f\).

Show the hint
Show the answer

Level 2 — Mastery

Exercise 2 — Direct image, inverse image and bijection

What you have established. In Exercise 1 you showed that for \(f:\mathbb{R}\to\mathbb{R}\), \(f(x)=3x+2\), every real number \(y\) has a unique preimage, namely \(x=\dfrac{y-2}{3}\). We now build on that result.

a) Determine the direct image \(f([0;2])\).

Show the hint
Show the answer

b) Determine the inverse image \(f^{-1}(]-1;5])\).

Show the hint
Show the answer

c) Using the result of Exercise 1 c), show that \(f\) is bijective and write \(f^{-1}\) explicitly.

Show the hint
Show the answer

Exercise 3 — Direct and inverse images of \(x\mapsto x^2\)

Consider the function:

\[ f:\mathbb{R}\to\mathbb{R},\qquad f(x)=x^2 \]

a) Solve the inequality \(1\leqslant x^2\leqslant 4\) in \(\mathbb{R}\).

Show the hint
Show the answer

b) Deduce \(f^{-1}([1;4])\).

Show the answer

c) Determine \(f^{-1}([-4;-1])\).

Show the hint
Show the answer

d) Determine the direct image \(f([-2;1])\).

Show the hint
Show the answer

Exercise 4 — Injectivity, surjectivity, restriction

a) Let \(f:\mathbb{R}\to\mathbb{R}\), \(f(x)=2x+1\). Is \(f\) injective? Justify.

Show the hint
Show the answer

b) Is \(f\) surjective? Deduce that it is bijective.

Show the answer

c) Let \(g:\mathbb{R}\to\mathbb{R}\), \(g(x)=x^2\). Is \(g\) injective? surjective?

Show the hint
Show the answer

d) Consider the two functions:

\[ g_1:[0;+\infty[\;\to\;\mathbb{R},\quad g_1(x)=x^2 \qquad\text{and}\qquad g_2:[0;+\infty[\;\to\;[0;+\infty[,\quad g_2(x)=x^2 \]

Study the injectivity and the surjectivity of \(g_1\), then of \(g_2\). Conclude for each one.

Show the hint
Show the answer

Key method. \(g_1\) and \(g_2\) have the same formula and the same domain: they differ only in their codomain, and yet one is bijective and the other is not.

Injectivity is read off the domain: restricting the domain can make it appear, as here when passing from \(\mathbb{R}\) to \([0;+\infty[\).

Surjectivity, on the other hand, is always judged against the codomain that has been chosen. If some elements of the codomain have no preimage, restricting the domain cannot make the function surjective. One may then choose the image of the function as the codomain.

Hence the writing rule: a conclusion about bijectivity must always name both sets. Writing “\(x\mapsto x^2\) is bijective on \([0;+\infty[\)” is incomplete; writing “\(g_2:[0;+\infty[\to[0;+\infty[\) is bijective” is exact.

Level 3 — Reasoning

Exercise 5 — De Morgan's law by double inclusion

Let \(A\) and \(B\) be two subsets of a set \(E\). We want to establish:

\[ \overline{A\cap B}=\overline{A}\cup\overline{B} \]

a) Let \(x\in\overline{A\cap B}\). Translate this membership using “not”, “and”, “or”.

Show the hint
Show the answer

b) Deduce the inclusion \(\overline{A\cap B}\subset\overline{A}\cup\overline{B}\).

Show the answer

c) Prove the reverse inclusion.

Show the hint
Show the answer

d) Conclude.

Show the answer

Exercise 6 — Composition and characterisation

Let two functions:

\[ f:E\to F\qquad\text{and}\qquad g:F\to G \]

a) Show that if \(f\) and \(g\) are injective, then \(g\circ f\) is injective.

Show the hint
Show the answer

b) Show that if \(f\) and \(g\) are surjective, then \(g\circ f\) is surjective.

Show the hint
Show the answer

c) Deduce the case where \(f\) and \(g\) are bijective.

Show the answer

Exercise 7 — Inverse function (extension)

Let \(f:E\to F\) be a bijective function, with inverse \(f^{-1}:F\to E\).

a) Show that \(f^{-1}\circ f=Id_E\).

Show the hint
Show the answer

b) Show that \(f\circ f^{-1}=Id_F\).

Show the hint
Show the answer

Final quiz

Now check your mastery of sets and functions.

Question 1

Let:

\[ E=\{1,2,3\} \]

Which statement is correct?

  1. \(2\subset E\)
  2. \(2\in E\)
Show the solution

Answer: B.

Question 2

\[ \varnothing\subset E \]

True or false?

Show the solution

Answer: True.

Question 3

Let:

\[ A=\{1,2,3\}, \qquad B=\{2,3,4\} \]

Determine:

\[ A\cap B \]
Show the solution

\[ A\cap B=\{2,3\} \]

Question 4

For the same sets, determine:

\[ A\cup B \]
Show the solution

\[ A\cup B=\{1,2,3,4\} \]

Question 5

Let:

\[ E=\{a,b\} \]

How many elements does \(\mathcal{P}(E)\) have?

Show the solution

Answer: \(4\).

Question 6

Complete:

\[ \overline{A\cup B} = \ldots \]
Show the solution

\[ \overline{A\cup B} = \overline A\cap\overline B \]

Question 7

If:

\[ f(3)=7 \]

then \(7\) is:

  1. the image of \(3\)
  2. a preimage of \(3\)
Show the solution

Answer: A.

Question 8

If two different elements have the same image, can the function be injective?

Show the solution

Answer: No.

Question 9

A surjective function satisfies:

  1. every element of the codomain has at least one preimage;
  2. every element of the domain has two images;
  3. no image can be repeated.
Show the solution

Answer: A.

Question 10

A bijective function is:

  1. only injective;
  2. only surjective;
  3. injective and surjective.
Show the solution

Answer: C.

Question 11

Let:

\[ f(x)=2x+1 \]
\[ g(x)=x^2 \]

Compute:

\[ (g\circ f)(1) \]

We have:

\[ f(1)=3 \]

then:

\[ g(3)=9 \]
Show the solution

Answer: \(9\).

Question 12 — Reasoning

Let:

\[ f:\mathbb{R}\to\mathbb{R} \]
\[ f(x)=x^2 \]

Why is \(f\) not injective?

Show the solution

Because two distinct elements can have the same image. For example:

\[ f(2)=f(-2)=4 \]

with:

\[ 2\neq-2 \]

Your mastery report

The final result should not be reduced to a single overall mark. The course can distinguish the following skills:

  • Notation and inclusion
  • Operations on sets
  • Set-theoretic proofs
  • Images and preimages
  • Direct image and inverse image
  • Injectivity
  • Surjectivity
  • Bijectivity
  • Composition

🤖 IA pédagogique adaptative

Choisis le type d’aide dont tu as besoin. L’assistant utilisera le contexte de cette page.

Sets and Functions — 1st Year Baccalaureate, Mathematical Sciences mathematiques 1bac parcours interactif
Le système prépare une demande structurée. Il évite les réponses longues et pousse l’élève à comprendre étape par étape.