Turing machine as transducer for 2's complement
Approach for 2's complement
- Scan input string from right to left
- Pass all consecutive '0's
- When '1' comes do nothing
- After that take complement of every digit.
TAPE movement for string "1010100":

Explanation of TAPE movement
- Input is given as "1010100" (scan string from right to left)
- Pass two '0's from right
- Pass '1' after that
- Take complement of '0' = '1'
- Take complement of '1' = '0'
- Take complement of '0' = '1'
- Take complement of '1' = '0'
- BLANK(in left) is reached when string is finished. So move to start of string(optional) by moving one step right.
Input String : 1010100
Output String : 0101100
State Transition Diagram
We have designed state transition diagram for 2's complement as follows:1. Go to right of string using state q0
2. When BLANK is reached take one step left
3. Start scanning string from right to left
4. Pass all '0's and keep moving left
5. Pass single '1' and move left
6. Take complement of '1' and '0' after that.
7. When BLANK(in left) is reached move one step right and point to start of string.
