The set of ordered pairs is A×B={(1,2),(1,3),(1,8),(4,2),(4,3),(4,8),(7,2),(7,3),(7,8)}, so there are 9 elements in A×B.
The relation R is defined on (A×B)×(A×B) by
((a1,b1),(a2,b2))∈R⟺a1+b2 divides a2+b1.
Thus we have to count all ordered quadruples (a1,b1,a2,b2) with this divisibility property.
Let d=a1+b2 (the divisor) and n=a2+b1 (the dividend).
For every choice of (a1,b2) we get one value of d, and for every independent choice of (a2,b1) we get one value of n. Hence
∣R∣=∑d∣n(number of ways to obtain d)×(number of ways to obtain n).
Compute all possible sums and their frequencies:
a147b=2369b=34710b=891215
The multiset of sums and their counts is
{3(1),4(1),6(1),7(1),9(2),10(1),12(1),15(1)}.
(The number in parentheses is the frequency.)
Because the same table holds for both (a1,b2) and (a2,b1), the divisor and dividend distributions are identical.
List every possible divisor d, determine which dividends n it divides, and accumulate the contributions:
d34679101215n that satisfy d∣n3,6,9,12,154,126,1279101215Contribution=cd∑cn1(1+1+2+1+1)=61(1+1)=21(1+1)=21(1)=12(2)=41(1)=11(1)=11(1)=1
Adding all contributions:
∣R∣=6+2+2+1+4+1+1+1=18.
Therefore, the required cardinality is 18.