538.com's Puzzle of the Overflowing Martini Glass - How to compute the minor and major axis of an elliptical cross-section of a cone FiveThirtyEight.com Riddler Puzzle / May 13
The puzzle goes like this;
"It’s Friday. You’ve kicked your feet up and have drunk enough of your martini that, when the conical glass () is upright, the drink reaches some fraction p of the way up its side. When tipped down on one side, just to the point of overflowing, how far does the drink reach up the opposite side?"
I came up with an an answer of $ p^2 $, based on the following (probably incorrect) solution;

$
\begin{aligned}
\overline{AE} &= \overline{AD} &&= 1 \dots \text{length of one side}\\
\overline{AC} &= p &&=\text{initial distance of liquid  along one side from the bottom}\\
\overline{AB} &= q &&= \text{distance when glass is tipped over to the other side}\\
h_p &= p \cos\theta &&= \text{height of upright triangle} \\
b_p &= 2p \sin\theta &&= \text{base of upright triangle} \\
h_q &= \overline{AE} \sin(2\theta) &&= \text{height of tipped-over triangle} \\
&= 2\sin\theta\cos\theta\\
b_q &= q &&= \text{base of tipped-over triangle} \\
&&&\\
\triangle(ACF) &= \left( \displaystyle \frac{h_p b_p}{2} \right) &&= p^2\sin\theta \cos\theta\\
\triangle(ABE) &= \left(\displaystyle\frac{h_q b_q}{2}\right) &&= q\sin\theta\cos\theta&&\\
\end{aligned}
$
$\begin{aligned}
\text{As   } & \text{volume of cone AEB} &&= \text{volume of cone ACF,}\\ 
  & \triangle(ACF) &&= \triangle(ABE) \dots \text{(leap of faith?)}\\ 
& q &&= p^2 \\ 
\end{aligned}
$
So the questions are;
a) Is it valid to assume that equal volumes imply equal vertical cross-sections?
b) How to derive the major and minor axes of the elliptical cross section $BE$ (so we can state the equation for the tilted volume in terms of $\overline{AB}$, and ultimately state $\overline{AB}$ as a function of $p$)?
 A: Consider this diagram, representing a side view of the martini glass with "tipped" so that the beverage reaches a maximum distance $x := |\overline{OX}|$ and minimum distance $y := |\overline{OY}|$ from cone vertex $O$:

Let $O^{\prime\prime}$ be the midpoint of $\overline{XY}$, so that it is 
the center of the represented ellipse; thus, $|\overline{O^{\prime\prime} X}| = |\overline{O^{\prime\prime} Y}| = a$ is the ellipse's "major radius".
Two observations follow quickly:



*

*With $H$ the foot of the perpendicular from $O$ to $\overline{XY}$, so that $h := |\overline{OH}|$ is an altitude of $\triangle XOY$ (and congruent to the altitude of the beverage cone itself),
$$a h = |\triangle XOY| = \frac{1}{2} x y \sin 2\theta \tag{1}$$





*

*With "horizontals" $\overline{XX^\prime}$, $\overline{YY^\prime}$, and $\overline{X^{\prime\prime}Y^{\prime\prime}}$ as shown above, we see that $\overline{O^{\prime\prime} X^{\prime\prime}}$ and $\overline{O^{\prime\prime}Y^{\prime\prime}}$ are necessarily midpoint segments of respective triangles $\triangle XYX^\prime$ and $\triangle XYY^\prime$; therefore,
$$|\overline{O^{\prime\prime}X^{\prime\prime}}| = \frac{1}{2} |\overline{XX^\prime}| = x \sin\theta \qquad\text{and, likewise}\qquad |\overline{O^{\prime\prime}Y^{\prime\prime}}| = y\sin\theta \tag{2}$$


Also, we note that $b$, the ellipse's "minor radius", is the length of a segment perpendicular to $\overline{X^{\prime\prime}Y^{\prime\prime}}$ at $O^{\prime\prime}$ that meets a (semi-)circle with diameter $\overline{X^{\prime\prime}Y^{\prime\prime}}$:

