So this is a question someone else asked me, and I haven't had a chance to figure out if it might be an X/Y problem, but for now let's assume not.
We have a (rectangular crossection) cup of height $v$ and width $s$. We also have a stick of square crossection (sidelength $t$) and length larger than $\sqrt{v^2+s^2}$ (i.e. it will rest against the side of the cup protruding out). Now we place the stick in the cup in such a way that it rests against the bottom ($B$) and far side ($E$) on the bottom, and against the near side lip ($C$) on the top.
This gives us a cross-section looking like the following diagram.
Where $|AC|=v$, $|AD|=s$ and $|BE|=t$. In this diagram we also have $|\angle BDE|=|\angle CAD|=|\angle CBE|=\pi/2$. We want to figure out $x=|BD|$.
It is not hard to notice that the triangles $CAB$ and $BDE$ are similar. It is also not hard to get $v=\tan(\alpha)s-\sin(\alpha)\tan(\alpha)t$ where $\alpha$ is $\angle ABC$. This comes from $x=\sin(\alpha)t$.
The problem starts when you try to solve for $\alpha$. Or at least it did for me. Writing everything in terms of cosines and subbing in $u$ for $\cos(\alpha)$ we get after some solving $$t^2u^4-2vtu^3+(2t^2+v^2+s^2)u^2-2vtu+t^2-s^2=0$$. We can divide out by $t^2$ and let $v/t=p$ and $s/t=q$ which leaves us with $$u^4-2pu^3+(2+p^2+q^2)u^2-2pu+1-q^2=0$$ but that's as good I can get it, and from all I've tried this is a good and proper quartic without any tricky solutions. Of course solutions can be found, but let's just say they are unappealing (3 pages a4 is not gonna be much use).
Can anyone see some trick to solving this? It seems so eminently reasonable, yet a nice solution eludes me.
Edit: I'm at the point that I've started to try and get an approximate answer, but I haven't managed to get any reasonable error bars so far. So while tricky straight forward stuff is preferred a good error barred approximation would be great too. Fixed congruent to similar after catch by heropup. Forgot congruent meant same size too.

Trigonometry is unnecessary; also, $\triangle CAB$ and $\triangle BDE$ are not in general congruent, but similar.
The basic relationship is that $AC/AB = DB/DE$, and since $DB^2 + DE^2 = BE^2$ by the Pythagorean theorem, we simply have $$\frac{v}{s-x} = \frac{x}{\sqrt{t^2-x^2}}.$$ This yields the quartic in $x$ $$x^4 - 2sx^3 + (s^2+v^2)x^2 - t^2 v^2 = 0. \tag{1}$$ There is a solution by radicals but it is quite lengthy.
A numerical solution is tractable: we would set up a recursion via Newton's method
$$x_{n+1} = x_n - \frac{f(x_n)}{f'(x_n)}, \tag{2}$$ where $f$ is the aforementioned quartic and $$f'(x) = 4x^3 - 6sx^2 + 2(s^2 + v^2)x$$ is its derivative. Explicitly, this gives us
$$x_{n+1} = \frac{x_n^2 \left(s^2-4 s x_n+v^2+3 x_n^2\right)+t^2 v^2}{2 x_n \left(s^2-3 s x_n+v^2+2 x_n^2\right)}. \tag{3}$$ All that remains is to use a suitable initial guess $x_0$. In this case, given the geometry, we must have $0 < x < t$, so a reasonable and simple first guess might be $x_0 = t/2$. Then we compute successive iterations of $(3)$ until we attain convergence.
For example, if $v = 2, s = 1, t = 1/4$, we compute with the initial guess $x_0 = 1/8$ the iterates
$$\begin{array}{c|c} n & x_n \\ \hline 0 & 0.125 \\ 1 & 0.275797 \\ 2 & 0.23633 \\ 3 & 0.233456 \\ 4 & 0.233441 \\ 5 & 0.233441 \\ \end{array}$$ and stop when the next iteration equals the previous to the desired precision. Using a computer algebra program to explicitly solve the quartic $$x^4 - 2x^3 + 5x^2 - 1/4 = 0,$$ we obtain the unique positive root $x \approx 0.23344071820033491995$. Note that not all possible inputs of $v, s, t$ will yield a meaningful solution: for instance, $t > s$ is not permitted by the geometry of the problem.