
build a school
Two towns, A & B, are 5 miles apart. It is proposed to build a school to serve 300 students in town A and 700 students in town B. How far from town A should the school be built if the total distance traveled by all 1000 students is to be as small as possible?

I think it's right
Lets call the distance between a and the school 'x'
so the total distance traveled = 300x + 700(5x)
we want to minimize the function y = 300x + 700(5x)
which simplifies to
y = 300x + 3500  700x
y = 400x + 3500
To minimize the function we need to maximize x, x=5 is the highest number that makes sense.
therefore the school should be in town B.

I feel really stupid, but I am not sure at all what you did. Can you explain it any other way?

Sure
Here is a map of the towns and school:
A......S.....................B
we know that the distance from A to B is 5.
Let us call the distance from A to S, x
therefor the distance between B to S is '5x'
The distance traveled by all students in town A = 300*x
The distance traveled by all students in town B = 700*(x5)
The total distance traveled by all students is 300*x+700*(x5)
we want to minimize this function over the possible domain 0<=x<=5
The function simplifies to 400x+3500
looking at the function, since x is negative the bigger x is the smaller the function will be, the maximum x can be is 5.
The school is x miles away from town A, in this case 5 miles away, so in fact the school should be in town B which is 5 miles away from town A.
Think if you moved the school one mile closer to town A then 700 kids from town B would have to walk one mile farther, but only 300 students from town A would walk one mile less, so there is no overall benefit to that.