Refer to fig.

let side of square be x

--------eq1

and

-----------eq2

and

---------------eq3

Now we have to solve for

The equations looks complex, but easy to solve.

remember we have to find not x. This makes the things easy.

solve for y and z from eq1 and eq2 and replace them in eq3. then assume as t.

Solve for t.

Let me know iof you have an issue in solving it.