# Finding angle of irregular quadrilateral given all sides and one angle

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)$): $$\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{.}$$ This gives a discriminant $$\Delta = 4\left(1 - \left(\frac{D}{d}A+\frac{d^2-D^2}{2ld}\right)^2\right)\text{.}$$ 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?

• The two sides labeled $l$ are stipulated to be the same length? – BallBoy Jan 7 '18 at 14:55
• @Y. Forman Yes, they are – Safron Jan 7 '18 at 14:57

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.

• Beautiful! Much easier than my initial approach. Thank you. – Safron Jan 7 '18 at 18:39

You can solve the second equation for $\theta_1$. Then expand the third equation to

$$\cos (\alpha_1 + \theta_1) = \cos \alpha_2 \cos \theta_2 - \sin \alpha_2 \sin \theta_2.$$

Then plug in the first equation:

$$\cos (\alpha_1 + \theta_1) = \cos \alpha_2 \frac{d^2-D^2+2lD\cos(\alpha_2)}{2ld} - \sin \alpha_2 \sqrt{1 - \left( \frac{d^2-D^2+2lD\cos(\alpha_2)}{2ld} \right)^2}.$$

Rearrange to isolate the square root, then square to get a polynomial that you can solve for $\cos \alpha_2$.

• Firstly, I'm assuming you meant $\cos(\alpha_1 + \theta_1) = \cos(\alpha_2)\cos(\theta_2) - \sin(\alpha_2)\sin(\theta_2)$ ($\theta_2$ instead of $\theta_1$). Secondly, I'm assuming you used $\sin(\theta_2) = \sqrt{1-\cos^2(\theta_2)}$, but isn't the negative solution also possible? Thirdly, won't this yield more than two solutions? – Safron Jan 7 '18 at 15:24
• 1. Yes. 2. Yes, but when you rearrange and square it the minus sign will go away. 3. I'm not sure. If it does, you can probably rule some of them out for being geometrically impossible. – Paul Castle Jan 7 '18 at 16:23
• It looks like the $\cos^3 \alpha_2$ and $\cos^4 \alpha_2$ terms cancel out. – Paul Castle Jan 7 '18 at 16:27