This is the classical construction of the geometric mean of two values, and we have 
$$b^2 = |\overline{O^{\prime\prime}X^{\prime\prime}}| |\overline{O^{\prime\prime}Y^{\prime\prime}}| = x y \sin^2 \theta \tag{3}$$
Now, since the volume of a cone whose base is an ellipse with radii $a$ and $b$, and whose height is $h$, is given by
$$V = \frac{1}{3}\cdot(\text{area of base})\cdot(\text{height}) = \frac{\pi}{3} ab h \tag{4}$$
we have
$$V = \frac{\pi}{3}\cdot a h \cdot b = \frac{\pi}{3}\cdot \frac{1}{2}x y \sin 2\theta \cdot \sqrt{ x y \sin^2\theta} = (xy)^{3/2}\cdot\frac{\pi}{6}\sin\theta\sin 2\theta \tag{$4^\prime$}$$
That is, for fixed $\theta$, we can say more simply:

$$V^2 \;\;\text{is proportional to}\;\; (xy)^3 \tag{$\star$}$$

This being so ... If a certain volume of beverage in a "tilted" glass reaches extreme distances $x$ and $y$ from the vertex, and the same volume of beverage in a "level" glass reaches distance $z$ (in all directions) from the vertex, then we clearly have

$$x y = z^2 \tag{$\star\star$}$$

The "level" distance is the geometric mean of the "tilted" extremes! I suspect that, given the tidiness of this relation, there should be a shorter route to it.

Edit to add ... As @hypergeometric has made the observation that (for constant volume) the ellipse's minor axis and the side-view area remain constant, I'll mention how that these facts arise from my analysis. Simply combine $(\star)$ with $(3)$ and $(1)$ to get:

  
*
  
*$V$ is proportional to $b^3$.
  
*$V^2$ is proportional to $|\triangle XOY|^3$.
  

Then, the constancy of $V$ implies the constancy of the other values.
A: Diagram below shows side and aerial views of upright and tilted martini glass. 

For the upright glass, the shape of the martini liquid is an inverted right circular cone, with height $p\sin\theta$ and circular base of area $A_1$. Volume of martini is given by:
$$\begin{align}
V&=\frac 13\cdot A_1 \cdot p\cos\theta\\
&=\frac 13\cdot \pi (p\sin\theta)^2\cdot p\cos\theta\\
&=\frac 13\cdot \pi p\sin\theta\cdot \underbrace{\left(\frac 12 \cdot p^2\cdot \sin 2\theta\right)}_{\text{area of sideview cross-section}}
&&\cdots (1)
\end{align}$$
For the tilted glass, the shape of the martini liquid is an inverted ellipsoidal cone, with height $h$ and ellipse base with area $A_2$ and semi-major and semi-minor axes of $a$ and $b$ respectively.  Volume of martini is given by:
$$\begin{align}
V&=\frac 13\cdot A_2 \cdot h\\
&=\frac 13\cdot \pi ab\cdot h\\
&=\frac 13 \cdot \pi b \cdot \underbrace{\left(\frac 12 \cdot 2a\cdot h\right)}_{\text{area of sideview cross-section}}\\
&=\frac 13 \cdot \pi b \cdot \underbrace{\left(\frac 12 \cdot q\cdot 1\cdot \sin 2\theta\right)}_{\text{area of sideview cross-section}}\\
\end{align}$$
Also, when glass is tilted, top surface of martini liquid changes from a circle to an ellipse, elongating along direction of tilt, with width remaining unchanged, i.e semi-minor axis of ellipse is equal to radius of original circle, or $b=p\sin\theta$. Hence
$$V=\frac 13 \cdot \pi p\sin\theta \cdot \left(\frac 12 \cdot q\cdot 1\cdot \sin 2\theta\right)\qquad\cdots (2)$$
Volume remains the same:   
$(1)=(2)$ :
$$\begin{align}
\frac 13\cdot \pi p\sin\theta\cdot \left(\frac 12 \cdot p^2\cdot \sin 2\theta\right)
&=\frac 13 \cdot \pi p\sin\theta \cdot \left(\frac 12 \cdot q\cdot 1\cdot \sin 2\theta\right)\\
\underbrace{\frac 12 \cdot p^2\cdot \sin 2\theta}_{\text{area of upright sideview cross-section}}&=\underbrace{\frac 12 \cdot q\cdot 1\cdot \sin 2\theta}_{\text{area of tilted sideview cross-section}}\\\\
\color{red}{q}&\color{red}{=p^2}\qquad\blacksquare
\end{align}$$
The above also shows that the area of the sideview cross-section remains the same before and after tilting. 

