kidzsearch.com > wiki Explore:images videos games
If we let f be a function from X to Y and g be a function from Y to Z then we say that g composed with f is written as g ∘ f a function from X to Z (notice how it is usually written in the opposite way to how people would it expect it to be as we will explain below).
The value of f given the input x is written as f(x). The value of g ∘ f given the input x is written (g ∘ f)(x) and is defined as g(f(x)) (which means our way of writing g composed with f makes sense).
These would be written as:
- [math]f(x) = 2x [/math]
- [math]g(x) = x - 1 [/math]
g composed with f would be the function which doubles a number and then subtracts 1 from it:
- [math](g \circ f)(x) = 2x - 1[/math]
f composed with g would be the function which subtracts 1 from a number and then doubles it:
- [math](f \circ g)(x) = 2(x-1)[/math]
- [math]f \circ (g \circ h) = (f \circ g) \circ h[/math]
- [math]f \circ g \neq g \circ f[/math]
This can be seen in the first example where (g ∘ f)(2) = 2*2 - 1 = 3 and (f ∘ g)(2) = 2*(2-1) = 2.