<s>[INST] Side of a square attached to two triangles Solve for $l$

I tried to solve this for $l$ with trigonometry, but I stopped at $l^2+4-2l\cdot \cos(x)=16, l^2 + 4 +2l\cdot \sin(x)=25$, where $x$ is the angle of the left triangle between 4 and $l$.
So I've tried with Heron's, and got stuck with some square roots...
According to WolframAlpha, the answer must be something around 3.71374
Any ideas?
------SOLVED----------
Okay, so, thanks to Narasimham I've seen that I took cosine formula wrong, and thanks to cosmo5 I've been able to solve it, here's the solution:
Start with cosine formula
\begin{matrix}
5^2 & = & l^2+4-2\cdot2\cdot l\cdot \cos(270^\circ - \alpha))\\ 
4^2 & = & l^2+4-2\cdot2\cdot l \cdot \cos(\alpha)
\end{matrix}
Rearrange teh two equation
\begin{matrix}
441-42l^2+l^4 & = &16l^2\cdot\sin^2(\alpha))\\ 
144-24l^2+l^4 & = &16l^2 \cdot \cos^2(\alpha)
\end{matrix}
find this quadratic formula
\begin{matrix}
585-66l^2+2l^4=16l^2
\end{matrix}
and then found this solutions
\begin{matrix}
+\sqrt{\dfrac{41+\sqrt{511}}{2}}\\ 
+\sqrt{\dfrac{41-\sqrt{511}}{2}}\\
-\sqrt{\dfrac{41+\sqrt{511}}{2}}\\
-\sqrt{\dfrac{41-\sqrt{511}}{2}}
\end{matrix}
Then, discart the negative ones
\begin{matrix}
\sqrt{\dfrac{41+\sqrt{511}}{2}}\\ 
\sqrt{\dfrac{41-\sqrt{511}}{2}}
\end{matrix}
 [/INST] Rearrange the two equations as
$$l^2-12=2l\cos x \quad , \quad l^2-21=-2l\sin x$$
On squaring both and adding, $x$ is eliminated,
$$(l^2-12)^2+(l^2-21)^2=(2l)^2$$
$$\Rightarrow 2(l^2)^2-70l^2+585=0$$
and a quadratic in $l^2$ is obtained. Its value can be computed using the quadratic formula.
To compute $l$, remember to take the square root of $l^2$. WA confirms $l=3.71374$.
</s>