Topic--Counting principle

Source: Internet
Author: User

Since the recent study of number theory, so this issue for everyone to bring a topic in number theory--counting principle, below we look at four concepts:

First, the principle of pairing:

For collections A, B, if there is a one by one mapping, f:a→b, then | a|=| B|, if it is difficult to calculate the value of a, it is better to change the method, first calculate the value of B, and then inverse a with one by one mappings, then we need to find such an easy to calculate B, which requires a very high skill.
Second, the principle of tolerance and repulsion:

The principle of <1> capacity repulsion

Divide the set A into subsets A1,a2,a3,...,am, namely: A=a1∪a2∪a3 ... ∪am

, in a nutshell, the set of requirements is equal to the complete collection minus all subsets intersecting the repeating part.

<2> Phasing out principle

Set S as a set, Ai as a subset of S, Kee =s-ai

|∩∩ ... ∩|=| s|-| A1∪a2∪a3 ... ∪am|

Three, counted two times:

Two times this is a good understanding, is the two methods to calculate a value, then the two methods are equivalent, set up the equation, you can find out what you want.

  code example: The Pique theorem:

A polygon area formula for calculating vertices on lattice points in a lattice: s=a+b÷2-1, where a represents the number of points inside the polygon, B represents the number of points on the polygon boundary, and S represents the area of the polygon

Iv. Number of Polya:

The Polya count is the state that calculates the unequal price of the symmetric case (rotation and specular reflection). Here are some simple formulas that consider symmetrical graphics and can be rotated and flipped (specular reflection).

① coloring of a positive Pentagon vertex with a p color, with a difference of [P (p2+4) (p2+1)/10].

② coloring of a positive quadrilateral vertex with a p color, in which there are [(P4+2P3+3P2+2P)/8] different conditions.

③ coloring of a positive triangular vertex with a p color, in which there are [(P3+3P2+2P)/6] different conditions.

Application Examples:

Example 1: The number of ordered splits--the principle of pairing

Title Description Description

The positive integer n is expressed as the sum of several positive integers, and the different order of the items in the formula, as well as different expressions, for example: 4=4=3+1=1+3=2+2=2+1+1=1+2+1=1+1+2=1+1+1+1, there are 8 ways to represent them. The above representation is called an ordered split of N, and the number of ordered splits of N is recorded as R (N), please calculate R (N).


  Divide n into N 1, in a row, between these 1 there is a n-1 space, in this n-1 space to fill in ' + ' means that the two sides of the 1 added, fill '-' means the space is abolished. In this way, each type of ' + ' or '-' method corresponds to n ordered splitting, according to the principle of pairing, R (n) equals n-1 space fill ' + ' or '-' method number, fill '-' method number is obviously n-1, so fill ' + ' method number is 2n-1.

Example 2: Number of parallelogram--pairing principle

Title Description Description

(left), the triangular ABC of the three sides of the n equal, cross each sub-point to do each side of the split line, the triangle ABC into some small parallelogram, calculate the number of these small parallelogram.


The number of small parallelogram that are not in BC is calculated first, and the set of these small parallelogram is recorded as a.

(right) shown, extend AB to D, take bd=ab/n, extend AC to E, take ce=ab/n. Divide the line de into n+1 segment and get the n+2 point (I only draw four points in the figure that actually has six split points on the de). Observe the set of any four-point group (i,j,k,l) on the de edge, over these four points, left two points to the right to do parallel lines, the right highlight to the left to do parallel lines, do AB and AC parallel lines, the only one to determine a side is not parallel to the BC small parallelogram (right gray section).

Therefore, | a|=| B|=c (n+2,4), which is the total number of methods selected from the n+2 point on the de for a group of 4 points

And because the triangle has three sides, each side can do similar selection, so the total number of parallelogram is 3xC (n+2,4).

Example 3: The book on the bookshelf--the principle of tolerance and repulsion

Title Description Description

On the shelf there are N books numbered,..., N. Now all n books are removed and then put back, when put back to require that every book can not be placed in the original position. For example: N=3.

The original position is:.

Put back only for: 3,1,2 or 2,3,1 these two kinds.

Question: How many ways are there to satisfy the above conditions when n=5?


In front of the "travel" This problem, I have told the wrong row problem, this question can certainly be solved by the formula of the wrong row problem, but this topic is the counting problem in number theory, of course, we should use the theory of high-point number method to solve.

  We use A1~A5 to indicate that the number of people who are not in their own position, that is to ask for |∩∩|

Topic--Counting principle

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.