Elementary school problems are solved by arithmetic first;
If the speed is 50 meters per minute, he will be 8 minutes late, that is, by the time of class, he will be 50*8=400 meters away from school.
Go ahead 2*50= 100 meters. If you change the speed to 50+10 = 60m/min, you will arrive five minutes earlier. So if he had walked at a speed of 60m/min from the beginning, he would have arrived early: 5+(2- 100/60)=5 and 1/3.
If he keeps walking after school, he will walk more by class time: 60* 16/3=320 meters.
Then the time from home to school is: (400+320)/(60-50)=72 minutes.
The distance from home to school is: 50 * (72+8) = 4000m.
Solve by equation:
Suppose the class time from home to school is X.
50*(X+8)=50*2+(X-2-5)*60
X=72
Then the distance is: 50 * (72+8) = 4000m.