In this article we review the inclusion-exclusion principle (PIE) from set theoretical and algebraic points of view and discuss its application to the calculation of permanents, a subject that is not normally covered in undergraduate courses. The presentation is intended to be rigorous but elementary, accessible to first-year students in mathematics, science, and engineering programs, requiring only familiarity with set notation, arithmetic and matrix algebra. In dealing with the calculation of permanents, we present the Ryser algorithm, one of the most spectacular developments in the approach to difficult combinatorial problems, whose computational complexity we briefly discuss. The article contains examples, complementary notes, and a program in Python that implements Ryser's algorithm using Gray codes to calculate permanents, accompanied by its discussion.
Read full abstract