Structure of soap bubbles.
The soap molecules that we still use have two heads, a hydrophobic head and a water suction head. Soap molecules surround the water molecules with the head absorbing water towards the water molecule and the hydrophobic head towards the opposite side. Then, a thin layer of water sandwiched between two layers of soap molecules will form the bubble surface.
Because the suction force at the surface of the bubble has molecules sticking together, creating surface tension and forming barriers against the air molecules in and out want to go through the bubble layer. In order for this fragile membrane to be able to prevent other air molecules from passing through it, it is expected to form a sphere to reduce the surface area of the structure.
Now, scientists have created wire frames molded into different shapes so that when immersed in soap solution, soap bubbles with shapes like cubes or pyramids are created.