# Lesson 3: Functions

In this lesson, you will learn about functions in Discrete math, their characteristics, function representations, function types, and examples to better understand the topic.

## What is a Function?

A function is a rule that assigns exactly one output to each element of a set. For example, if A and B are two non-empty sets, a function f from A to B is an assignment/relation of one element of set B to each element of set A. the function f is donated by f(a) = b.

Example:

draw image slide 21

Note: Functions are also called mappings or transformations.

## Function Domain and subdomain

For f(a) = b, which represents a function from A to B, we say that A is the domain of f, and B is the codomain.

Example: If f(x) = 2x and f: Z ->Z:

the domain and subdomain of f is Z.

the range of f is the set {0, 2, 4, 6, 8 10….}

image slide 22

## Function representations

You can represent a function in three forms:

• A statement of the assignment – for example: A classroom and students
• A formula –  for example f(x) = x power2
• A computer program: for example, a C++ computer program takes an input x and produces the xth Fibonacci series.

## Function image and preimage

A function image is the element of the output for a given input. In contrast, the preimage is the input sets’ elements mapped to the output set element.

Example:

Giving the two sets A and B: image in slide 25

• The image of d is
• The preimage of y is
• The preimages of z is the set

## Functions characteristics

If ‘f1’ and ‘f2’ are functions from ‘A’ to ‘B’, then ‘f1’ + f2 and f1 X f2 are also functions of A to B for all x E A, donated by:

(f1 + f2) (x) = f1(x) + f2(x)

(f1 x f2) (x) = f1(x) x f2(x)

Practice

If f1 and f2 are functions from R to R such that f1(x) = 2x and f2(x) = x-1. What are the functions f1+f2 and f1f2?

(f1+f2)(x) = f1(x) + f2(x) = 2x+(x-1) = 3x -1
(f1 x f2)(x) = 2x x (x-1)=x2-2x

If f is a function from A to B and S is a subset of A., the image of S under the function f is the subset of B, which is the images of the elements of s. image of S is denoted by f(s).

Example

Consider the two sets, A and B. The function of A to B is as the following

image from slide 26.

What is f(A) and f(b)?

answer , the f(A) = {y,z}

f(B) = {z}

## One to one function

a one-to-one or injunction function is a function that never assigns the same value to two or more different domain elements. In other words, one to one function cannot have two different input values mapped to the same domain element.

one-to-one graph

practice

Is f(x)=x2 and f:N – >N one-to-one?

## Onto function

A onto function, also known as a surjective function, is the function whose every member of the codomain is the image of an element of the domain.

onto function graph

practice:

Is f(x)=x2, where f:N – > N onto?
Is f(x) = x+1 where f:N – >N onto?

## Bijective function

a bijective or one-to-one correspondence function is a one-to-one function and onto simultaneously.

graph for the bijective function