Rule of square:
Black to move.....
What is rule of the square? In this position, white will queen the pawn if black cannot catch the pawn in time. How do you know black can catch in time before white reaches its queening square g8? Rule of the square helps you in that calculation. You count the number of squares for the pawn to queen and then create the imaginary square like so. The black king is now inside the square which means black will be able to catch the pawn before it queens
White to move.....
Things change dramatically when if in the same position its white to move; black can never get into the imaginary square because white's first move reduces the number of squares needed to queen the pawn and so does the square which becomes smaller and black has no chance to get into the square
The rule of the square is an important principle to learn in king and pawn endgames. It is also known as the pawn square rule. It is crucial to understand when you find yourself in a king and pawn endgame versus a king, where the king is chasing the pawn in an attempt to prevent it from being promoted.
The goal when you have the pawn is to move it to the other side of the board, the back rank, to promote it. This must be done in order to win the game. If the pawn fails to be promoted, it results in an automatic draw due to insufficient material.
To successfully promote the pawn, it must either be escorted by the king to prevent capture, or the opposing king must be far enough away for the pawn to reach the end of the board before it can be captured by the enemy king at the back rank square.