Combinatorics is a subfield of discrete mathematics that focuses on counting combinations and arrangements of discrete objects. It involves counting the number of ways to put things together into various combinations. Some key rules in combinatorics include the sum rule, which states that the number of ways to accomplish either of two independent tasks is the sum of the number of ways to accomplish each task individually. The product rule states that the number of ways to accomplish two independent tasks is the product of the number of ways to accomplish each task. Generating functions can be used to efficiently represent counting sequences by coding terms as coefficients of a variable in a formal power series. They allow problems involving counting and arrangements to be solved using operations with formal power series.