To simplify, if the bath could be filled in say, 2 minutes, then it follows that in one minute half the bath will fill.
Tap A can fill the bath in 30 minutes. So, in one minute, 1/30th of the bath will fill.
Tap B can fill the bath in 45 minutes. So, in one minute, 1/45th of the bath will fill.
With the plug out, a full bath will empty in 20 minutes. So, in one minute, 1/20th of the bath will empty.
To start with, I'll work out how long it would take to fill the bath with both taps on and the plug in.
Adding the bath tap fractions, in one minute, 1/30 + 1/45 of the bath will fill. To add fractions you need a common bottom number (the denominator). A common denominator for those fractions is 90, something that will be divisible by both 30 and 45...
1/30 = 3/90
1/45 = 2/90
3/90 + 2/90 = 5/90
So it follows that in one minute, both taps fill 5/90ths of the bath.
So, to find out how many minutes it will take to fill the bath I need to work out how many 5/90ths of a bath are in one bath. There are 90 1/90ths in one bath, so it follows that there must be 18 5/90ths in one bath, 90 ÷ 5 = 18. 18 minutes to fill the bath with both taps on.
Can you work out how long it will take to fill the bath if both taps are on and the plug is out?