If you have to solve an equation of the form , you can divide the whole equation by . The new coefficients of and have the property that the sum of their squares is 1. This allows you to apply the Addition Formula for the , which says that .

Then you use the two equations and , to figure out what is.

So in your case this works as follows

Now you apply to both sides to get the general solution

Finally you have that and , in other words , which means, (we don't need the general solution for here).

Thus you have

Now, from these infinitely many solutions you need to pick those, that lie in the reqired intervall.