Why is the oxidation number for elements in the groups 1, 2 and 3 positive and for those in the groups 15, 16 and 17 it is negative?
An atom is stable when the electronic configuration of the atom is the same as that of the nearest noble gas. For elements that are not noble gases, this is possible when the atom loses or gains a number of electrons that leaves all the electron shells completely filled.
For elements in group 1, 2 and 3, this can be achieved by losing 1, 2 or 3 electrons respectively. It would not be possible for an atom belonging to elements in this group to gain extra electrons and complete the shells as that would create an unsustainable negative charge. Similarly, atoms of elements in the groups 15, 16 and 17 can acquire a few extra electrons to complete their electron shells. They cannot lose electrons and do the same as that would create an unsustainable positive charge.
This is the reason why the oxidation number of elements that lie in the groups 1, 2 and 3 is positive and for those that lie in the groups 15, 16 and 17 it is negative.