Applications of Derivatives invloving surface area

A piece of wire 16 cm long is cut into two pieces, one piece is bent to form a square and the other is bent to form a circle. What is the exact length of the sides of the square, (let each side of the square be x cm) when the sum of the areas of the square and the circle is a minimum? i have no idea how to do this? help!

Let $x$ be the length of the piece used for the square and $y$ be the length of the piece used for the circle. Then $x+y=16$ and $A_\text{square}=(x/4)^2={x^2\over 16}$, $A_\text{circle}=\pi ({y\over 2\pi})^2={y^2\over 4\pi}$. But $x=16-y$ so $A_\text{square}={(16-y)^2\over 16}$. So you want to minimize $$A(y)={(16-y)^2\over 16}+{y^2\over 4\pi}, \quad 0\le y\le 16.$$ (I make it a closed interval since it's not clear from the problem statement that we must form both shapes.)
$$A'(y)=-{1\over 8}(16-y)+{1\over 2\pi}y=0\implies y={16\pi\over \pi+4}$$
$A(0)=16$, $A(16)={64\over \pi}\approx 20.37$, $A({16\pi\over \pi+4})\approx 8.96$ so the min occurs when $y={16\pi\over \pi+4}\implies x=16-{16\pi\over \pi+4}\approx 8.96$. So use $x=16-{16\pi\over \pi+4}$ of the wire on the square, which results in a square whose side length is $x/4\approx 2.24$.