Optimization with two shapes I am really stuck on this, the instructor went over the problem in class but I couldn't follow what was happening or why.
A piece of wire 10 m long is cut into two pieces. One piece is bent into a square and the other is vent into a circle. How should the wire be cut so that the total area enclosed is a maximum and B) a minimum.
So here is where I get confused, this is how I set up the problem.
square + circle = 10m
$4s + 2\pi r = 10$  where s is side of a square and r is radius of the circle
and $s^2 + \pi r ^2 = area$
$(\frac{10-2\pi r}{4})^2 + \pi r^2 = 10$
then I take the derivative
$\frac {-10\pi + 2\pi ^2}{4} + 2 \pi$ 
then I attempt to find zeroes
now I realize that I really messed this up so I have to start all over. I will edit that back in in 20 or so minutes.
I see what I did wrong, the derivative should be 
$\frac {-10\pi + 2\pi ^2}{4} + 2 \pi r$ 
which gives me zeroes of
$ x = \frac {5- \pi}{4}$
so what I did was solve for one variable and plug it into the area formula and then find a min or a max. This was very wrong and I don't know why. For some reason the teacher used 10-x and x for the lengths of wire but I do not see why that is necessary or why my set up is wrong.
 A: So basically this is how you tackle it: Let $x$ be the amount of wire that was cut that will be used to create the square. This implies that you have the rest ($10-x$) to do the circle.
Let us denote by $S(x)$ the area of the square. The reason why I write $S(x)$ is because it is a function of $x$. Similarly, let $C(x)$ denote the area of the circle. 
Now let us calculate what the functions ought to be. For $S(x)$, given that the perimeter of a square is four times its side, and knowing that the area of the square is side to the power of two, you obtain $$S(x)=(x/4)^2$$For the circle you now you have to calculate the radius. You are given its circumference which is $10-x$, hence $$10-x=2\pi r$$so solving for $r$ you get $r=\frac{10-x}{2\pi}$, and this implies that the area is equal to $$C(x)=(\frac{10-x}{2\pi})^2\pi$$From here the total area is going to be given by $A(x)=S(x)+C(x)$, now to finish the problem you should find the min and max values for this function (remember that $x$ attains values in $[0,10]$ only!). 
A: You may be shocked to discover that you are absolutely right. (The approach that uses $x$ and $10-x$ is also right.)
Using your notation, we have $4s + 2\pi r = 10$. We are trying to maximize and minimize
$s^2 + \pi r ^2$.  
Using the calculation that you mention in a comment, we have $r=\frac{5-2s}{\pi}$. Substituting in the formula for area, we see that we want to maximize/minimize $A(s)$, where 
$$A(s)=s^2+\pi\left(\frac{5-2s}{\pi}\right)^2.$$
If we allow $0$ radius or side, as we should here, we have the bounds $0\le s\le 2.5$.  
The expression for $A(s)$ can be simplified slightly to $s^2+(1/\pi)(5-2s)^2$. Now differentiate as usual. We get $A'(s)=2s-(4/\pi)(5-2s)$. Solve for $s$. 
Calculate $A(s)$ for the value of $s$ that you find. Calculate also $A(0)$ and $A(2.5)$, and among the three values you get, pick the big winner and the big loser.   
