Finding side length from two scalene triangles with common angle and side and ratio between sides. Trigonometry

There are three triangles. Two compose the largest one. I'll call the leftmost part $L,$ its counterpart on the right $R,$ and their composite $K.$

Looking at $R,$ we can write down an equation for our goal $x_2$ as follows: $$x_2^2=a_1^2+a_2^2-2a_1a_2\cos E.$$ Thus we only need find $a_1$ and $a_2,$ and we'd be done.

To find $a_1,$ look at $L,$ the we have that $$\frac{\sin B}{\text{Length}}=\frac{\sin A}{a_1}.$$ Similarly, by looking at $K,$ we find that $$\frac{\sin D}{\text{Length}}=\frac{\sin A}{a_2}.$$ This helps us to find $a_2.$

From the last two equations we eliminate $A$ to find an equation in $a_1,\,a_2.$

Now look at the triangle $R,$ from which we may write down $$\frac{\sin E}{x_2}=\frac{\sin D}{a_1}.$$

Together with the first equation, we find a $3×3$ system in $a_1,\,a_2\,x_2,$ which we can now solve for $x_2.$

OK, let's do this together. From the two middle equations we find that $$\sin A=\frac{a_1\sin B}{\text{Length}}=\frac{a_2\sin D}{\text{Length}},$$ so that $$a_1=\frac{\sin D}{\sin B}a_2.$$ From the last equation we also have $$a_1=\frac{\sin D}{\sin E}x_2,$$ so that we have that $$a_2=\frac{\sin D}{\sin E}\frac{\sin B}{\sin D}x_2=\frac{\sin B}{\sin D}x_2.$$

Substituting now into the first equation and solving for $x_2$ is straightforward, and gives $$x_2^2\left(\frac{\sin B+\sin D}{\sin E}+1\right)=\frac{2\sin B\sin D\cot E}{\sin E},$$ amd finally recall that $x_2>0.$


From the cosine and sine rules,

$$L^2 = x_1^2+ a_1^2 -2x_1a_1\cos B\tag{1}$$

$$a_1=\frac{\sin D}{\sin E}x_2\tag{2}$$

Plug the known ratio $r=\frac{x_1}{x_2}$ and (2) into (1),

$$L^2 = r^2x_2^2+ \frac{\sin^2 D}{\sin^2 E}x_2^2 -2r\cos B \frac{\sin D}{\sin E}x_2^2\tag{1}$$

Solve for $x_2$,

$$x_2= L \left(r^2+ \frac{\sin^2 D}{\sin^2 E} -2r\cos B \frac{\sin D}{\sin E}\right)^{-1/2}$$