# Half-full? Half-empty? Neither . . .

I ran across this image on FaceBook that had various answers to the classic “Is the glass half-empty or is it half-full?” question. The glass is classically rendered with the water level appearing about half-way up the height of the glass. After considering the possible answers I decided that the only one that was correct was the surrealist because the two equal length frustums (one filled with water and the other air) had different volumes. But this was an offhanded observation that I felt needed some proof. Sooo . . . here we go.

First, let’s design a glass from an easy function:

I’m going to divide the glass in two exactly at half its height. The question is, do both halves contain the same amount of water? To answer that use the formula found on the wikipedia page:

So where along the x-axis is half full? There are a couple of ways to approach this question but since we’re already thinking about the above diagram as a solid of revolution and with a little programming a general approach for all glasses can be devised.

The basic idea is to derive the definite integral of the function so that by setting the limits appropriately we can find the total volume and search for the x value that evaluates to half the total volume. The integrations of two functions (the one above and another for a more curved glass) can be seen here. The formulas are coded into the following script:

When this script is executed the output is:

```lower_bound = 2.000000
upper_bound = 4.000000
height      = 2.000000
volume      = 14.660766
half-volume = 7.330383
Tolerance : 0.000001

Iterations: 23
lower_bound = 2.000000
upper_bound = 3.301927
height      = 1.301927
volume      = 7.330384```

So the x-axis value which divides the glass into two equal volumes is the lower bound plus the height of 1.301927 or 3.301927. Checking the math using this new value gives:

Well, ok, they aren’t exactly equal . . . the difference is 3.708323 X 10^-6. Close enough. The glass with the correct amount of fluid in it would look like the following.