How to Build an XOR Gate from AND, OR, and NOT Gates

An XOR gate outputs one when its two inputs differ. Follow the Boolean expression and truth table to build XOR from basic gates, then compare the design with a NAND-only implementation.