Bijective Functions
Explore bijective functions, which are both injective and surjective, forming one-to-one correspondences between sets. Learn how to identify and verify these functions with practical Python examples. Understand how bijective functions differ from other function types and gain clarity on their role in set theory and mathematics.
We'll cover the following...
Bijective functions
If a function is both injective and surjective, it is called a bijective function— also called a one-to-one correspondence or simply a correspondence. In a bijective function, every element of the domain maps to a unique element of the codomain, and every element in the codomain has a preimage. This means a bijective function pairs up all the domain and codomain elements.
Examples
Take the following sets:
Using these sets, we define the following function:
Because the function
The illustration given below shows the
Here are a few more examples of bijective functions:
Checking if a function is bijective using Python
Let’s explore the following code to check if a given function is a bijective function. Please feel free to make changes and experiment with the given code.
Code explanation
Lines 1–22: We define a
is_functionfunction that takes three arguments, i.e.,domain,codomain, andfunction. It checks if the argumentfunctionis a valid function with thedomainand the ...