In the tree diagram above, 1, 2 and 3 represent 1st, 2nd and 3rd child. F=female, M=male.
In brackets on the leaves we have the permutation of children, showing all possibilities.
We exclude the possibility of twins, triplets, etc., and take the probability of a boy or girl to be the same=1/2.
The probability of 1/2 is shown on the branches or twigs. We move from left to right, multiplying the probabilities as we go until we reach the required leaf.
3 sons is MMM, and there is just one occurrence right at the top. So 1/2*1/2*1/2=1/8.
2 sons and 1 daughter is MMF, MFM or FMM=1/8+1/8+1/8=3/8.
3 children of same sex is MMM or FFF=1/8+1/8=1/4.