Special Note:
In the name of science and mathematics, I ordered myself a martini!
Pics shown below.  Toothpick measures diameter of circle and minor axis of  ellipse, and shows that they are both the same.  Olive marks centre of circle/ellipse respectively.

Upright martini glass

Tilted martini glass

Edit
This section has been added to address the point raised by @DavidK about the assumption on the ellipse semi-minor axis.
Recap:
By equating volumes, we have
$$\begin{align}
V_\text{upright}&=V_\text{tilted}\\
\frac 13\cdot \pi (p\sin\theta)^2 \cdot (p\cos\theta)&=\frac 13\cdot \pi ab \cdot h\\
p\sin\theta\cdot \left(\frac 12\cdot 2p\sin\theta\cdot p\cos\theta\right)&=b\cdot \left(\frac 12 \cdot 2a\cdot h\right)\\
p\sin\theta\cdot \left(\frac 12 p^2 \sin 2\theta\right)&=b\cdot \left(\frac 12\cdot q\cdot 1\cdot \sin 2\theta\right)\\
p^3\sin\theta&=bq&&(1)
\end{align}$$
Now consider the side view of the tilted glass (see diagram below).

From the diagram it is clear that
$$\begin{align}
r&=\frac 12 (1+q)\sin\theta\\
d&=\frac 12 (1-q)\sin\theta\\
b&=\sqrt{r^2-d^2}\\
&=\sqrt {q} \sin\theta&&(2)
\end{align}$$
From $(1), (2)$, 
$$\begin{align}
p^3\sin\theta&=\sqrt{q}\sin\theta\cdot q\\
&=q^{3/2}\sin\theta\\
\color{red}q&\color{red}{=p^2}\qquad\blacksquare\end{align}$$
Substuting the result in $(2)$ gives
$$b=p\sin\theta$$.

Additional Note:
From additional analysis it can be seen that, for a conical glass, 
constant volume implies constant lateral width, i.e. $b=p\sin\theta$, and vice versa. 
A: On the surface of the cone, $\frac rz=\tan\theta$. On the planar surface of the fluid, using the point-slope formula for a line
$$\frac{z-h}{r\cos\psi-h\tan\theta}=\tan\phi$$
Where $\phi$ is the angle of tilt of the glass and $\psi$ will be the azimuthal angle. $\psi=0$ at point $E$ in the diagram. On the meniscus,
$$z=\frac r{\tan\theta}=h+r\tan\phi\cos\psi-h\tan\theta\tan\phi$$
So
$$r=\frac{h(1-\tan\theta\tan\phi)}{\frac1{\tan\theta}-\tan\phi\cos\psi}=\frac{h(1-e)\tan\theta}{1-e\cos\psi}$$
Where we have used the variable $e=\tan\theta\tan\phi$ to clean things up a little. Then we can calculate
$$\begin{align}V_{\phi}&=\int_0^{2\pi}\int_0^{\frac{h(1-e)\tan\theta}{1-e\cos\psi}}\int_{\frac r{\tan\theta}}^{h+r\tan\phi\cos\psi-he}dz\,r\,dr\,d\psi\\
&=\int_0^{2\pi}\int_0^{\frac{h(1-e)\tan\theta}{1-e\cos\psi}}\left[h(1-e)-\frac{r(1-e\cos\psi)}{\tan\theta}\right]r\,dr\,d\psi\\
&=\int_0^{2\pi}\left[\frac12h(1-e)\frac{h^2(1-e)^2\tan^2\theta}{(1-e\cos\psi)^2}-\frac1{3\tan\theta}\frac{h^3(1-e)^3\tan^3\theta}{(1-e\cos\psi)^2}\right]d\psi\\
&=\frac16h^3(1-e)^3\tan^2\theta\int_0^{2\pi}\frac{d\psi}{(1-e\cos\psi)^2}\end{align}$$
We will let $\nu=\psi-\pi$, then use the eccentric anomaly
$$\sin E=\frac{\sqrt{1-e^2}\sin\nu}{1+e\cos\nu},\,\cos E=\frac{\cos\nu+e}{1+e\cos\nu},\,(1-e\cos E)=\frac{1-e^2}{1+e\cos\nu},\,dE=\frac{\sqrt{1-e^2}d\nu}{1+e\cos\nu}$$
Then
$$\begin{align}V_{\phi}&=\frac16h^3(1-e)^3\tan^2\theta\int_{-\pi}^{\pi}\frac{d\nu}{(1+e\cos\nu)^2}\\
&=\frac16h^3(1-e)^3\tan^2\theta\int_{-\pi}^{\pi}\frac{(1-e\cos E)dE}{(1-e^2)^{3/2}}\\
&=\frac16h^3\left(\frac{1-e}{1+e}\right)^{3/2}\tan^2\theta\left[E-e\sin E\right]_{-\pi}^{\pi}\\
&=\frac13\pi h^3\tan^2\theta\left(\frac{1-e}{1+e}\right)^{3/2}\end{align}$$
When the glass is full and not tilted it holds a volume
$$V_0=\frac13\pi h^3\tan^2\theta$$
And since the volume scales as $p^3$, we have the current volume
$$V_{\phi}=V_p=p^3V_0=p^3\frac13\pi h^3\tan^2\theta=\frac13\pi h^3\tan^2\theta\left(\frac{1-e}{1+e}\right)^{3/2}$$
We can find the distance the fluid goes up the far side by setting $\psi=\pi$,
$$r=\frac{h(1-e)\tan\theta}{1+e}=qh\tan\theta$$
Where $q$ is the fraction of the far side the fluid reaches. Since $p=\left(\frac{1-e}{1+e}\right)^{1/2}$ and $q=\frac{1-e}{1+e}$, we see that in fact $q=p^2$. Amazing!
A: We assume the glass cone has height and radius $1$ (hence side length $\sqrt{2}$) without loss of generality, because any other form factor can be obtained by uniform scaling in the direction of the glass's axis, which preserves ratios of volumes (liquid to glass in both upright and tipped configurations), and of lengths of parallel line segments ($p$ and $x$, where $x$ is the answer we're looking for).

