# Binary subtraction for `unsigned`

numbers.

Binary numbers addition is straight forward, while binary subtractions involve three fundamental steps. Detailed discussions to understand when to *discard carry *and when to take 2s complement of final result is `summarized`

in a table at end.

Binary Subtraction: Suppose, M is Minuend and N is subtrahend, Then, M – N can be done based on following three steps:

Step 1: Take 2’s complement of N and add it to M.

M – N = M + (2^n – N)

Step 2: If M is greater than or equal to N then end carry is discarded from the result.

M –N = M + (2^n – N) – 2^n

Step 3: If M is less than N then take 2’s complement of the result and append negative ‘-

M-

A `solved example`

to explain binary subtraction is discussed next.