the difference between the first two perfect squares that end with 9 is
The first perfect square that ends in 9 is 3^2
The next one is 7^2 = 49
So 7^2 - 3^2 = 49 - 9 = 40