When doing an optimization problem to find the max/min value e.g. of area distance etc, when would you use the end points to find the max/min and how would you find the domain of the equation you are going to differentiate?
1) Always use the endpoints. Calculus problems without Domain considerations are doomed to failure.
2) You have to think about the Domain. This is why they made you do all those silly problems in algebra.
Boxes are easy. You are talking about an actual box. Normally, this would be greater than zero. Further, if you've finite material, you need stuff for all four sides. You can't use it all on one side and still expect a box.
An obvious but useful example is the standard "cut a square out of the four corners of a sheet of card board that is 18" x 24"." You must cut more than 0", or you get a flat sheet. You're cutting a length - twice - from each edge. This limits cutting to less than 9". In this case, if your calculus says the solution is 11.4", you will need to use one of those endpoints.
3) Just for emphasis---If you are like most students of my acquaintance, you have learned to be very lazy with Domain Considerations. Don't be. Get it up to speed. Always, ALWAYS keep your Domain in mind.