Given speed and distance, time can be calculated with
speed x time = distance
That means as the bird travels for 20 mph for x hours, it travels a distance of (20x) miles. Going back, the bird travels 4 mph slower. With its speed of 16 miles/h, the total distance traveled after x hours will be (16x) miles. This leaves a remaining of 6 miles for the bird to travel.
Equating this, we have
(20x) = (16x) + 6
20x - 16x = 6
4x = 6
x = 1.5
To get the distance, we substitute x into either (20x) or (16x + 6) which gives a value of 30 miles.