In this section we will look at different ways of combining functions together. We start with algebraic operations, then we look at composition and at the end we briefly survey transformations of functions. We conclude this section with a handy notation for comparison of functions.

Consider two functions, *f* and *g*. In order to use
algebraic operations with them (addition, multiplication,...) we first need
to check that they have the same domain. What happens if they do not? Then
there are two possibilities. If their domains are disjoint, then we cannot
put them together algebraically, since the two functions "live" at entirely
different places. Otherwise we just look at the set where their domains
intersect and the result of the operation will have this intersection as its
domain.

Definition(algebraic operations).

Letf,gbe functions whose domains are not disjoint. Then we define theadditionby f+g( forf+g)(x) =f(x) +g(x)x∈D(f) ∩D(g),subtractionby f−g( forf−g)(x) =f(x) −g(x)x∈D(f) ∩D(g),multiplicationby f⋅g( forf⋅g)(x) =f(x)⋅g(x)x∈D(f) ∩D(g),divisionby f/g( forf/g)(x) =f(x)/g(x)for which x∈D(f) ∩D(g)is not zero. g(x)

As a result of these operations we always get a new function, defined on the intersection as stated above (for division sometimes on a smaller set). The properties of such a new function are usually some sort of a combination of properties of the two original functions, but the way they combine depends on the particular property and on operation, so we prefer to leave this discussion to parts where the various properties are discussed. One thing should be noted here, since this property was already covered: the property of being 1-1 does not get preserved by these operations. If you start with two functions that are 1-1 and perform one of these operations, you may end up with a function that is not 1-1.

For example, imagine that we have two 1-1 function *f* and *g*
whose values are, among others, *f* (1) = 1,*f* (2) = −1,*g*(1) = −1,*g*(2) = 1.*f* + *g*

*f* + *g*)(1) = *f* (1) + *g*(1) = 1 − 1 = 0,

*f* + *g*)(2) = *f* (1) + *g*(2) = −1 + 1 = 0.

