The main thing to understand here is the logic. If you get that right you should find that everything else is pretty easy. Just a suggestion - others may disagree - but I find that writing these things in symbolic logic makes it harder, not easier. I would put them in words as far as possible.
There are a lot of "if-then" statements to prove here. In fact if you expand the definitions there are if-thens within if-thens. For example
$$\hbox{if $R\circ R\subseteq R$ then $R$ is transitive}$$
can be expanded as
$$\displaylines{
\hbox{if (if $(x,y)\in R\circ R$ then $(x,y)\in R$)}\cr
\hbox{then (if $(x,y)\in R$ and $(y,z)\in R$ then $(x,z)\in R$)}.\cr}$$
I hope this IS confusing because that's kind of my point - you wouldn't want to start off writing things like this, but on the other hand you do need to be aware that there are lots of if-thens around, and when you come to work out a proof you need to know how to deal with them.
So, how do you prove "if $X$ then $Y$"? There are various ways but the most straightforward is:
- Assume that $X$ is true.
- . . . [arguments] . . .
- Therefore $Y$ is true.
Let's apply this to the above statement. At a very basic level, your proof will be as follows.
- Assume that $R\circ R\subseteq R$.
- . . .
- Therefore $R$ is transitive.
How are you going to prove that $R$ is transitive? The same way, because it is also an if-then statement! So you could develop the previous proof a bit further.
- Assume that $R\circ R\subseteq R$.
- Now suppose that $(x,y)\in R$ and $(y,z)\in R$.
- . . .
- Therefore $(x,z)\in R$.
- Hence, $R$ is transitive.
Now you could go back to try and work out how the fact that $R\circ R\subseteq R$ is going to help you fill in the dots. You might start by writing in what it actually means according to the definition, and then expanding that a bit.
- Assume that $R\circ R\subseteq R$.
- That is, if $(a,b)\in R\circ R$, then $(a,b)\in R$.
- In other words, if $(a,c)\in R$ and $(c,b)\in R$ for some $c$, then $(a,b)\in R$.
- Now suppose that $(x,y)\in R$ and $(y,z)\in R$.
- . . .
- Therefore $(x,z)\in R$.
- Hence, $R$ is transitive.
Now if you look at what is given and what you want you should see that they are almost identical. In fact, if we replace $a,b,c$ by $x,z,y$ respectively then they are identical. So let's do that.
- Assume that $R\circ R\subseteq R$.
- That is, if $(x,z)\in R\circ R$, then $(x,z)\in R$.
- In other words, if $(x,y)\in R$ and $(y,z)\in R$ for some $y$, then $(x,z)\in R$.
- Now suppose that $(x,y)\in R$ and $(y,z)\in R$.
- . . .
- Therefore $(x,z)\in R$.
- Hence, $R$ is transitive.
Now the second last line follows immediately from the previous ones. In fact you can see that what we now have is rather a case of overkill as we have stated many things twice. So you could then edit the proof to streamline it as much as possible: you might end up with something like this.
- Assume that $R\circ R\subseteq R$,
- and suppose that $(x,y)\in R$ and $(y,z)\in R$.
- By definition of $R\circ R$, it follows that $(x,z)\in R\circ R$,
- but since $R\circ R\subseteq R$ we have $(x,z)\in R$.
- We have proved that if $(x,y)\in R$ and $(y,z)\in R$ then $(x,z)\in R$: hence, $R$ is transitive.
Notice how much you can do simply by using definitions to replace "high-level" concepts by simpler ones! In this case it gives you pretty much the whole proof, though you can't expect that always to happen - sometimes there is no substitute for having a "bright idea".
As you pointed out, you need to prove the converse too. See if you can get it by using the same approach.
Proof by contradiction. Suppose $f$ satisfies the given condition but is not onto, then we can find $x \in B$ such that $f^{-1}(x) = \emptyset$. Now, $C$ has at least two elements so let $c_1,c_2 \in C$ with $c_1 \neq c_2$. Let $g:B \rightarrow C$ be a function satisfying $g(x) = c_1$. Next define $h: B \rightarrow C$ a function where $$h(b) = \left\{ \begin{matrix}c_2, & \text{if $b = x$} \\ g(b), & \text{if $b \neq x$} \end{matrix} \right.$$
Now clearly $g \neq h$ since $g(x) \neq h(x)$. So let's check to see if $gf = hf$. Since the image of $f$ does not contain $x$ and $x$ is the only element for which the functions $g,h$ differ we see that $gf = hf$. The argument in symbols: let $a \in A$ then $f(a) \neq x$ so $h(f(a)) = g(f(a))$ by definition of $h$, so $hf = gf$.
Best Answer
Note that $f: X \rightarrow Y$ is continuous iff for for any open set $U \subseteq Y$, $f^{-1}(U)$ is open in $X$.
To prove $g \circ f$ is continuous, for any open set $U \subset Y$, we only need to prove $(g \circ f)^{-1}(U)$ is open in $W$.
To see this, as $(g \circ f)^{-1}(U)=f^{-1}(g^{-1}(U))$, and $g$ is continuous, we see $g^{-1}(U)$ is open; as $f$ is continuous, then $f^{-1}(g^{-1}(U))$ is also open.