solving a non-linear (trigonometric) system of equations with two equations and two variables I'm trying to solve the following system of equations:
$$l_1 \sin(\alpha) = l_2 \cos(\gamma) + l_3 \sin(\beta)$$
$$l_2 \sin(\gamma) + l_1 \cos(\alpha)=l_3 \cos(\beta) + l_4$$
with the unknowns $\beta, \gamma \in \Bbb R⁺$, the constants $l_1$, ..., $l_4$ $\in$ $\Bbb R⁺$ and the(known) variable $\alpha \in [0,\pi]$.
What I need is a function $\beta(\alpha)$. $\gamma$ is not of any importance to me.
I tried solving this system of equations with Maxima (software), but I don't get any results:
declare(l_1,real);
assume(l_1>=0);
declare(l_2,real);
assume(l_2>=0);
declare(l_3,real);
assume(l_3>=0);
declare(l_4,real);
assume(l_4>=0);
declare(A,real);
assume(A>=0, A<=%pi);
declare(B,real);
assume(B>=0);
declare(G,real);
assume(G>=0);

eq1: l_1*sin(A)=l_2*cos(G)+l_3*sin(B);
eq2: l_2*sin(G)+l_1*cos(A)=l_3*cos(B)+l_4;

solve([eq1, eq2], [B, G]);
[]

Does anybody know how to solve this, so that I end up with a function $\beta(\alpha)$?
Thanks for your help!
 A: Rearrange the two equations as follows:-
$$l_2\cos(\gamma)=l_1\sin(\alpha)-l_3\sin(\beta)$$
$$l_2\sin(\gamma)=l_3\cos(\beta)-l_1\cos(\alpha)+l_4$$
Square both sides and add the two equations to eliminate the $\gamma$ term (using the identity that $\sin^2\theta+\cos^2\theta=1$) :-
$$l_2^2(\cos^2(\gamma)+\sin^2(\gamma))=l_2^2\\=l_1^2+l_3^2-2l_1l_3(\cos(\alpha)\cos(\beta)+\sin(\alpha)\sin(\beta))+2l_3l_4\cos(\beta)-2l_1l_4\cos(\alpha)$$
To solve for $\beta$, let $u(\beta)=\cos(\beta)$, so that $\sqrt{1-u(\beta)^2}=\sin(\beta)$
Thus we have
$$u(\beta)(2l_3l_4-2l_1l_3\cos(\alpha))+l_1^2+l_3^2-l_2^2-2l_1l_4\cos(\alpha)=2l_1l_3\sin(\alpha)\sqrt{1-u(\beta)^2}$$
Let us denote the following
 $$f(\alpha)=2l_3l_4-2l_1l_3\cos(\alpha)$$
 $$g(\alpha)=l_1^2+l_3^2-l_2^2-2l_1l_4\cos(\alpha)$$
$$h(\alpha)=2l_1l_3\sin(\alpha)$$
We end up with a quadratic in $u(\beta)$
$$u(\beta)f(\alpha)+g(\alpha)=h(\alpha)\sqrt{1-u(\beta)^2}\\\Rightarrow u(\beta)^2(f(\alpha)^2+h(\alpha)^2)+u(\beta)(2f(\alpha)g(\alpha))+g(\alpha)^2-h(\alpha)^2=0\\\Rightarrow u(\beta)=\frac{-2f(\alpha)g(\alpha)\pm\sqrt{f(\alpha)^2g(\alpha)^2-(f(\alpha)^2+h(\alpha)^2)(g(\alpha)^2-h(\alpha)^2)}}{f(\alpha)^2+h(\alpha)^2}$$
Culminating in $\beta$ being
$$\beta=\arccos\left[\frac{-2f(\alpha)g(\alpha)\pm\sqrt{f(\alpha)^2g(\alpha)^2-(f(\alpha)^2+h(\alpha)^2)(g(\alpha)^2-h(\alpha)^2)}}{f(\alpha)^2+h(\alpha)^2}\right]$$
