Function composition

From testwiki
Revision as of 21:51, 28 August 2020 by imported>Miaumee (General revision throughout the page. Improved citations. Undo italicization of parentheses. Rephrased sentences to prevent flow disruption. Replaced citations from ProofWiki (which is a user-generated content site). Minor punctuation fixes. Broken down lengthy sentences and paragraphs. Added Related Pages section.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

In mathematics, function composition is a way of making a new function from two other functions through a chain-like process.

More specifically, given a function f from X to Y and a function g from Y to Z, then the function "g composed with f", written as g ∘ f, is a function from X to Z (notice how it is usually written in the opposite way to how people would expect it to be).

The value of f given the input x is written as f(x). The value of g ∘ f given the input x is written as (gf)(x), and is defined as g(f(x)).

As an example. let f be a function which doubles a number (multiplies it by 2), and let g be a function which subtracts 1 from a number. These two functions can be written as:

f(x)=2x
g(x)=x1

Here, g composed with f would be the function which doubles a number, and then subtracts 1 from it. That is:

(gf)(x)=2x1

On the other hand, f composed with g would be the function which subtracts 1 from a number, and then doubles it:

(fg)(x)=2(x1)

Composition of functions can also be generalized to binary relations, where it is sometimes represented using the same symbol (as in RS).[1]

Properties

Function composition can be proven to be associative, which means that:[2]

f(gh)=(fg)h

However, function composition is in general not commutative, which means that:[3]

fggf

This can be also seen in the first example, where (g ∘ f)(2) = 2*2 - 1 = 3 and (f ∘ g)(2) = 2*(2-1) = 2.

References

Template:Reflist