# Difference between f(x) and g(x)

Functions with overlapping domains can be added, subtracted, multiplied, and divided. If *f * ( *x * ) and *g * ( *x * ) are two functions, then for all *x * in the domain of both functions the sum, difference, product and quotient are defined as follows.

( *f + g * )( *x * ) = *f * ( *x * ) + *g * ( *x * )

( *f – g * )( *x * ) = *f * ( *x * ) – *g * ( *x * )

( *fg * )( *x * ) = *f * ( *x * ) × *g * ( *x * )

**Let’s go with an example: **

Let’s say *f * ( *x * ) = 2 *x * + 1 and *g * ( *x * ) = *x *^{2 } – 4.

Find ( *f + g * )( *x * ), ( *f – g * )( *x * ), ( *fg * )( *x * ) and .

( *f + g * )( *x * ) = *f * ( *x * ) + *g * ( *x * )

= ( *2x * + 1) + ( *x2 – *^{4 } )

= *x2 * + ^{2x } – *3 *

( *f – g * )( *x * ) = *f * ( *x * ) – *g * ( *x * )

= ( *2x * + 1) – ( *x2 – *^{4 } )

= – *x2 * + ^{2x }*+ * 5

( *fg * )( *x * ) = *f * ( *x * ) × *g * ( *x * )

= ( *2x * + 1)( *x2 – *^{4 } )

= ^{2×3 } + *x2 * – *8x * – ^{4 }*_ *

There is another way to combine two functions to create a new function is called function composition. In function composition we substitute an entire function into another function.

The notation of the function f with g is and is read f of g of x . It means that wherever there is an x in the function f , it is replaced with the function g ( x ). The domain of is the set of all x’s in the domain of g such that g(x) is in the domain of f.

Example 1:

Say f ( x ) = x 2 and g ( x ) = x – 3. Find f ( g ( x )).

Example 2:

Say f ( x ) = 2 x – 1 and g ( x ) = x + 2. Find f ( g ( x )).

*Note* : The order IF matters when you find the composition of functions.