I have to solve (for $\theta$) an equation of the form:

$$a\sin \theta + b\cos \theta + c\sin 2\theta + d\cos 2\theta = k$$

I'm only interested in real-valued solutions where $0 ≤ \theta ≤ \frac\pi4$, if one exists, and also knowing if none exist. Also, $a$, $b$, $c$, $d$, and $k$ are rational numbers.

Is there an "easy" way to attack this problem?

The only strategy I could come up with to express all sines and cosines as $\sin \theta$, and then square the equation to get rid of square roots, and then solve a quartic equation, and then check the legitimacy of the roots. Is there an easier approach, perhaps one that is more customized to this problem?

  • 2
    $\begingroup$ You can combine $a\sin\theta + b\cos\theta$ into a single function $m\sin(\theta+\phi)$, where $m=\sqrt{a^2+b^2}$ and $\phi=\text{atan2}(b,a)$. (See the Wikipedia article on trigonometric identities.) You can similarly combine the two terms with $2\theta$. $\endgroup$
    – Théophile
    Dec 30, 2015 at 4:23
  • 4
    $\begingroup$ You can distill this to a quartic very directly by expanding the double-angle terms and using the so-called Weierstrass substitutions: $$\sin\theta = \frac{2t}{1+t^2} \qquad \cos\theta = \frac{1-t^2}{1+t^2}$$ where $t=\tan(\theta/2)$. Clearing $(1+t^2)^2$ from the denominator, the quartic is $$ t^4 (b- d+k) -2t^3(a -2 c) + 2t^2(3 d + k) -2t(a +2 c )+ k - b - d= 0$$ (although you should probably double-check my algebra). Analyzing potential solutions remains difficult, however. $\endgroup$
    – Blue
    Dec 30, 2015 at 4:37
  • 1
    $\begingroup$ In fact, this is a general quartic in the sense that the coefficients in this quartic are linearly independent regarded as linear functions of $(a, b, c, d, k)$. $\endgroup$ Dec 30, 2015 at 5:16
  • $\begingroup$ i would consider some special cases eg $$b-d+k=0$$ and $$a=2c$$ or so $\endgroup$ Dec 30, 2015 at 5:28
  • 1
    $\begingroup$ Do you have particular $a,b,c,d,k$ in mind? Say $x=\sin\theta$, $y=\cos\theta$. Then we're looking for intersections of the unit circle and the conic $dx^2-2cxy-dy^2-ax-by+k=0$. Can you tell us what kind of conic this is or could it be several? $\endgroup$
    – Trold
    Dec 30, 2015 at 6:23

1 Answer 1


Set $x=\sin\theta$, $y=\cos\theta$ and get the conic

$$ax+by+2cxy+dx^2-dy^2=k,$$ which has solutions to your equation where it intersects the unit circle.

Since $(2c)^2-4d(-d)=4(c^2+d^2)>0$, we're looking at a hyperbola. (In fact, since the coefficients of $x^2$ and y^2$ are negatives of eachother, we're looking at a hyperbola whose asymptotes intercept at right angles.)

Everything is still kind of a mess though. If we rotate by $\frac{\arctan(-d/c)}{2}$ we should get a hyperbola that has its asymptotes running parallel to the new $u$- and $v$- coöridinate axes with equation $2c'uv+b'u+a'v=k$, which, after some more poking is

$$\left(u-\frac{-a'}{2c'}\right)\left(v-\frac{-b'}{2c'}\right)=\frac{2c'k+a'b'}{4c'^2}. $$ If the center of the hyperbola is very far away from the unit circle you can probably check for intersection just by checking if the asymptotes intersect and then looking nearby.

  • $\begingroup$ The step needed after rotation by $-\frac\pi4$ does not seem right. For a generaly conic section, the rotation needed to get rid of the $xy$ term is $\theta$ such that $cot \, 2\theta= \frac{A-C}{B}$ . $-\frac\pi4$ would have worked if $A$ were equal to $C$. Unfortunately, they are negatives of each other. I just want to confirm that I did not miss something. en.wikipedia.org/wiki/… $\endgroup$ Jan 1, 2016 at 17:26
  • $\begingroup$ You didn't miss anything, that's my error. I'll see if the rotation can still produce a usable hyperbola and edit the answer if so. $\endgroup$
    – Trold
    Jan 1, 2016 at 17:56
  • 1
    $\begingroup$ Updated the answer to not be wrong. Rather than get rid of the $xy$ term I picked the angle so that $d'=d\cos2\psi+c\sin2\psi$ was zero and you're dealing with what, in the new coordinates, is essentially a translation of $v=k/u$. $\endgroup$
    – Trold
    Jan 3, 2016 at 18:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .