Which 4-bit Binary Number Is Greater?
If you want to find the largest number between two unsigned numbers A and B, all you need to look at is the most significant bit where the bits in A and B are not the same, the larger number is the number that will have a '1' at that point and the smaller number will be the number that will have a '0' at that point. e.g if

$$
\text{A} = 1100\\
\text{B} = 1011
$$

then A is bigger than B because at the most significant bit where the bit number's aren't the same (bit index 2 in this case) A is 1 and B is 0.

So to solve this problem, we can start by defining a variable X\$_i\$, where X\$_i\$ is high if i) the bits of A and B in the current bit index are not the same, ii) all bits of A and B have been the same in all indexes greater that the current index and iii) the bit of value of B in the current index, B\$_i\$, is high.Using this logic we can extract the values of X\$_i\$ = {X\$_3\$ X\$_2\$ X\$_1\$ X\$_0\$} as being

$$
X_3 = B_3(A_3 \mathbin{\oplus} B_3) \\
X_2 = B_2(A_2 \mathbin{\oplus} B_2) .\overline{(A_3 \mathbin{\oplus} B_3)} \\
X_1 = B_1(A_1 \mathbin{\oplus} B_1) .\overline{(A_2 \mathbin{\oplus} B_2)} . \overline{(A_3 \mathbin{\oplus} B_3)} \\
X_0 = B_0(A_0 \mathbin{\oplus} B_0) . \overline{(A_1 \mathbin{\oplus} B_1)}. \overline{(A_2 \mathbin{\oplus} B_2)} . \overline{(A_3 \mathbin{\oplus} B_3)}
$$

we can then get our final result X as

$$
X = X_3 + X_2 + X_1 + X_0
$$