The figure above shows an grid but this time with more holes than before!
Count the total number of quadrilaterals in the grid above.
Clarifications :
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Relevant wiki: Principle of Inclusion and Exclusion - Multiple Sets
Let's label the holes like so:
Let's imagine that the mouse didn't make it as dinner and the holes aren't there. Then from this note , the number of quadrilaterals in the 8 × 8 grid is ( 2 9 ) × ( 2 9 ) = 4 8 × 8 × 9 × 9 = 1 2 9 6
Now, since I don't like holes, we need to remove quadrilaterals that contain the holes.
Denote n ( □ ) as the number of quadrilaterals that contain at least the specified holes (for example n ( A , C ) would equal to the number of quadrilaterals that contain the holes A , C , which might also contain B and D ), then by PIE , the total number of desired quadrilaterals (Reminder! Quadrilaterals without holes!) is n ( A ) + n ( B ) + n ( C ) + n ( D ) − n ( A , B ) − n ( A , C ) − n ( A , D ) − n ( B , C ) − n ( B , D ) − n ( C , D ) + n ( A , B , C ) + n ( A , B , D ) + n ( A , C , D ) + n ( B , C , D ) − n ( A , B , C , D )
Man, that looks like it's going to be a really messy calculation! Don't worry, we have some shortcuts.
One way to construct quadrilaterals is by choosing two horizontal lines and two vertical lines from the grid. For a quadrilateral to contain the specified holes, its left vertical edge must be on the left of all the specified holes, and its right vertical edge must be on the right of all the specified holes. Similarly, its top horizontal edge must be above all the specified holes, and its bottom horizontal edge must be below all the specified holes.
With that in mind, we can note that n ( A , B , C ) = n ( A , B ) , n ( B , C , D ) = n ( B , D ) and n ( A , B , C , D ) = n ( A , B , D ) , the above expression simplifies to n ( A ) + n ( B ) + n ( C ) + n ( D ) − n ( A , C ) − n ( A , D ) − n ( B , C ) − n ( C , D ) + n ( A , C , D )
Doesn't look that messy now! :D
Consider n ( A ) , for quadrilaterals to contain A , its left edge must be on the left of A , its right edge must be on the right of A , its top edge must be above A , and its bottom edge must be below A . There are 4 vertical lines on the left of A , 5 vertical lines on the right of A , 5 horizontal lines above A and 4 horizontal lines below A . We choose 1 from each of them, hence n ( A ) = 4 × 5 × 5 × 4 = 4 0 0
With the same logic, n ( B ) = 3 × 6 × 7 × 2 = 2 5 2 n ( C ) = 4 × 5 × 7 × 2 = 2 8 0 n ( D ) = 6 × 3 × 6 × 3 = 3 2 4
Consider n ( A , C ) , for quadrilaterals to contain A and C , its left edge must be on the left of both A and C , its right edge must be on the right of both A and C , its top edge must be above both A and C , and its bottom edge must be below both A and C . ∴ n ( A , C ) = 4 × 5 × 5 × 2 = 2 0 0
I bet you can see where this is going. :) n ( A , D ) = 4 × 3 × 5 × 3 = 1 8 0 n ( B , C ) = 3 × 5 × 7 × 2 = 2 1 0 n ( C , D ) = 4 × 3 × 6 × 2 = 1 4 4
n ( A , C , D ) = 4 × 3 × 5 × 2 = 1 2 0
∴ n ( A ) + n ( B ) + n ( C ) + n ( D ) − n ( A , C ) − n ( A , D ) − n ( B , C ) − n ( C , D ) + n ( A , C , D ) = 4 0 0 + 2 5 2 + 2 8 0 + 3 2 4 − 2 0 0 − 1 8 0 − 2 1 0 − 1 4 4 + 1 2 0 = 6 4 2
Therefore, there are 6 4 2 quadrilaterals that contains holes, the total number of quadrilaterals that don't contain holes in the original grid is 1 2 9 6 − 6 4 2 = 6 5 4 .