This shows that the function *f* + *g**f*⋅*g**f* /*g*

Since the 1-1 property si not preserved, one also cannot say anything
nice about inverse to outcomes of these operations. There are no nice rules
like
*f* + *g*)_{−1} = *f*_{−1} + *g*_{−1},*f* and *g* does not
help.

Once we have multiplication of functions, we can also define integer powers
in the usual way, for instance
*f* ^{3} = *f*⋅*f*⋅*f**f* ^{−2} = 1/( *f*⋅*f* ).*f* ^{a}*a*. Fro details see
Powers in Theory - Elementary
functions.

The last step is to define the general power
*f* ^{g}

*f* ^{g})(*x*) = *e* ^{g(x)⋅ln( f (x))} *x*∈*D*( *f* ) ∩ *D*(*g*)*f* (*x*) > 0.

For details, see General powers in Theory - Elementary functions.

For the next operation it is useful to recall another visualization of a a
function. The fact that *f* sends points from one set (a subset of the
real line) to points in another set can be expressed like this:

Now the values of the function *f* are numbers again, so they can be
used as arguments for another function *g* like this:

As a whole we get a procedure that sends numbers from one copy of the set of
real numbers (denoted using *x*) into another copy denoted using
*z*, we can forget that there was a middle step and consider the whole
thing to be just another function.

This new function is called the **composition** of the given two functions
and for this idea to work, one condition is needed: That the values of
*f* lie in the domain of *g* (all or at least some). What is the
notation? One is natural. We start with *x*, then apply *f* and
obtain the number *y* = *f* (*x*).*g*, thus obtaining
*z* = *g*( *y*) = *g*( *f* (*x*)).*g*( *f* (*x*))*x*; note that when facing such a composition, we
evaluate **from the inside out**, that is, we start with *x* and work
our way out by performing necessary operations. After all, this is not
surprising, when somebody asks you to calculate
^{2},*f* is called the **inner
function** or **inside function**, and *g* is called the
**outer function** or **outside function**.

Since *x* ↦ *g*( *f* (*x*))*x* somewhere, it is in fact another function and deserves a
name. One possible notation is *g*( *f* ).*g*( *f* )(2) = *g*( *f* (2)).

*g*( *f* ): *x* ↦ *g*( *f* (*x*)).

This is one notation for composition, but mathematicians often prefer a
notation of a different kind, since they like to express operations by some
symbol between the two functions involved. Therefore we also use this
notation: *g* ○ *f*.*g* ○ *f* )(*x*) = *g*( *f* (*x*)),

**Example.**
Consider the functions
*f* (*x*) = *x* + 2*g*(*x*) = *x*^{2}.*g* ○ *f* )(1)?

*g* ○ *f* )(1) = *g*( *f* (1)) = *g*(1 + 2) = *g*(3) = 3^{2} = 9.

How does it work? The number *x* = 1*f* and gives
*y* = *f* (1) = 3.*g* acts on the values of *f* denoted by *y*, it may be
instructive to rewrite *g* as
*g*( *y*) = *y*^{2}.*y* we now get
*z* = *g*(3) = 9.

It is easy to check that *g* ○ *f* )(*x*) = (*x* + 2)^{2}*x*. Note that we used functions whose domains are the whole real line
to avid any troubles with allowable arguments.

Since there is no trouble with domains, we may also try to change the order
in which we compose these two functions. Since variable names are just for
our convenience, we should not get troubled by the fact that *f*
"expects" *x*, but the outcomes of *g* were called *z*. We
simply have a new situation, so we can use different letters for variables to
reflect this. This is in fact typical for mathematics. However, there are
situations where variable names have a specific meaning, then it is better to
stick to the given ones (for instance when working with inverse functions, in
applications etc.)

As you can see,
*f* ○ *g*)(*x*) = *f* (*x*^{2}) = *x*^{2} + 2.*f* ○ *g**g* ○ *f*

Now we know how it works, so for the sake of completeness we include a formal definition.

Definition.

Letfandgbe functions such thatis not disjoint with R(f)We define the D(g).compositionoffandgas a function defined forxfrom the set

D(g○f) = {x∈D(f);f(x)∈D(g)}by

( g○f)(x) =g(f(x)).

Of course, having more functions, one can compose them like a chain assuming that their ranges and domains fit:

We marked the domains of respective functions. Of the five indicated values
of *x*, only *a*, *c*, and *e* belong to the domain of
the composition *h* ○ *g* ○ *f*.*b* gets sent by *f* to
some number *f* (*b*)*g*, so
this function cannot be applied to it. The number *d* was initially
fine, since *f* (*d*)*D*(*g*);*d*
would belong to the domain of the composition
*g* ○ *f*.*g* is applied to *f* (*d*),*h* and thus the last step in the composition fails.

To show why this domain fitting is important, consider this example:

**Example.**

Consider
*f* (*x*) = −1 − *x*^{2}*g*(*x*) = *x*^{1/2}*g* is
the square root). We see that the domain of *f* is the whole real line
(no problem with squaring), its range is the interval
*g*
is *f* does
not intersect the domain of *g*, we cannot compose them in the order
"*f* first, then *g*", that is,
*g* ○ *f*.*x* we try, substituting into
*g* ○ *f* )(*x* ) = (−1 − *x*^{2})^{1/2}*g* ○ *f* )(2)

We can, however, compose without problem in the other way, since the range of
*g* (non-negative numbers) is a subset of the domain of *f*. We can
calculate
*f* ○ *g*)(*x*) = *f* (*x*^{1/2}) = −1 − (*x*^{1/2})^{2}.*x*,*x*

Composition behaves nicely with respect to the 1-1 property. If *f* and
*g* are both 1-1, then their composition (in any order that makes sense)
is also 1-1 (we will make a formal statement below). If one or both functions
are not 1-1, then nothing can be said about their composition.

Recall that the 1-1 property is closely related to the existence of an
inverse function. Now that we have the notion of composition, we can rewrite
the definition of inverse function. Given a 1-1 function *f*, its
inverse *f*_{−1} is characterized by these equalities:

•
*f*_{−1}( *f* (*x*)) = *x**x* from *D*( *f* ),

•
*f* ( *f*_{−1}( *y*)) = *y**y* from *R*( *f* ).

In the language of composition, an inverse function is a function that
satisfies
*f*_{−1} ○ *f* = *Id*_{D( f )}*f* ○ *f*_{−1} = *Id*_{R( f )},*Id*_{M} is the identity function on a set
*M*, for further info see
Identity function in
Theory - Elementary functions.

Theorem(composition and inverse).

Letfandgbe functions that are 1-1 and such that the compositionmakes sense. Then the function g○fis also 1-1 and its inverse satisfies g○f

( g○f)_{−1}=f_{−1}○g_{−1}.

Note that inverse reverses the order in composition, this is important as we
know that composition is definitely not commutative. The part about
"composition making sense" means that the range of *f* intersects the
domain of *g* so that their composition is defined for at least some
values of *x*. Since the domain and range of an inverse function are the
range and domain of the original function, also the composition of the
inverses will make sense, that is, the range of *g*_{−1} will
intersect the domain of *f*_{−1}.

If we tried to compose the inverses in the other way, this is no longer true.
In fact, this is an example where keeping the names of variables is rather
helpful. The original composed function should send *x*'s to *z*'s.
Thus the inverse should send *z*'s to *x*'s. It does work when we
did it the right way above, but fails when we try it the other way; now the
variables do not even match, do not form a chain, which should suggest that
something is wrong here.

Operations with functions have a very interesting special case: When one of
the functions is a constant function. The other function then gets
transformed. Therefore consider a function *f* (*x*) and a real
number *c*.

**Case 1:**
Define
*g*(*x*) = *f* (*x*) + *c*,*g* = *f* + *c**g* has
all its values shifted by the same amount, so its shape stays the same. The
graph of *g* can be obtained by **shifting** the graph of *f*
**up** by *c* if *c* is positive or **down** by
*c*|*c* is negative. In the following picture,
*g* = *f* + 3,*g* is obtained
by shifting the graph of *f* up by 3.

**Case 2:**
Define
*g*(*x*) = *f* (*x* + *c*).*g* has argument increased always by the same amount. If we
think of *x* as time and imagine that *c* is positive, then
*g* at time *x* is obtained by looking at *f* at a time
somewhat to the future, which means to the right on the *x*-axis. In
other words, we obtain the value of *g* by looking at the graph of
*f* a bit to the right; thus the graph of *g* will be just like the
graph of *f*, but shifted to the left. Similarly, for negative *c*
we will be looking at *f* at earlier times. Thus in general for case 2,
the shape stays the same, the graph of *g* can be obtained by
**shifting** the graph of *f* **left** by *c* if *c* is
positive or **right** by *c*|*c* is negative. In the
following picture we will show the graph of
*g*(*x*) = *f* (*x* − 5),*f* shifted right by 5.

**Case 3:**
Define
*g*(*x*) = *c*⋅*f* (*x*),*g* = *c*⋅*f**g* has all its values multiplied by the same amount. If *c* > 1,
then at places where *g* is large, it gets much larger, while at places
where *g* is small, it gets larger, but only by a little bit. For
instance, if *c* = 2,*g*(4) = 2⋅*f* (4) = 2⋅0 = 0,*g*(2) = 2⋅*f* (2) = 2⋅3 = 6,

In words, the bigger are the values of *f* - that is, the further is the
graph of *f* from the *x*-axis - the bigger is the change when
going to *g* = 2⋅*f*.*g* can be obtained by **stretching**
proportionally with respect to the *x*-axis (that is, by changing the
amplitude). If *c* > 1,*c* < 1,*c* is
negative, then there is again the expanding/shrinking alternative depending
how *c*|*x*-axis. In the following example we first recall the function *f*
as above, then show the graph of
*g* = 2⋅*f**g* = −1/2⋅*f*.

Special case: *g* = −*f**f* flipped symmetrically about the *x*-axis.

**Case 4:**
Define
*g*(*x*) = *f* (*c*⋅*x*).*f* is the height of the hills along the road. What does it mean when we
consider
*g*(*x*) = *f* (3⋅*x*)?*g* at time *x*, we look at *f* at time three times bigger.
That is, this transformation corresponds to making the time go faster, and
when we go faster, the hills seem to come more quickly, as if they were
squeezed closer together. Thus the graph of this *g* will be the same as
the graph of *f* but squeezed three times in the horizontal direction
with respect to the origin. Just like the previous case, the further one gets
from the *y*-axis, the larger the change. If
*c* < 1,*g*(*x*) = *f* (*x*/2).

