Then the average speed from Tianjin to Beijing is +40 km/h.
(A+40)x0.5 is the distance from Tianjin to Beijing (speed x time = distance).
AX(30+6)/60 is the distance from Beijing to Tianjin (estimated half an hour, 6 minutes more).
The distance from Beijing to Tianjin is equal to the distance from Tianjin to Beijing (needless to say)
So (A+40)x0.5=AX(30+6)/60.
Just solve the equation. A= 200 kilometers per hour.