I've noticed that when I use a cup that is square shaped with convex sides, it spills more easily than a circular cup. Why does this happen? What is the most spill-prone cup shape? What is the most spill-resistant basic cup shape?
When a square cup is displaced slightly from its position, the water inside it moves to a diagonal corner of the cup. If we look at the direction of motion of the fluid then we will see that the fluid moves from lower corner to upper diagonal corner. You can imagine your room as the cup and consider water in it. Suppose the room is slightly disturbed. The water will move towards a corner (visualize it in your room). The fluid hitting the sides of the walls get reflected(actually they experience a normal force) and add up to the velocity of the fluid in the diagonal direction. Again as the fluid moves towards the corner, the cross sectional area perpendicular to the diagonal goes on decreasing(imagine the diagonal of your room and visualize its perpendicular planes) However your cup has no such ceiling to bind the fluid. So the fluid moves over the top of the cup and is spilled.
The more closer the cup shape is to a sphere, the more spill resistant it is.(As then it will not have corners in any direction and the rate of decrease of perpendicular plane's cross sectional area will be the least)
Look at the bottom of a round cup. The distance from the center of mass, is the same in all directions from a point that is the center of the circle that forms the bottom of the cup. Thus when a force is applied to tip over the cup, the direction that the force is applied is unimportant because the distance from the center of the bottom of the cup is identical in all directions to the outer edge of the bottom of the cup.
The same is not true of a square bottomed cup. On a square bottomed cup, there are four points where the distance is a maximum, and four sides where the distance is a minimum. It is the minimum distance, less than that of a circle that make the square bottomed cup less stable than a round bottomed cup.
To maximize a cups stability, it needs to be short in height, and great in diameter of a circle at the base. There is a " spill proof " coffee cup that is basically a truncated cone ( point up ) with an open cylinder attached.
To think about bases, the least stable base is a triangle, and the most stable base is a circle. Stability increases as the number of sides at the base increases.
A square is more stable than a triangle. A five sided base is more stable than a four sided base. Etc. Also short and wide is more stable than tall and skinny.
It is the corners where the liquid molecules collect (for a very short time), collide and some of them tend to go upwards because that is the only available direction to move freely. The smaller is the angle between two sides, the greater the chance that liquid will spill from that corner (given that the motion of molecules inside the cup is random). A star shaped cup with narrow angles will be most prone to spilling. The next spill-friendly shape is an equilateral triangle.
A circular cup is most prone resistant because there are no corners where molecules can collect and bounce. That is, there is no barrier in the path of molecules where they collide with the walls and rise upwards. If you shape your cup a bit like a cone (the upper side being the narrow side), it will be maximum spill resistant when the contents are shaken.