The volume of the upright liquid is $\frac{1}{3}\pi p^3$, that of the oblique elliptical cone formed by the tipped liquid is $\frac{1}{3}\pi abh$, and so $abh=p^3$. Let $x$ be the height of the lower edge of the tipped liquid (and hence the fraction of lengths that is our answer).  The area of the right triangular central cross-section of the liquid can be expressed as one-half base times height in two ways:
$$ah = \frac{1}{2}\sqrt{2}(\sqrt{2}x)=x$$
Where $r$ is the radius of the glass cone at the center of the ellipse, and $d$ the distance between the center of the ellipse and the axis of the glass, the following are easy to confirm using similar triangles and the Pythagorean theorem.
$$r = x + \frac{1-x}{2} = \frac{x+1}{2}$$
$$d = 1-\frac{x+1}{2}=\frac{1-x}{2}$$
$$b=\sqrt{r^2-d^2}=\sqrt{x}$$
$$abh=x\sqrt{x}=p^3$$
$$x=p^2$$
(This solution is much like one I supplied to fivethirtyeight.com.)
A: This solution is closely related to the Lorentz transformation solution I posted earlier, but is perhaps closer to the heart of the matter. Apologies for posting multiple solutions, but I hope each adds something interestingly new.

Assume without loss of generality that the side-length of the glass is $1$ and the apex a right angle, with $x$ and $y$ axes along sides of the glass as in the diagram, and consider the simple squeeze mapping $M$:
$$M=\left(\begin{matrix}
\frac{1}{k} & 0 & 0 \\
0 & k & 0 \\
0 & 0 & 1 
\end{matrix}
\right)
$$
For those unfamiliar with the matrix representation, $M$ represents a function, an affine linear transformation, that maps coordinates to coordinates as follows:
$$(x',y',z') = (\frac{x}{k},ky,z)$$
We will now show that $M$ maps (the coordinates in) the upright liquid cone to (the coordinates in) an oblique elliptical cone that also is bounded by the cone of the glass.  The planar surface of the upright liquid (the steeper blue line) is mapped to another planar surface (the shallower one). Like every point on the cone, each of the original perimeter points either is on the $x$ or $y$ axes and stays there under transformation, or is on a cross-section of the glass cone that follows a hyperbola of the form (for some particular $z$) $xy=\frac{z^2}{2}$, and stays on that hyperbola under transformation (because $x'y'=xy$), and hence stays on the cone.  So $M$ maps the perimeter to a co-planar closed curve on the cone: an ellipse.  When $k=p$, an $x$ value of $p$ maps to $1$, so the highest point on the ellipse is at the rim. Squeeze mappings are volume-preserving (see below).  Thus with $k=p$ we have the cone we are looking for: same volume, perimeter of the base on the glass cone, and tipped to the rim.  And $y=p$ maps to $y'=p^2$, so the lower edge of the elliptical surface is $p^2$ of the way up the side. Therefore the answer is $p^2$ (indeed the product of the side-lengths of the liquid cone is $p^2$ for any value of $k$).  
(To see that $M$ preserves area in the $x-y$ plane, consider any figure broken up into infinitesimal squares of side $s$ and area $s^2$, oriented with the axes. $M$ maps these to rectangles of sides $\frac{s}{k}$ and $sk$, and so they retain their area.  That volume is preserved follows easily, since depth ($z$) is unchanged.) 
A: This is inspired by remarks several people made in thinking about the martini puzzle: the glass is a light cone, and tipping is a Lorentz transformation!  I want to show that at least the latter is literally true.
A Lorentz transformation maps a coordinate system into another, based on one parameter $v$, normally thought as the relative velocity of two frames of reference in Special Relativity, but for us just a number determining the angle of tilt.  We will use the transformation not as a way to generate new coordinates for fixed objects, but as a way to distort one object (the liquid right cone) into another object (the liquid oblique, elliptical cone) of the same volume.
We'll work in three dimensions, but the key ones will be $x$ (the sideways direction of the tilt) and $t$ (the axis of the glass). Coordinate systems related by a Lorentz transformation (for $v \neq 0$) assign different coordinates to the same physical points ("events" in space-time in Special Relativity).  Measuring by these coordinate systems gives different answers for lengths and angles, except in the case of the diagonal planes $x=\pm t$, which are invariant under transformation (all systems agree as to which points have the identical $x$ and $t$ values, but disagree as to what those values are).
The particular transformation we are interested in is this (choosing units so that $c=1$):
$$X = \frac{x-vt}{\sqrt{1-v^2}}$$
$$Y = y$$
$$T = \frac{t-vx}{\sqrt{1-v^2}}$$
Lorentz transformations preserve area in the $x,t$ plane (each little square becomes a parallelogram with the same area) and hence, given that $y$ coordinates are unchanged, preserve volume.  Co-linearity and co-planarity are also preserved by this linear transformation, and it is easy to check that points on the $t^2=x^2+y^2$ cone are mapped to points on the $T^2=X^2+Y^2$ cone (the light cone of Special Relativity").
Now, the transformation of the upright liquid cone of height $p$ maps the points on its surface $(-p,0,p)$ and $(p,0,p)$ to
$$\Big(\frac{-p-vp}{\sqrt{1-v^2}},0,\frac{p+vp}{\sqrt{1-v^2}}\Big) \mbox{ and } \Big(\frac{p-vp}{\sqrt{1-v^2}},0,\frac{p-vp}{\sqrt{1-v^2}}\Big)$$
These represent the coordinates of the high-point and low-point of the tipped liquid, in the framework of the glass. The product of the two $T$ values is simply $p^2$, independently of $v$. So if we choose $v$ so as to make the larger $T$ value $1$ (the liquid is tipped to the rim of a glass of height $1$), then the smaller $T$ is $p^2$.
Now for the argument that this solves the original problem. Consider an object that actually has the coordinates that the coordinates within the upright liquid cone get mapped to.  This object has one planar surface, which has a perimeter on the $T^2=X^2+Y^2$ cone, and so that surface is an ellipse, and it contains all lines connecting that base to the vertex (at the origin).  So we have an oblique, elliptical cone within the cone of the glass, its volume is that of the original liquid, it reaches the rim at $(1,0,1)$, and it reaches $t=p^2$ on the other side. This is our tipped liquid cone.
The upshot is that indeed tipping a martini glass does effect a Lorentz transformation, not by placing a new grid of coordinates over an invariant reality (space-time) but by generating a new reality that will be described by the transformed coordinates of the original.
Cones are cool.
