Dividing a square into two regions with minimal interface We want to divide a unit square into a black region of given area $A\in[0,1]$ and a white region of area $1-A$, while minimizing the interface perimeter between the two regions. Let's say both regions must be contiguous.
Note that without loss of generality, we may consider the restricted range $A\in\left[0,\frac{1}{2}\right]$, because we can always swap the black and white regions.

A simple way of dividing the square into two regions is to draw a straight line parallel to two of the sides (right figure). This works for any area, and has an interface perimeter of $P=1$, regardless of the area.
Another solution* is to draw a quadrant, centered at one of the square's corners (left figure). Clearly, we can enclose more than half of the area with this method, so it can be used for any given $A$. Using simple geometry, we can show that to enclose an area $A<\frac{1}{2}$, the interface perimeter will be $P = \sqrt{\pi} \sqrt{A}$.
This means that the quadrant is a better solution than the line when $\sqrt{\pi}\sqrt{A}<1$, or $A<\frac{1}{\pi}$, and a candidate optimal (?) solution would be:

My question is:


*

*Is there a solution better than the one above? 

*If not, how can we
prove that this solution is optimal?


Bonus question:


*

*Does the optimal solution change if the regions are not required to be contiguous?



*Other solutions such as a full circle, a semi-circle using the border as a diameter, a square using the borders as two of the sides, and a diagonal line at 45 degrees all do worse than the quadrant for any $A$, and therefore cannot feature in an optimal solution.
 A: This is known as the relative isoperimetric problem/inequality; look it up. The calculus of variation tells us that the free boundary (the interface between two regions) must be of constant curvature. Otherwise one could perturb the boundary, pushing inward where the curvature is large and pushing out where it is small, thus saving in perimeter while maintaining the area. 
Also, if the boundary  meets any side of the square, it must meet it at the right angle. This can also be seen from a variation, moving the contact point to bring the angle closer to 90 degrees. Or, reflect across that side of the square: the new domain is optimal within a larger rectangle, and since the free boundary must be an arc or a line segment (constant curvature), there cannot be a sharp corner in it. 
Thus, the only shapes that qualify are:


*

*a disk not touching the boundary of square

*a half-disk centered on a side of square

*a quarter-disk centered at a corner of square

*a rectangle cut off by a line perpendicular to two sides of the square.


It's easy to compare these and find that 1 and 2 never win, while 3 or 4 may be optimal, the phase transition happening as you describe. 
