Example. Trace the following Turing machine for input:#abc# (the head initially points to the first blank on the right-hand-side)
Start L<sub>r</sub>
action
description
Input/output string
Start
#abc#(there are more#
on the right-hand-side
→L<sub>r</sub>
move the head to the first # on left
#abc##
→R<sub>r</sub>
move head one letter to right
#abc##
The head is pointing at
#abc##
a, so r=a.
follow → #
Replace a with #
##bc##
→R<sub>r</sub>
move the head to first # on
##bc##,
right(there are more # on right)
→R<sub>r</sub> r
and replace it with r=a (more # on right)
##bc#a_#
L<sub>r</sub>
move to the first # on left,
##bc#a#
L<sub>r</sub># r,
and move to the next blank on left agian(together means move to the 2<sup>nd</sup> blank on left)and replace it with r =a. before we go back to the loop, all we did so far is to put a copy of 'a' on the right hand side
#abc#a#
R→#
Move head to right, r=b which is not blank. Replace it with #
#a#c#a#
R<sub>r</sub>b r
Lets do all at once. Move to the second blank on right and replace # with r=b
#a#c#ab#
L<sub>r</sub>L<sub>r</sub> r,
Move to the second blank on Left, and replace the # with r=b
#abc#ab#
R→ #
Move the head to Right, r=c not blank. Replace c with # t
#ab##ab#
R<sub>r</sub>c r
Move to the second blank on right and replace # with r=c
#ab##abc#
L<sub>r</sub>L<sub>r</sub> r,
Move to second blank on left and replace it with r=c
#abc#abc#
R
Move head to right, the box is #
#abc#abc#
R<sub>r</sub>
Move head to first # on right
#abc#abc#
In summary, this machine used the input string #abc# to produce output #abc#abc#. Thus, the input string #w# creates output string #w#w#, or word w followed by its copy. We name this machine a COPY machine or C, and from now on you can use it when you need it.
Notation. Since #w# was the input to the Turing machine and #w#w# was its output, we use function notation to describe its action. If the function name be f, then