To encode, one simply moves each letter down fixed positions in the alphabet, as shown in the figure on the right. This can also be expressed algebraically using modular arithmetic. If you think of A-Z in terms of their positions 0-25, and s is the shift, then the code for a plain text letter x will simply be (x + s) mod 26. Here u mod v is just the remainder when you divide u by v. To decipher ciphertext y, you do (y - s) mod 26.