Given the lengths of all sides of a (non-intersecting) quadrilateral and one angle $\alpha_1$, I need to find the two possible solutions of the angle next to the given angle $\alpha_1$, named $\alpha_2$ as illustrated here.
Strangely enough, I couldn't find an answer myself nor on the internet. Here is what I've tried so far:
Call the length of the diagonal from $\alpha_1$ to $\theta_1$ $p$ and the length of the diagonal from $\alpha_2$ to $\theta_2$ $q$. I tried using both the cosine rule and the generalization of Ptolemy's theorem found on wikipedia to find an expression: \begin{align} p^2 &= l^2 + d^2 -2ld\cos(\theta_2) = l^2 + D^2 -2lD\cos(\alpha_2) \\ q^2 &= l^2 + d^2 -2ld\cos(\theta_1) = l^2 + D^2 -2lD\cos(\alpha_1) \\ p^2q^2 &= l^4 + d^2D^2 - l^2dD\cos(\alpha_1 + \theta_1) = l^4 + d^2D^2 - l^2dD\cos(\alpha_2 + \theta_2)\text{.} \end{align} I manipulated these equations into the following form: \begin{align} \cos(\theta_2) &= \frac{d^2-D^2+2lD\cos(\alpha_2)}{2ld} \\ \cos(\theta_1) &= \frac{d^2-D^2+2lD\cos(\alpha_1)}{2ld} \\ \cos(\alpha_2 + \theta_2) &= \cos(\alpha_1 + \theta_1)\text{.} \end{align} Trying to go further, it seems I'm not able to find an analytical solution. For example the third equation implies that either $\alpha_2 + \theta_2 = \alpha_1 + \theta_1 + 2\pi k$ or $\alpha_2 + \theta_2 = -\alpha_1 - \theta_1 + 2\pi k$ for some $k \in \mathbb{Z}$, but because $\theta_2$ is some non-linear function of $\alpha_2$, I get stuck there.
Does an analytical solution exist? If yes, then how can I find one?
Edit: thanks to Paul Castle I was able to get an expression for $\cos{\alpha_2}$ (with $A = \cos(\alpha_1+\theta_1)$): \begin{equation} \left(\frac{D^2}{d^2}+1\right)\cos^2{\alpha_2} + \left(\frac{D(d^2-D^2)}{ld^2}-2A\right)\cos \alpha_2+A^2 + \frac{(d^2-D^2)^2}{4l^2d^2}-1 = 0\text{.} \end{equation} This gives a discriminant \begin{equation} \Delta = 4\left(1 - \left(\frac{D}{d}A+\frac{d^2-D^2}{2ld}\right)^2\right)\text{.} \end{equation} Now I'm not sure how to continue. Can I safely assume $\Delta$ may not be less than zero, because this won't yield any solutions? Can I assume something simular for the other cases to make my life easier?
From the cosine rule we can compute $q$: $$ q^2 = l^2 + D^2 -2lD\cos\alpha_1. $$
Let then $\phi$ be the angle formed by diagonal $q$ and side $D$ and $\phi'$ be the angle formed by diagonal $q$ and right side $l$ (so that you have either $\alpha_2=\phi+\phi'$ or $\alpha_2=\phi-\phi'$). Using again the cosine rule we can find $\phi$ and $\phi'$: $$ \cos\phi={q^2+D^2-l^2\over 2Dq}, \quad \cos\phi'={q^2+l^2-d^2\over 2lq}. $$ You then have the solution $\alpha_2=\phi+\phi'$ and, if $\phi'<\phi$, a second solution $\alpha_2=\phi-\phi'$. If instead $\phi'>\phi$ the corresponding quadrilateral is self-intersecting.