I have been told to write down any four digit number as long as at least one of the digits is different from the other three, but not show the number to my friend.

I write down the four digit number 6834.

My friend tells me to use those same difits and write them down in some different order to form another different four digit number. Again, my friend does not see this new number.

I write down the four digit number 3468.

My friend tells me to subtract the smaller number from the larger. (Again, my friend does not see)

I do 6834 - 3468 = 3366.

My friend tells me to circleone of the non zero digitsof my answer.

I circle the 6 at the end of 3366, and again my friend does not see.

My friend tells me to take the three remaining digits and write them in some order to form a three digit number with those three digits.

I write 633.

Now my friend asks me to tell him the three digit number and i say 633.

My friend looks at the number and does some mental calculations and says to me "hey, you circled a 6.

a. How does my friend do this?

b. What application of mathematical principles does this justify? Explain carefully.