For instance,
*g*(10) = *f* (10/2) = *f* (5) = −3/2.

It sort of makes sense, before it took us 4 hours to get past the 2-hump
hill, with *g* it takes twice as long.

Therefore, in general, the graph of the function *g* can be obtained by
**stretching** the graph of *f* *c* times in horizontal
direction, with respect to the *y*-axis, in case
*c* > 1,*f* *c**y*-axis, in case
*c* < 1.*c* is
negative, the graph is again transformed horizontally depending on whether
*c*|*y*-axis. In the following picture we recall *f* as
above, then show the graphs of
*g* = *f* (2⋅*x*)*g* = *f* ((−1/2)⋅*x*)

Special case:
*g*(*x*) = *f* (−*x*)*f* flipped symmetrically about the *y*-axis.

One can guess graphs of quite complicated functions by knowing the graphs of elementary functions and applying transformations to them. See Transformations and graph guessing in Methods Survey.

In general, it is almost impossible to guess the shape of the graph of
a function created from two functions using algebraic operations. Sometimes
we get lucky, the
easiest case is *f* + *g*.*x*, the value
of *g* is added to (put on the top of) the value of *f*. One can
imagine the values of *g* as bars of appropriate height that are moved
up and down so that their bases fit with the shape of the graph of *f*.

However, this requires quite a bit of experience and imagination and so it is rarely used.

We already saw an example of a shortened notation,
*g* = *f* + *c**g*(*x*) = *f* (*x*) + *c**x*.
In general, when we write an equality or inequality featuring function(s),
but without specifying their argument(s), it is automatically assumed that
this equality/inequality is considered for all possible values of the
argument. Thus
*h* = *f* + *g**h*(*x*) = *f* (*x*) + *g*(*x*)*x* from the intersection of the domains of the functions *f* and
*g*.

Similarly, *f* ≤ *g**f* (*x*) ≤ *g*(*x*)*x* from the intersection
of the domains of *f* and *g*. This is how we compare functions.
There are five possibilities. One can have
*f* ≤ *g**f* < *g**f* (*x*) < *g*(*x*)*x* from the
intersection of domains; in the other direction there are inequalities
*f* ≥ *g**f* > *g*;*x* the function *f* is larger,
and for other *x* the function *g* is larger.

Basic properties of real functions

Back to Theory - Real
functions