# Co-Domain of composite function

Let's say I have

$f: X \to Y$ where $f(x) = x^2$

$g: Y \to Z$ where $g(y) = \cos(y)$ and

$h: Z \to X$ where $h(z) = 2x-1$

If I take $f \circ (g \circ h)$ I get $\cos^2(2x-1)$

What is the co-domain of this function? Is there some sort of rule for finding the co-domain? It's easy enough to find the domain and range but I'm not sure about the co-domain.

-

For instance, if you have a sequence of compatible functions $$f_1 : A_1 \to A_2,\ \ f_2 : A_2 \to A_3,\ \ \cdots,\ \ \ f_n : A_n \to A_{n+1}$$ then the codomain of $f_n \circ f_{n-1} \circ \cdots \circ f_1$ is $A_{n+1}$, which is the codomain of $f_n$.
Likewise, the domain of a composite is always the domain of the first function in the composite (i.e. the last appearing in the string), so the domain of $f_n \circ \cdots \circ f_1$ is $A_1$, which is the domain of $f_1$.
@mh234: No problem. It occurs to me that your composite seems to be written in the wrong order: $g \circ h$ doesn't exist, but $h \circ g$ does! –  Clive Newstead Dec 13 '12 at 17:16