Composition of Continous function is continuous I have an example, prove that the function y = |cosx| is continuous. 
We can make two function viz. let g(x) = |x| f(x) = cosx 
As we know that |x| is continuous function and cosx is also continuous function. So, their composition is also continuous. 
ie. gof = |cosx| is also continuous. 
Could you please provide me proof of that : Composition of continuous function is also continuous. 
Thanks ..
 A: Take an open subset $E$ of the real line. Then
$$(g\circ f)^{-1}(E)=f^{-1}(g^{-1}(E))=f^{-1}(D)=A$$
is open,
where $D=g^{-1}(E)$ is open by continuity of $g$ and $A=f^{-1}(D)$ is open by continuity of $f$.
A: Let $f(x)=\cos(x)=u$ and $g(f(x))=g(u)=|u|$. For any, $x_0$ define $u_0=f(x_0)$. Pick $\epsilon>0$, then by definition of continuity of $g$ at $u_0$: $$\exists \delta_1>0 :|u-u_0|<\delta_1 \implies |g(u)-g(u_0)|<\epsilon$$ By definition of continuity of $f$ at $x_0$:
$$\exists \delta_2>0 :|x-x_0|<\delta_2 \implies |f(x)-f(x_0)|<\delta_1$$
Combining the two statements, we get:
$$\exists \delta_2>0 :|x-x_0|<\delta_2 \implies |f(x)-f(x_0)|<\delta_1 \implies |g(f(x))-g(f(x_0))|<\epsilon$$
This is the definition of $g\circ f$ continuous at $x_0$.
A: Here's an elementary proof of the following statement about real functions of a real variable.

Let $f$ and $g$ be functions with $g$ continuous at $x_0$ and $f$ continuous at $g(x_0)$. Then $h=f\circ g$ is continuous at $x_0$.

Notice that we assume that $f$ is defined at $g(x_0)$.
Let $\varepsilon>0$; then by the continuity of $f$ at $g(x_0)$ we can find $\varepsilon'>0$ such that, for all $y$ in the domain of $f$ with $|y-g(x_0)|<\varepsilon'$, we have $|f(y)-f(g(x_0)|<\varepsilon$.
By the continuity of $g$ at $x_0$, there exists $\delta>0$ such that, for all $x$ in the domain of $g$ with $|x-x_0|<\delta$, we have $|g(x)-g(x_0)|<\varepsilon'$.
Now, take $x$ in the domain of $f\circ g$ such that $|x-x_0|<\delta$. Then, by hypothesis, $|g(x)-g(x_0)|<\varepsilon'$, so, by construction of $\varepsilon'$, $|f(g(x))-f(g(x_0))|<\varepsilon$, which is the same as
$$|f\circ g(x)-f\circ g(x_0)|<\varepsilon$$
Therefore $f\circ g$ is continuous at $x_0$.
