[Math] Is the answer for the composite relation correct and not the textbook’s

algorithmsdiscrete mathematicslogicrelation-algebrarelations

Note: This example is from Discrete Mathematics and Its Applications [7th ed, example 5 pg 593]

enter image description here

Here is how my textbook's way of representing a relation with a matrix
enter image description here

And the definition of a composite relation enter image description here

My work and Answer:
evaluating s comp r, i first took a look at all of the 1s or members of the relation S. Here is the list I came up with {(1,2), (2,3), (3,1), (3,3)}. Evaluating these individually
(1,2), 2 matches (2,1), (2,2) in R so we will have (1,1), (1,2) in composite relation
(2,3), 3 matches nothing in R row-wise
(3,1), 1 matches (1,1), (1,3) in R so we will have (3,1), and (3,3) in the composite relation
(3,3), 3 matches nothing in R row-wise
Everything else should be 0(no match)
So representing the composite relation in matrix form, we have
$\quad$1 $\quad$ 1 $\quad$ 0
$\quad$0 $\quad$ 0 $\quad$0
$\quad$1 $\quad$ 0 $\quad$ 1
which doesn't match the rubbish in the textbook. Is my answer correct? Are there any mistakes I made in the algorithm to do calculate this? The textbook didn't give any explanation for their solution

Best Answer

Similar what William said, your answer doesn't match that of the book because you computed $M_{R \circ S}$ rather than $M_{S \circ R}$

However, the process you followed was completely correct. You would just have to switch the order in which you did it. Just remember that this can be solved using the Boolean product of matrices, and you're essentially determining if each row corresponding to each column is either true or false.