What is a Commutator?
A commutator is a specific type of algorithm. It accomplishes a desirable effect on a Rubik's Cube by having a specific, tried-and-true pattern.
Basically, a commutator has the pattern X Y X' Y', where X and Y are either single turns or sequences of turns on a Rubik's Cube. This may not seem like a useful type of algorithm, but we will explore its utility later.
You may be asking yourself this question: "How do I take the inverse of a sequence of turns?" To take the inverse of a sequence of turns, reverse the order of the turns and take the inverse of each one. For example, if we want to take the inverse of the sequence (R F'), we first reverse the order of the turns (F' R) and invert each one (F R'). Note that the inverse of a 180° turn is itself.
Commutators have one problem: they are rigid. They only perform a set task, like flipping UF and UB. If you want to perform a similar task - flipping UR and LF, for example - you have to move the pieces UR and LF into the spots where UF and UB should be, perform the commutator, and move them back. The set of moves that you use to move the pieces into the spots you want them is called a setup move.
The pattern of a commutator with a setup move is then S X Y X' Y' S', where X and Y are single turns or sequences of turns, and S is a setup move.
Why are Commutators Useful?
To illustrate the utility of commutators, let's perform, and analyze, one. Our commutator that we are analyzing is [(R' D R D')*2, U'] - written out, that is ((R' D R D')*2) (U') ((R' D R D')*2)' (U')'.
Look at the top layer only. When we perform (R' D R D')*2, we twist UFR clockwise. That is the only effect. When we perform U', then, we move another piece into UFR's position. Doing ((R' D R D')*2)' twists the piece that is now in UFR's position counterclockwise. Finally, doing U moves UFR back to its correct place. So what we are doing is doing one thing on one piece, and the opposite on another piece. Every other piece in the top layer is undisturbed.
In fact, every piece in the bottom two layers is undisturbed as well! Why is this? Doing (R' D R D')*2 messes up the bottom two layers. The U' does not change the bottom two layers, only the top layer, so when we do ((R' D R D')*2)' we undo the messing-up of the bottom two layers. This makes them solved again. The final U, again, does nothing to the bottom layer.
So what a commutator really does is mess up one area of the Cube while doing a specific thing to another area, then fix the first area of the cube while performing the opposite of the specific thing to the second area.
Because commutators are so powerful - the one you just did twisted two corners without messing up any of the rest of the Cube - they are often used in creating algorithms for the Cube.