Difference between revisions of "Composition"

From CS2800 wiki
(Created page with "Category:Definition Category:Functions One way to combine functions together to create new functions is by composing them: {{:composition definition}...")
 
 
Line 1: Line 1:
[[Category:Definition]] [[Category:Functions]]
+
<noinclude>[[Category:Definition]]</noinclude> <noinclude> [[Category:Functions]]</noinclude>
  
 
One way to combine functions together to create new functions is by
 
One way to combine functions together to create new functions is by

Latest revision as of 20:35, 1 March 2018


One way to combine functions together to create new functions is by composing them:


Definition: Composition
Given a function [math]f : A \href{/cs2800/wiki/index.php/%E2%86%92}{→} B [/math] and a function [math]g : B \href{/cs2800/wiki/index.php/%E2%86%92}{→} C [/math], the composition of [math]g [/math] with [math]f [/math] (written [math]g \href{/cs2800/wiki/index.php/%E2%88%98}{∘} f [/math]) is the function [math]g \href{/cs2800/wiki/index.php/%5Ccirc}{\circ} f : A \href{/cs2800/wiki/index.php/%E2%86%92}{→} C [/math] given by [math](g \href{/cs2800/wiki/index.php/%5Ccirc}{\circ} f)(a) := g(f(a)) [/math].


Note that (with the domains and codomains described above), [math]f \href{/cs2800/wiki/index.php/%5Ccirc}{\circ} g [/math] is not defined; it is impossible to take outputs of [math]g [/math] (which live in the set [math]C [/math]) and pass them into [math]f [/math] (whose domain is [math]A [/math]).


For example, Composition.svg

Note that this picture is not backwards; we draw functions from left to right (the input is on the left, and the output is on the right) but we apply them with the input on the right. This means the symbolic composition looks backwards when you draw a picture.