# Optimization: Cut wire in to two pieces one square and one circle

A straight piece of wire $40$ cm long is cut into two pieces. One piece is bent into a circle and the other is bent into a square. How should wire be cut so that the total area of both circle and square is minimized?

my work I found the function to be $(x/4)^2 + \pi ( (40-x) / 2\pi ) ^2$. However, the answer key showed a different answer and I'm not sure how to get to that equation. The critical point that I got was $160/(\pi+4)$, but it was $20/(\pi+4)$ for the answer key answer key

You did everything correctly. You just defined $x$ to be the perimeter of the square, while the answer key defined $x$ to be the radius of the circle. Indeed, look at the last sentence: one of the pieces has a length of $\frac{160}{\pi + 4}$.