note that the composite function starts with the domain of R and culminates with the range of S.
so for the second element, let's say, that is the element (1,1). this is how we got it.
we pick the 1st element in the second ordered pair of R, that is 1, this is the 1st element in the second ordered pair in SoR. so we have (1, ?) for this element. now to figure out what ? has to be, we follow the function. in R, this pair maps 1 to 4. and then S takes over from here, using 4 as the input to get an output. so we look up in S for a pair with the first element being 4, we find (4,1). so S maps 4 to 1. thus we have SoR taking the element 1 to the element 1, thus we have (1,1) as the second pair in SoR
the others are obtained similarly