7. In village $A$, there are 100 schoolchildren, and in village $B$, there are 50 schoolchildren. The distance between the villages is 3 kilometers. At what point on the road from $A$ to $B$ should a school be built to minimize the total distance traveled by all schoolchildren?
$\triangle$ It seems fair to build the school closer to $A$, as there are more students there. But how much closer? Sometimes it is suggested to build the school one kilometer from $A$ and two kilometers from $B$ (twice as many students, so the school is twice as close). However, from the perspective of the given problem (minimizing the total distance traveled), this option is not the best; it is better to build the school directly at $A$.

![](https://cdn.mathpix.com/cropped/2024_05_21_90703b5d5e76e3b5cd3dg-009.jpg?height=114&width=308&top_left_y=1502&top_left_x=380)

This can be verified as follows: if the distances from the school to $A$ and $B$ are $x$ and $3-x$ respectively, then the total distance traveled by all students is $100x + 50(3-x) = 100x + 150 - 50x = 50x + 150$, so it is minimized (and equals 150 km) when $x=0$. $\triangleleft$

The same can be explained without formulas: each meter the school is moved towards $A$ reduces the distance for 100 students by one meter and increases the distance for 50 students by one meter, thus reducing the total distance by 50 meters.

It can also be said this way: divide all students at $A$ arbitrarily into two groups of 50 people each. If the second group did not exist, it would not matter where to build the school (the problem of the well) - but from the perspective of the second group, it is best to build it at $A$.

## A Few More Problems