Let distance from A to B be x.
While, travelling from B to A the motorcycle will cover the same distance.
Time taken from A to B=distance/speed
Time taken from B to A=distance/speed
Average speed = Total distance covered/Total time taken