As 2a9b1 is a five digit number and perfect square, the number is a 3 digit number and as unit digit is 1 in the square, in square root, we have either 1 or 9 as units digit (as other digits will not make unit digit 1).
Further as first digit in square 2a9b1, in the place of ten-thousand is 2, we must have 1 in hundreds 'place in square root. Further as first three digits are 2a9 and √209>14 and √299≤17.
Hence, numbers can only be 149, 151, 159, 161, 169, 171 as for 141 and 179, squares will have 1 or 3 in ten thousands place.
Of these only 1612=25921 falls as per pattern 2a9b1 and hence a=5 and b=2 and hence
ab−1+ba−1=52−1+25−1=51+24=5+16=21