Perform the following operations using 2's compliment

a.6-2
-5-7

To perform the operations using 2's complement, we need to represent the numbers in binary and apply the appropriate rules for subtraction.

a. 6 - 2:
1. Convert 6 into binary: 6 = 0110
2. Convert 2 into binary and find its 2's complement: 2 = 0010, 2's complement of 2 = 1101
3. Perform the subtraction: 0110 + 1101 (add the numbers)
= 10011 (discard the carry)
4. The result is in binary: 10011
5. Convert the binary result to decimal: 10011 = -13

Therefore, 6 - 2 in 2's complement is equal to -13.

b. -5 - 7:
1. Convert -5 into binary as a positive number: 5 = 0101
2. Find the 2's complement of -5 by inverting the bits and adding 1: 2's complement of 0101 = 1011 + 0001 = 1100
Note: The negative sign is represented by the leftmost bit being 1.
3. Convert -7 into binary as a positive number: 7 = 0111
4. Find the 2's complement of -7 by inverting the bits and adding 1: 2's complement of 0111 = 1001 + 0001 = 1010
5. Perform the subtraction: 1100 + 1010 (add the numbers)
= 10110 (discard the carry)
6. The result is in binary: 10110
7. Convert the binary result to decimal: 10110 = -6

Therefore, -5 - 7 in 2's complement is equal to -6.