Because M is the midpoint of AB, then AM and MB are equal distances. And because a segment can be written as the sum of its pieces, AM + MB = AB.
So,
AM + MB = AB <--- distance of a segment is the sum of its pieces
AM + AM = AB <--- M is the midpoint, so AM = MB
3x + 3 + 3x + 3 = 8x - 6 <--- substituting known amounts that were given
6x + 6 = 8x - 6 <--- collect like terms on the left side
6x = 8x - 12 <--- subtract 6 on both sides
-2x = -12 <--- subtract 8x on both sides
x = 6 <--- divide both sides by -2
Because x = 6, we put it back into AM. 3(6) + 3 = 18 + 3 = 21
Thus, AM is 21 units.