Problem 1: Give examples of functions $f$ and $g$ such that $f \circ g$ is onto, but $g$ is not onto.
Problem 2: Let $R$ be the relation defined on the set of eight-bit strings by $s_1 \;R\; s_2$ provided that $s_1$ and $s_2$ have the same number of zeros.
(a) Show that $R$ is an equivalence relation.
(b) How many equivalence classes are there?
(c) List one member of each equivalence class.
Solution to Problem 2): (a) R is reflexive because any eight-bit string has the same number of zeroes as itself. R is symmetric because, if s_1 and s_2 have the same number of zeros, then s_2 and s_1 have the same number of zeros. To see that R is transitive, suppose that s_1 and s_2 have the same number of zeros and that s_2 and s_3 have the same number of zeroes. Then s_1 and s_3 have the same number of zeros. Therefore, R is an equivalence relation. Is my prove right? (b) I think there are nine equivalence classes, but I not sure.... (c) ....
Please explain in detail. I really need to understand the solution of these tasks... Thank you very much in advance!!!!
You are right, there are $9$ equivalence classes-the class of strings with no zeros, the class of strings with $1$ zero, the class of strings with $2$ zeros and so on. The number of zeros can be $0,1,2,...,8$ so we have $9$ equivalence classes in general. As for listing a member for each equivalence class, well it's easy:
$11111111$ is the only member of the class with no zeros.
$11111110$ is a member of the class with $1$ zero.
$11111100$ is a member of the class with $2$ zeros.
And continue this way.
Now about problem $1$. Define $f:\{0,1\}\to\{0\}$ by $f(0)=f(1)=0$, and $g:\{0\}\to\{0,1\}$ by $g(0)=0$. $g$ is not onto because it never returns the value $1$ which is in its range, but $f\circ g$ is onto.