I want to build a garden patch and the east and west sides of the fence cost $4\$$ per feet and the the north and south side costs $2\$$ a feet. My budget is $80\$$. What's the largest area that can be made?
There is a standard approach to this kind of maximization problem. First express the quantity to be maximized in terms of the quantity or quantities that are under your control. Here the quantity to be maximized is the area, and the quantities under your control are the dimensions of the field. Let $A$ be the area, $x$ the length of the north and south sides, and $y$ the length of the east and west sides; then $A=xy$.
Now deal with the constraint: the cost must be no more than $\$80$. How is this related to the input variable $x$ and $y$? If $C$ is the cost, the cost of the north side is $2x$, as is the cost of the south side, while the cost of the east and west sides is $4y$ each. Thus, $C=2\cdot2x+2\cdot4y=4x+8y$, and we must have $4x+8y\le 80$. It’s clear that we’ll need to use the entire budget if we’re to get the largest possible area, so we might as well assume that $4x+8y=80$ and hence that $x+2y=20$. (It’s usually a good idea to simplify things as you go.)
This constraint now lets us express one of $x$ and $y$ in terms of the other. Since I can avoid fractions by solving for $x$, I’ll do so: $x=20-2y$. Substituting that into the area equation allows us to express the area in terms of one independent variable: $A=xy=(20-2y)y=20y-2y^2$.
Now you have a routine calculus problem: find the maximum of the function
for $0\le y\le 10$. (Clearly $y$ cannot be negative, and since $x$ must also be non-negative, and $x+2y=20$, $y$ cannot be any more than $10$. Find the critical points and check them and the endpoints of the interval to find the maximum.