Binary arithmetic and complements
Digital electronics · Physics
DC circuit
Interactive 3DElectrons drift around the loop — raise the voltage and watch the current obey Ohm's law.
Controls
Drag the sliders or type a value — the simulation updates live.
V
1V12V
Study notes
Worked example - subtract 13 - 9 in 4-bit binary using 2's complement. Step 1: 13 = 1101, 9 = 1001. Step 2: 2's complement of 1001: flip -> 0110, add 1 -> 0111. Step 3: add: 1101 + 0111 = 10100 (5 bits). Step 4: discard the final carry -> 0100 = 4. Correct! Now try 5 - 7: 0101 + 2's comp of 0111 (1001) = 0101 + 1001 = 1110. No final carry, leftmost bit 1 -> negative: 2's comp of 1110 = 0010 = 2, so the answer is -2. Correct again.