# Inverse functions and composition of functions

**Inverse Functions –**

In mathematics a function, a, is said to be an inverse of another, b, if given the output of b a returns the input value given to b. Additionally, this must hold true for every element in the domain co-domain(range) of b. In other words, assuming x and y are constants, if b(x) = y and a(y) = x then the function a is said to be an inverse of the function b.

**Example of Inverse Function –**

Consider the functions a(x) = 5x + 2 and b(y) = (y-2)/5. Here function b is an inverse function of a. We can see this by inserting values into the functions. For example when x is 1 the output of a is a(1) = 5(1) + 2 = 7. Using this output as y in function b gives b(7) = (7-2)/5 = 1 which was the input value to function a.

**Properties of Inverse Functions –**

Two functions f and g are said to be inverses of each other if and only if:

- f and g are both one to one functions. One to One functions map each value in their domain to exactly one value in the co-domain(range). An example of a One to One function is f(x) = x
- The co-domain(range) of f is the domain of g and vice versa

**Note:** Some functions are only invertible for a set of specific values in their domain. In this case both the range and domain of the inverse function are restricted to only those values.

**Composite Functions –**

A composite function is a function whose input is another function. So, if we have two functions A(x), which maps elements from set B to set C, and D(x), which maps from set C to set E, then the composite of these two functions, written as *DoA*, is a function that maps elements from B to E i.e. DoA = D(A(x)).

For example consider the functions A(x) = 5x + 2 and B(x) = x + 1. The composite function *AoB* = A(B(x)) = 5(x+1) + 2.

**Properties of Composite Functions –**

Composite functions posses the following properties:

- Given the composite function
*fog*= f(g(x)) the co-domain of g must be a subset, i.e. proper or improper subset, of the domain of f - Composite functions are associative. Given the composite function
*a o b o c*the order of operation is irrelevant i.e. (a o b) o c = a o (b o c). - Composite functions are not commutative. So
*AoB*is not the same as*BoA*. Using the example A(x) = 5x + 2 and B(x) = x + 1*AoB*= A(B(x)) = 5(x+1) + 2 while*BoA*= B(A(x)) = (5x + 2) + 1.

## Recommended Posts:

- Mathematics | Unimodal functions and Bimodal functions
- Total Recursive Functions and Partial Recursive Functions in Automata
- ES6 | Functions
- Number of possible Functions
- Functions in Python
- Activation Functions
- Hyperbolic Functions
- PHP | startsWith() and endsWith() Functions
- Mathematics | Generating Functions - Set 2
- How to add many functions in one ng-click directive?
- Perl | File I/O Functions
- jQuery | Callback Functions
- Functions of Operating System
- Number of Boolean functions
- Perl | List Functions

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.