If the radius of the circle is d then its area is (pi)d^2 and its circumference is 2(pi)d, the length of wire we need to make the circle. The length of the remainder of the wire is l-2(pi)d, out of which we make the square. So the side of the square is a quarter of this perimeter, 1/4(l-2(pi)d), and the area of the square is the square of this side, 1/16(l-2(pi)d)^2. The sum of the areas of the circle and square is (pi)d^2+1/16(l-2(pi)d)^2.
We need the minimum value of this expression, where the variable is d. So we differentiate it with respect to d. That's the same as getting the difference quotient. The expansion of 1/16(l-2(pi)d)^2 is l^2/16-1/4(pi)ld+1/4(pi)^2d^2. [Please distinguish between 1 and l in the following.] The difference quotient is zero at a maximum or minimum, so we have 2(pi)d-l/4(pi)+1/2(pi)^2d=0. We can take out (pi), leaving 2d-l/4+1/2(pi)d=0. Multiply through by 4 to get rid of the fractions: 8d-l+2(pi)d=0, from which d=l/(8+2(pi)). Half the length of the side of the square is 1/8(l-2(pi)d). If we substitute for d in this expression we get 1/8(l-2(pi)l/(8+2(pi))) = l/8((8+2(pi)-2(pi))/(8+2(pi)) = l/8(8/(8+2(pi)) = l/(8+2(pi)) = d (QED). Therefore the radius of the circle = half the length of the side of the square is either a maximum or minimum value of the expression for the sum of the areas of the circle and square. We can see that this expression gets bigger as d gets bigger, because (pi)d^2 has a positive value always, so we do indeed have a minimum rather than a maximum.
We can substitute d=l/(2(4+(pi))) in the expression for the sum of the areas and we get the minimum:
(pi)d^2+1/16(l-2(pi)d)^2 = (pi)l^2/4(4+(pi))^2 + 1/16(l-2(pi)l/(2(4+(pi)))^2 = (pi)l^2/4(4+(pi))^2 + l^2/16(1-(pi)/(4+(pi))^2 = (pi)l^2/4(4+(pi))^2 + l^2/16(4+(pi)-(pi))^2(4+(pi))^2 = (pi)l^2/4(4+(pi))^2 + l^2/(4+(pi))^2 =
l^2/(4(4+(pi))) or (l^2/4)*1/(4+(pi))
Sorry, it was getting difficult to represent the expressions using this tablet so I've had to accelerate the last bit! I hope I didn't make any mistakes!