As pointed out in other posts, the most basic relationship between guitar strings is that each higher string is tuned 5 semitones above the adjacent one. Except, as we’ve seen, the B string (string 2) is only 4 semitones above the G string.
What this means is that for any two strings, the notes at adjacent frets will be 5 st apart. So, for example, we know that the note at D7 will be 5 semitones higher than the note at A7.
And since we know that there are 12 semitones in an octave, we know that we will have to go 7 more on the higher string to get to the octave higher (5+7), or 5 lower to get to the same note.
The first (7 higher) is the “7 Fret Rule”. The second (5 frets lower) is the “5 Fret Rule”. These two notes will be 12 frets apart (one octave).