Why is it not considering other option of B? i.e B->e
For S, it has two options: S->aB and S->aAb. If it chooses S->aB, it has two other options: B->aB and B->e. Let it choose B->aB => S->aB->aaB. Again 2 options: S->aB->aaaB (backtrack=1) S->aB->aa (backtrack =2). So it backtracts S->aB.
Now it chooses, S->aAb. Two other options: A->bAb and A->a. i.e S->aAb->abAbb (backtrack=3). S->aAb->aab(success).
So, isn't it no.of backtracks =3?