Given,
• Sum of perimeter of square and circle.
Let us consider,
• ‘x’ be the side of the square.
• ‘r’ be the radius of the circle.
• Let ‘p’ be the sum of perimeters of square and circle.
p = 4x + 2πr
Consider the sum of the perimeters of square and circle.
p = 4x + 2πr
4x = p – 2πr
x = p - 2πr/4 ---- (1)
Sum of the area of the circle and square is
A = x2 + πr2
Substituting (1) in the sum of the areas,

For finding the maximum/ minimum of given function, we can find it by differentiating it with r and then equating it to zero. This is because if the function f(x) has a maximum/minimum at a point c then f’(c) = 0.
Differentiating the equation (2) with respect to r:

To find the critical point, we need to equate equation (3) to zero.

Now to check if this critical point will determine the least of the sum of the areas of square and circle, we need to check with second differential which needs to be positive.
Consider differentiating the equation (3) with r:

Now, consider the value of

so the function A is minimum at r = p/2(π+4).
Now substituting r = p/2(π+4) in equation (1):

As the side of the square,

Therefore, side of the square, x = 2r = diameter of the circle.