A boolean function can be represented using a boolean expression of boolean varibles and operators. Each law can be proved using a truth table or by the use of other laws. The dual of a boolean expression is obtained by interchanging boolean sums and products and interchanging 0's and 1's. Any boolean function may be represented by a boolean sum of boolean products of the variables and their complements. For all entries in the truth table where the output is one, construct a product term which consists of the input variables if they are one or their complements if they are zero.
Some gates are intrinsically better than others.
NAND gates are both faster and cheaper than AND gates. To invert the input X, use this one input as both of the inputs to the NAND gate.