Let those only in A (and not in the intersection) = w
Let those only in B (and not in the intersection) = y
Let those in the intersection = x
Let those not in (A U B) = z
So
w + x + y = 31 = A U B
w + x = 17
So
17 + y = 31
y = 14
Those not in A = y + z
y + z = 36
14 + z = 36
z = 22
Those not in B = w + z
w + z = 33
w + 22 = 33
w =11
w + x + y = 31
11 + x + 14 = 31
25 + x = 31
x = 6
So
n(A) = 11 + 6 = 17
n(B) = 14 + 6 = 20
n(A ∩ B) = 6
n(A U B) = n(A) + n(B) - n (A ∩ B) = 17 + 20 - 6 = 31
n(U) = n(A U B) + n(A U B)' = 31 + 22 = 53