Let's say you have a quadrilateral ABCD, AB = a, BC = b, CD = c, DA = d, and you have an angle B.
Here's my way to tackle the problem. Using cosine law, we have
[tex]a ^ 2 + b ^ 2 - 2ab \cos B = c ^ 2 + d ^ 2 - 2cd \cos D[/tex]
[tex]\Leftrightarrow \cos D = \frac{c ^ 2 + d ^ 2 - a ^ 2 - b ^ 2 + 2ab \cos B}{2cd}[/tex]
[tex]\Leftrightarrow D = \arccos \left( \frac{c ^ 2 + d ^ 2 - a ^ 2 - b ^ 2 + 2ab \cos B}{2cd} \right)[/tex]
Now you have angle B, and D. So
A + C = 3600 - (B + D).
Let [itex]\alpha = A + C[/itex].
Again, use the cosine law, we have:
[tex]b ^ 2 + c ^ 2 - 2bc \cos C = a ^ 2 + d ^ 2 - 2ad \cos A[/tex]
[tex]\Leftrightarrow b ^ 2 + c ^ 2 - 2bc \cos C = a ^ 2 + d ^ 2 - 2ad \cos (\alpha - C)[/tex]
[tex]\Leftrightarrow b ^ 2 + c ^ 2 - 2bc \cos C = a ^ 2 + d ^ 2 - 2ad (\cos \alpha \cos C + \sin \alpha \sin C)[/tex]
[tex]\Leftrightarrow a ^ 2 + d ^ 2 - b ^ 2 - c ^ 2 - 2ad (\cos \alpha \cos C + \sin \alpha \sin C) + 2bc \cos C = 0[/tex]
[tex]\Leftrightarrow a ^ 2 + d ^ 2 - b ^ 2 - c ^ 2 - 2ad \sin \alpha \sin C + 2bc \cos C - 2ad \cos \alpha \cos C = 0[/tex]
[tex]\Leftrightarrow a ^ 2 + d ^ 2 - b ^ 2 - c ^ 2 - 2ad \sin \alpha \sin C + (2bc - 2ad \cos \alpha) \cos C = 0[/tex]
[tex]\Leftrightarrow (2bc - 2ad \cos \alpha) \cos C - 2ad \sin \alpha \sin C = b ^ 2 + c ^ 2 - a ^ 2 - d ^ 2[/tex]
This equation has the form a sin x + b cos x = c, which can be solved by dividing both sides by [itex]\sqrt{a ^ 2 + b ^ 2}[/itex]
Can you go from here?
My way is a real mess... Someone may come up with something else simplier.