Trigonometric Equations: How to Solve sin x = c and Harder Ones
Geometry Algebra Computing Python JavaScript
Quick answer
To solve a trigonometric equation, reduce it to basic equations such as \sin u=c, solve each with its two families of angles plus whole turns, and keep the solutions inside the interval asked for. A multiple angle, as in \sin2x=\frac12, gives more solutions per turn, not fewer. Solve an equation quadratic in \sin x as a quadratic first and discard roots beyond ±1. Factor instead of dividing by a function that can be zero, and after squaring check every answer in the original equation.
Key takeaways
- A trigonometric equation has infinitely many solutions unless an interval is given, because the functions repeat: \sin x=\frac12 is solved by 30^\circ+360^\circ n and 150^\circ+360^\circ n for every whole number n, and the interval decides which values of n are used.
- For \sin(kx+b)=c, solve for the angle u=kx+b over an interval k times as long, then subtract b and divide by k. That is why \sin2x=\frac12 has four solutions in [0^\circ,360^\circ): in one turn there are 2k of them.
- An equation quadratic in \sin x, \cos x or \tan x is solved by substituting u, solving for u and then solving the basic equations. For sine and cosine a root outside -1\le u\le1 gives no angle: \cos^2x=4 has two roots u and no solution x.
- Never divide by a function that can be zero. In \sin2x=\cos x, dividing by \cos x loses 90^\circ and 270^\circ; moving everything to one side and factoring, \cos x (2\sin x-1)=0, finds all four solutions.
- Squaring, or multiplying by an expression that can be zero, can add false roots. Squaring \sin x+\cos x=1 gives four candidates (0^\circ, 90^\circ, 180^\circ, 270^\circ) and only two of them satisfy the original equation, so every candidate is checked.
- When x itself is mixed with a trigonometric function, as in \cos x=x, no formula gives the answer. Graph it, bracket a sign change, and use bisection (one more binary digit per step) or Newton's method (roughly twice as many correct digits per step), with x in radians.
What is a trigonometric equation, and why does it have infinitely many solutions?
A trigonometric equation is an equation in which the unknown is the angle inside one or more trigonometric functions, such as \sin x=\frac12 or 2\cos^2x=\cos x; because the functions repeat, a solution is never alone. If x solves \sin x=\frac12 then so does x+360^\circ, and so does x-360^\circ, since a full turn brings the point on the unit circle back to the same place. Sine and cosine repeat every 360^\circ (that is 2π radians), and tangent every 180^\circ (π radians). So the answer to an equation is either a family with a whole number n in it, or a list of the solutions inside an interval that the question names.
This is what separates an equation from an identity (see the article on identities): an identity is true for every angle, while an equation is true for some, and solving it means finding them all. The basic cases, \sin x=c, \cos x=c and \tan x=c, are in the article on basic trigonometry. Here is what comes after them: how to list solutions in an interval, equations with multiple angles, quadratic ones, ones that need an identity, why some steps lose solutions or add false ones, and what to do when no formula exists.
Angles are in degrees below, as they are in the other trigonometry articles, except in the last sections, where an equation mixes the unknown with a plain number and radians are the only choice. To use radians elsewhere, replace 360^\circ by 2π and 180^\circ by π.
How do you pick the solutions that lie in a given interval?
To list the solutions in an interval, write the general solution with a whole number n, put it into the inequality that describes the interval, and keep the whole numbers n that fit. The interval then chooses the members of each family, and nothing is guessed.
For \sin x=\frac12 with -180^\circ\le x<540^\circ the two families are 30^\circ+360^\circ n and 150^\circ+360^\circ n:
| n | 30^\circ+360^\circ n | in the interval? | 150^\circ+360^\circ n | in the interval? |
|---|---|---|---|---|
| -1 | -330^\circ | no | -210^\circ | no |
| 0 | 30^\circ | yes | 150^\circ | yes |
| 1 | 390^\circ | yes | 510^\circ | yes |
| 2 | 750^\circ | no | 870^\circ | no |
So x=30^\circ, 150^\circ, 390^\circ, 510^\circ. For \tan x=√3 with -360^\circ\le x\le360^\circ there is only one family, 60^\circ+180^\circ n, and -360\le60+180n\le360 means -2.33\le n\le1.67, so n=-2,-1,0,1 and x=-300^\circ, -120^\circ, 60^\circ, 240^\circ.
You can also predict how many there will be. An interval that is L degrees long holds (L)/(360) turns, and for |c|<1 each turn contains two solutions of \sin x=c and two of \cos x=c, while each 180^\circ contains one solution of \tan x=c. At the ends of the range, c=±1 for sine and cosine, the two families coincide and there is only one solution per turn: the wave touches the line instead of crossing it. In radians the same interval 0\le x<2π has \sin x=\frac12 solved by (π)/(6) and (5π)/(6).
How do you solve an equation like sin 2x = 1/2, where the angle is a multiple of x?
To solve \sin(kx+b)=c with k>0, solve the basic equation for the whole angle u=kx+b over an interval that is k times as long, then subtract b and divide by k. The step that people skip is the first one: when x runs from 0^\circ to 360^\circ, the angle u=2x runs from 0^\circ to 720^\circ, two full turns, so there are twice as many solutions.
Example. \sin2x=\frac12 for 0^\circ\le x<360^\circ. Put u=2x, so 0^\circ\le u<720^\circ. Then \sin u=\frac12 gives u=30^\circ, 150^\circ, 390^\circ, 510^\circ and, halving, x=15^\circ, 75^\circ, 195^\circ, 255^\circ. Four solutions, not two. Solving only 2x=30^\circ and 2x=150^\circ would find the first two and miss the second turn.
With a shift. \cos(3x-30^\circ)=\frac12 for 0^\circ\le x<360^\circ. Put u=3x-30^\circ, so -30^\circ\le u<1050^\circ. Then \cos u=\frac12 gives u=60^\circ, 300^\circ, 420^\circ, 660^\circ, 780^\circ, 1020^\circ (the value -60^\circ is below the range), and x=(u+30^\circ)/(3)=30^\circ, 110^\circ, 150^\circ, 230^\circ, 270^\circ, 350^\circ. The count follows a rule: in one turn there are 2k solutions (k of them when c=±1 for sine and cosine), and they repeat every (360^\circ)/(k), or (180^\circ)/(k) for tangent. If k is negative, use \sin(-u)=-\sin u and \cos(-u)=\cos u to make it positive first.
Try other values of k, b and c below, and read off the general solution.
Interactive: solve sin(kx + b) = c, cos(kx + b) = c and tan(kx + b) = c
Choose a function, the multiple k, the shift b, the level c and an interval, and see every solution as a crossing of a graph and a line, with the general solution and the count per turn.
How do you solve an equation that is quadratic in sin x, cos x or tan x?
An equation that is quadratic in one trigonometric function is solved by writing u for that function, solving the quadratic in u, and then solving a basic equation for each root, keeping a root only if some angle can reach it. For sine and cosine the roots must lie between -1 and 1; for tangent every root is allowed.
- Replace the function by u: 2\sin^2x-\sin x-1=0 becomes 2u^2-u-1=0.
- Solve for u by factoring or the quadratic formula: (2u+1)(u-1)=0, so u=-\frac12 or u=1.
- Discard any root with |u|>1 when u is a sine or a cosine.
- For each root left, solve \sin x=u: \sin x=-\frac12 gives 210^\circ and 330^\circ, and \sin x=1 gives 90^\circ.
- List all the angles: x=90^\circ, 210^\circ, 330^\circ.
Notice that there are three solutions and not four. The root u=1 is the highest value the sine reaches, so it is reached once per turn, as in the picture: the curve touches the axis there.
When a root is outside the range. \sin^2x-\sin x-2=0 factors as (\sin x-2)(\sin x+1)=0. The root \sin x=2 is impossible, because no angle has a sine above 1, and \sin x=-1 gives x=270^\circ. So the single solution is 270^\circ. In the same way \cos^2x=4 has the roots \cos x=2 and \cos x=-2 and no solution at all. With tangent there is no such limit: \tan^2x=3 gives \tan x=±√3 and x=60^\circ, 120^\circ, 240^\circ, 300^\circ.
Set the coefficients below to see the roots u, which of them an angle can reach, and the graph of the left side.
Interactive: an equation that is quadratic in sin x, cos x or tan x
Set a, b and c in a·u² + b·u + c = 0 with u = sin x, cos x or tan x, and see the roots u, which of them an angle can reach, and the angles between 0° and 360°.
Why should you never divide both sides by sin x or cos x?
Dividing both sides by \sin x or \cos x is only valid at the angles where that function is not zero, and the angles where it is zero may be solutions, which the division silently throws away. The safe move is the one from algebra: bring everything to one side and factor.
Take \sin2x=\cos x on 0^\circ\le x<360^\circ.
| Dividing | Factoring |
|---|---|
| 2\sin x\cos x=\cos x | 2\sin x\cos x-\cos x=0 |
| divide by \cos x: 2\sin x=1 | \cos x (2\sin x-1)=0 |
| x=30^\circ, 150^\circ | \cos x=0 gives 90^\circ, 270^\circ; \sin x=\frac12 gives 30^\circ, 150^\circ |
| 2 solutions, two lost | 4 solutions |
The lost angles, 90^\circ and 270^\circ, are exactly the ones where \cos x=0, the thing that was divided by. The same happens with \tan x=2\sin x: writing \tan x=(\sin x)/(\cos x) and then cancelling \sin x loses 0^\circ and 180^\circ, while \sin x (1-2\cos x)=0 after multiplying by \cos x finds \sin x=0 and \cos x=\frac12 and so 0^\circ, 60^\circ, 180^\circ, 300^\circ. If you do want to divide, first solve the case where the divisor is zero on its own, then divide and solve the rest.
Which identity should you use to turn a hard equation into an easy one?
Use the identity that leaves a single trigonometric function of a single angle, because that is the form you already know how to solve. What you see in the equation tells you which one.
| What the equation has | The identity | Example |
|---|---|---|
| the same function of x and 2x | \sin2x=2\sin x\cos x | \sin2x=\cos x |
| \cos2x together with \cos x | \cos2x=2\cos^2x-1 | \cos2x=\cos x |
| squares of sine and cosine together | \cos^2x=1-\sin^2x | 2\cos^2x+3\sin x=3 |
| a difference of two sines or cosines | sum-to-product | \sin3x=\sin x |
| a product \sin x\cos x | \sin x\cos x=\frac12\sin2x | \sin x\cos x=\frac14 |
| a tangent beside a sine | \tan x=(\sin x)/(\cos x), then factor | \tan x=2\sin x |
| a\sin x+b\cos x | one wave R\sin(x+φ) | 3\sin x+4\cos x=2.5 |
The formulas themselves are derived in the article on the double-angle formulas. A worked example: \sin3x=\sin x. Move everything to one side, \sin3x-\sin x=0, and use the sum-to-product formula, \sin3x-\sin x=2\cos2x \sin x. A product is zero when a factor is, so \sin x=0, giving 0^\circ, 180^\circ, or \cos2x=0, giving 2x=90^\circ+180^\circ n and x=45^\circ, 135^\circ, 225^\circ, 315^\circ. Six solutions. Another route, with the triple-angle formula, reaches the same six but with more algebra, which is why the choice of identity matters.
Below are eleven equations solved one line at a time, each line with the reason for it. Their graphs show both sides and where they meet.
Interactive: eleven equations solved line by line
Eleven trigonometric equations, each solved one line at a time with the reason for every step and a graph of both sides, including the one where squaring adds roots that are not solutions.
How do you solve a sin x + b cos x = c?
To solve a\sin x+b\cos x=c, write the left side as one wave R\sin(x+φ) with R=√(a^2+b^2) and φ=\operatornameatan2(b,a); the equation becomes \sin(x+φ)=c/R, a basic one. This works exactly when |c|\le R, because R is the highest value the wave reaches. The conversion is derived in the article on product-to-sum formulas and the single wave.
Example. √3\sin x+\cos x=1. Here R=√(3+1)=2 and φ=\operatornameatan2(1,√3)=30^\circ, so 2\sin(x+30^\circ)=1, that is \sin(x+30^\circ)=\frac12. Then x+30^\circ=30^\circ or 150^\circ (plus 360^\circ n), so x=0^\circ or x=120^\circ. Check the second: √3\sin120^\circ+\cos120^\circ=\frac32-\frac12=1. With less friendly numbers the steps are the same: 3\sin x+4\cos x=2.5 has R=5, φ≈53.13^\circ and the solutions 96.87^\circ and 336.87^\circ. If c is bigger than R there is no solution: 3\sin x+4\cos x=6 is impossible, since the left side never exceeds 5.
There are two other ways. Squaring (isolate one term, square, use \sin^2x+\cos^2x=1) always works but adds false roots, covered next. The half-angle substitution t=\tanx/2 turns \sin x into (2t)/(1+t^2) and \cos x into (1-t^2)/(1+t^2) and the equation into a quadratic in t; it loses x=180^\circ, where \tanx/2 does not exist, so that angle has to be tried separately. The single wave needs neither check, which is why it is the first choice.
Why do some answers fail when you check them, and how do you avoid false roots?
A false (extraneous) root is an answer that the steps produce but that does not satisfy the original equation; it appears whenever a step is not reversible, such as squaring, and the cure is to check every candidate in the original equation. Squaring turns A=B into A^2=B^2, which is also true when A=-B. Multiplying by an expression that can be zero has the same effect.
Example. Solve \sin x+\cos x=1 on 0^\circ\le x<360^\circ. Squaring gives \sin^2x+2\sin x\cos x+\cos^2x=1, which is 1+\sin2x=1, so \sin2x=0 and 2x=0^\circ, 180^\circ, 360^\circ, 540^\circ, that is x=0^\circ, 90^\circ, 180^\circ, 270^\circ. Now check each in the original: at 0^\circ the sum is 0+1=1 (true), at 90^\circ it is 1+0=1 (true), at 180^\circ it is 0-1=-1 (false) and at 270^\circ it is -1+0=-1 (false). The solutions are 0^\circ and 90^\circ; the other two solve \sin x+\cos x=-1, the equation that squaring also contains. Doing it with the single wave, √2\sin(x+45^\circ)=1, gives x+45^\circ=45^\circ or 135^\circ and the same two answers with nothing to check.
Undefined angles are false roots too. \tan x\cos x=1 simplifies to \sin x=1, which suggests x=90^\circ. But \tan90^\circ does not exist, so 90^\circ is not a solution, and the equation has none at all. The same care applies to anything with \tan, \sec, \csc, \cot, a denominator or a square root: list the angles the original equation forbids before you start, and cross them off at the end.
| The step | What can happen | What to do |
|---|---|---|
| square both sides | adds roots (the case A=-B) | check each candidate |
| multiply by an expression with x | adds roots where it is zero | check each candidate |
| divide by an expression with x | loses roots where it is zero | solve that case separately |
| a function that is undefined somewhere | the angle is not allowed | cross it off |
Finally, an equation with no real solution may still have complex ones: \sin x=2 has none among real angles, but with Euler's formula one finds x=(π)/(2)± i\ln(2+√3), where \ln(2+√3)≈1.317.
What if no formula works? Solving cos x = x with graphs, bisection and Newton's method
When the unknown appears both as a plain number and inside a trigonometric function, as in \cos x=x, no algebra gives the answer, so you graph the equation, trap a root between two points where the sign changes, and close in with bisection or Newton's method. Now x is a number, not an angle in degrees, and it has to be in radians: \cos x=x has a root at 0.7391, and a calculator in degree mode would answer a different question.
- Graph it. Draw y=\cos x and y=x, or f(x)=\cos x-x and look where it crosses zero. This shows how many roots there are (one here, because \cos x falls while x rises) and roughly where.
- Bracket it. Find a<b with f(a) and f(b) of opposite signs: f(0)=1>0 and f(1)=-0.46<0. A continuous function that changes sign must be zero somewhere in between.
- Bisection. Look at the midpoint and keep the half in which the sign still changes. The interval halves every step, so the error after n steps is at most (b-a)/(2^n): one more binary digit, about 0.3 of a decimal digit, per step. Forty steps give twelve decimals. It is slow but cannot fail.
- Newton's method. From a guess x, follow the tangent line to the axis: x_n+1=x_n-(f(x_n))/(f'(x_n)), here with f'(x)=-\sin x-1. Near a root it roughly doubles the number of correct digits each step (see the article on Newton's method) but it needs a good start and can fail (see where it goes wrong).
The table shows both on \cos x=x, bisection on [0,1] and Newton from x_0=1; the root is 0.7390851332.
| Step | Bisection: midpoint | Newton's method: x |
|---|---|---|
| 1 | 0.5000000000 | 0.7503638678 |
| 2 | 0.7500000000 | 0.7391128909 |
| 3 | 0.6250000000 | 0.7390851334 |
| 4 | 0.6875000000 | 0.7390851332 |
| 5 | 0.7187500000 | 0.7390851332 |
| 6 | 0.7343750000 | 0.7390851332 |
Pressing the cosine key again and again on a calculator in radian mode does converge to the same number, because x_n+1=\cos x_n shrinks the distance to the root by a factor of about \sin0.739≈0.67 each time, which is slow compared with Newton. Pick another equation below, or step through each method.
Interactive: solve cos x = x by bisection and by Newton's method
Watch bisection halve an interval and Newton's method follow tangent lines to the root of five equations that no formula can solve, and see how many decimals each step gains.
How do you solve trigonometric equations in a program?
A program solves \sin(kx+b)=c by the same steps as on paper: take the principal angle with asin, add its mirror image, step through the whole numbers n and keep the x that fall in the interval. Three details matter. asin and acos return only one angle (asin between -90^\circ and 90^\circ), so the second family is yours to add. Roots that coincide, as at c=1, must not be listed twice, and floating-point errors such as 89.99999999 make equality tests unreliable, so round before comparing. And a value beyond ±1 makes asin fail, so test for it first.
The programs below solve four equations from this article, \sin x=\frac12, \sin2x=\frac12, \sin x=2 (no solution) and 2\sin^2x-\sin x-1=0 through its roots u=-\frac12 and u=1, and then solve \cos x=x by bisection on [0,1] until the interval is shorter than 10^-12, which takes 40 steps and gives 0.7390851332.
import math
def solve(fn, k, b, c, lo=0.0, hi=360.0):
"""Every x in [lo, hi) with fn(k*x + b) = c, in degrees (k > 0), for fn = 'sin' or 'cos'."""
if abs(c) > 1:
return [] # no angle has a sine or cosine beyond 1
alpha = math.degrees(math.asin(c) if fn == 'sin' else math.acos(c))
mirrors = [alpha, 180 - alpha] if fn == 'sin' else [alpha, -alpha]
found = set()
for u0 in mirrors: # k*x + b = u0 + 360 n
n = math.floor((k * lo + b - u0) / 360) - 1 # start a turn early, filter below
while True:
x = (u0 + 360 * n - b) / k
if x >= hi:
break
if x >= lo:
found.add(round(x, 9))
n += 1
return sorted(found)
print(solve('sin', 1, 0, 0.5)) # [30.0, 150.0]
print(solve('sin', 2, 0, 0.5)) # [15.0, 75.0, 195.0, 255.0]
print(solve('cos', 3, 0, 0.5, 0, 120)) # [20.0, 100.0]
print(solve('sin', 1, 0, 2)) # []
# 2 sin^2 x - sin x - 1 = 0: a quadratic in u = sin x
a, b, c = 2, -1, -1
d = b * b - 4 * a * c
for u in [(-b - math.sqrt(d)) / (2 * a), (-b + math.sqrt(d)) / (2 * a)]:
print(u, solve('sin', 1, 0, u)) # -0.5 [210.0, 330.0], then 1.0 [90.0]
def bisect(f, lo, hi, tol=1e-12):
"""Halve [lo, hi] until it is shorter than tol; f(lo) and f(hi) must have opposite signs."""
steps = 0
while hi - lo > tol:
mid = (lo + hi) / 2
if f(lo) * f(mid) <= 0:
hi = mid
else:
lo = mid
steps += 1
return (lo + hi) / 2, steps
root, steps = bisect(lambda x: math.cos(x) - x, 0, 1)
print(round(root, 10), steps) # 0.7390851332 40
x = 1.0 # Newton: x - f(x)/f'(x) with f = cos x - x
for _ in range(4):
x -= (math.cos(x) - x) / (-math.sin(x) - 1)
print(round(x, 10)) # 0.7390851332function solve(fn, k, b, c, lo = 0, hi = 360) {
// every x in [lo, hi) with fn(k*x + b) = c, in degrees (k > 0), for fn = 'sin' or 'cos'
if (Math.abs(c) > 1) return [] // no angle has a sine or cosine beyond 1
const alpha = ((fn === 'sin' ? Math.asin(c) : Math.acos(c)) * 180) / Math.PI
const mirrors = fn === 'sin' ? [alpha, 180 - alpha] : [alpha, -alpha]
const found = new Set()
for (const u0 of mirrors) { // k*x + b = u0 + 360 n
for (let n = Math.floor((k * lo + b - u0) / 360) - 1; ; n++) { // start a turn early, filter below
const x = (u0 + 360 * n - b) / k
if (x >= hi) break
if (x >= lo) found.add(Math.round(x * 1e9) / 1e9)
}
}
return [...found].sort((p, q) => p - q)
}
solve('sin', 1, 0, 0.5) // [30, 150]
solve('sin', 2, 0, 0.5) // [15, 75, 195, 255]
solve('cos', 3, 0, 0.5, 0, 120) // [20, 100]
solve('sin', 1, 0, 2) // []
// 2 sin^2 x - sin x - 1 = 0: a quadratic in u = sin x
const [a, b, c] = [2, -1, -1]
const d = b * b - 4 * a * c
;[(-b - Math.sqrt(d)) / (2 * a), (-b + Math.sqrt(d)) / (2 * a)].map((u) => [u, solve('sin', 1, 0, u)])
// [[-0.5, [210, 330]], [1, [90]]]
function bisect(f, lo, hi, tol = 1e-12) {
// halve [lo, hi] until it is shorter than tol; f(lo) and f(hi) must have opposite signs
let steps = 0
while (hi - lo > tol) {
const mid = (lo + hi) / 2
if (f(lo) * f(mid) <= 0) hi = mid
else lo = mid
steps++
}
return [(lo + hi) / 2, steps]
}
const [root, steps] = bisect((x) => Math.cos(x) - x, 0, 1)
;[+root.toFixed(10), steps] // [0.7390851332, 40]
let x = 1 // Newton: x - f(x)/f'(x) with f = cos x - x
for (let i = 0; i < 4; i++) x -= (Math.cos(x) - x) / (-Math.sin(x) - 1)
+x.toFixed(10) // 0.7390851332#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
const double PI = 3.14159265358979323846;
double found[64]; // the solutions of the last call
// Every x in [lo, hi) with sin(k x + b) = c (degrees, k > 0), sorted, in found[]; returns how many.
int solveSin(double k, double b, double c, double lo, double hi) {
int count = 0;
if (fabs(c) > 1) return 0; // no angle has a sine beyond 1
double alpha = asin(c) * 180.0 / PI;
for (int mirror = 0; mirror < 2; mirror++) {
double u0 = mirror == 0 ? alpha : 180.0 - alpha; // k x + b = u0 + 360 n
int n = (int)floor((k * lo + b - u0) / 360.0) - 1;
while (count < 60) {
double x = (u0 + 360.0 * n - b) / k;
if (x >= hi) break;
if (x >= lo) {
int seen = 0;
for (int i = 0; i < count; i++) if (fabs(found[i] - x) < 1e-9) seen = 1;
if (seen == 0) { found[count] = x; count++; }
}
n++;
}
}
for (int i = 1; i < count; i++) { // insertion sort
double v = found[i];
int j = i - 1;
while (j >= 0 && found[j] > v) { found[j + 1] = found[j]; j--; }
found[j + 1] = v;
}
return count;
}
void show(int count) {
if (count == 0) printf("none");
for (int i = 0; i < count; i++) {
if (i > 0) printf(" ");
printf("%.1f", found[i]);
}
printf("\n");
}
double f(double x) { return cos(x) - x; }
int main() {
show(solveSin(1, 0, 0.5, 0, 360));
show(solveSin(2, 0, 0.5, 0, 360));
show(solveSin(1, 0, 2, 0, 360));
// 2 sin^2 x - sin x - 1 = 0: a quadratic in u = sin x
double a = 2, b = -1, c = -1;
double d = b * b - 4 * a * c;
show(solveSin(1, 0, (-b - sqrt(d)) / (2 * a), 0, 360));
show(solveSin(1, 0, (-b + sqrt(d)) / (2 * a), 0, 360));
// cos x = x by bisection on [0, 1]
double lo = 0, hi = 1;
int steps = 0;
while (hi - lo > 1e-12) {
double mid = (lo + hi) / 2;
if (f(lo) * f(mid) <= 0) hi = mid; else lo = mid;
steps++;
}
printf("%.10f %d\n", (lo + hi) / 2, steps);
return 0;
}
/* output:
30.0 150.0
15.0 75.0 195.0 255.0
none
210.0 330.0
90.0
0.7390851332 40
*/Where do trigonometric equations come from?
Trigonometric equations began as table look-ups run backwards in astronomy, and the one that mattered most, Kepler's equation, is exactly the kind with no formula.
- About 150 AD. Ptolemy's Almagest gives a table of chords of a circle. Finding the angle for a given chord means reading the table backwards and interpolating between two entries, which is solving \sin x=c numerically.
- About 500 AD. Aryabhata's sine table has 24 values, one for every 3.75^\circ, and such a table can be read forwards, from angle to sine, or backwards, from sine to angle, which is solving \sin x=c by look-up.
- 1609. Kepler's Astronomia nova contains the equation M=E-e\sin E that links the time since a planet passed its nearest point (M) to its position (E). No formula solves it for E in terms of M, so it has been solved ever since by iteration.
- 1687. Newton's Principia gives an iterative method for Kepler's problem, a forerunner of the method that carries his name.
- 1824. Bessel writes E as a series of the functions that now carry his name, a different answer to the same equation.
- Today. Calculators and libraries return the principal value of
asin,acosandatanand leave the other families to the user; equations such as \cos x=x go to bisection or Newton's method.
What are the common mistakes when solving trigonometric equations?
The most common mistakes when solving trigonometric equations are the nine below, each with the correct step.
| Mistake | Correct |
|---|---|
| ❌ \sin x=\frac12⇒ x=30^\circ and stop | There is a second family: 150^\circ+360^\circ n. A calculator gives the principal value only. |
| ❌ \tan x=1⇒ x=45^\circ+360^\circ n | Tangent repeats every 180^\circ: x=45^\circ+180^\circ n, so 225^\circ counts too. |
| ❌ \sin2x=\frac12: solve 2x=30^\circ,150^\circ and halve, finding only 15^\circ,75^\circ | 2x runs over 0^\circ to 720^\circ, so there are four solutions: 15^\circ, 75^\circ, 195^\circ, 255^\circ. |
| ❌ Divide both sides of \sin2x=\cos x by \cos x | Factor instead: \cos x (2\sin x-1)=0, which also finds 90^\circ and 270^\circ. |
| ❌ Accept \sin x=2 or \cos x=-3 as a step to continue from | No angle has such a sine or cosine: no solution from that root. |
| ❌ Square both sides and keep every answer | Check each candidate in the original equation: \sin x+\cos x=1 keeps 0^\circ,90^\circ and drops 180^\circ,270^\circ. |
| ❌ \sin x\cos x=\frac14⇒\sin x=\frac14 or \cos x=\frac14 | Only a product equal to 0 splits into factors. Here \frac12\sin2x=\frac14, so \sin2x=\frac12. |
| ❌ \sin^2x=\frac14⇒\sin x=\frac12 | Take both roots: \sin x=±\frac12, giving 30^\circ,150^\circ,210^\circ,330^\circ. |
| ❌ Solve \cos x=x with x in degrees | x is a plain number mixed with a cosine, so it is in radians: the root is 0.7391. |
Practice: test your understanding
These questions mix everything above. A wrong answer costs nothing here: read the hint and try again.
True or false?
Decide whether each statement is True or False.
- \sin x=\frac12 has infinitely many solutions when no interval is given.
- The solutions of \tan x=c repeat every 360^\circ.
- \sin2x=\frac12 has two solutions between 0^\circ and 360^\circ.
- Dividing both sides of \sin2x=\cos x by \cos x is a safe step.
- After squaring both sides, each answer must be checked in the original equation.
- \cos x=3 has no real solution.
A multiple angle
How many angles x with 0^\circ\le x<360^\circ satisfy \sin3x=\frac12?
A quadratic in sine
How many solutions with 0^\circ\le x<360^\circ does 2\sin^2x-\sin x-1=0 have?
Using an identity
Add up all the solutions of \cos2x=\cos x with 0^\circ\le x<360^\circ (in degrees).
The largest solution
What is the largest solution of \tan x=-1 with 0^\circ\le x<360^\circ (in degrees)?
After squaring
How many solutions with 0^\circ\le x<360^\circ does \sin x+\cos x=1 have?
A sine of one half below zero
What are all the solutions of \sin x=-\frac12 with 0^\circ\le x<360^\circ?
- 210^\circ and 330^\circ
- 30^\circ and 150^\circ
- 120^\circ and 240^\circ
- 330^\circ only
Which step loses solutions?
Which step can lose solutions of a trigonometric equation?
- dividing both sides by an expression that can be zero
- squaring both sides
- factoring after moving everything to one side
- substituting u for sin x
Which have no solution?
Which of these equations have no real solution? Choose all that apply.
- \sin x=1.2
- \tan x=100
- 3\sin x+4\cos x=6
- \cos x=-1
- \sin^2x=-\frac14
Order the solution
Put the lines of the solution of 2\cos^2x=\cos x (for 0^\circ\le x<360^\circ) in order.
Fill in the period
Complete the general solution of the tangent equation.
Where to begin
You have to solve \cos x=x. What is the best first move?
- graph both sides, see where they cross, and find an interval where cos x − x changes sign
- divide both sides by cos x
- take the inverse cosine of both sides and get x = arccos x
- convert x to degrees and use the table of special angles
Summary: trigonometric equations at a glance
- Many solutions: the functions repeat (360^\circ for sine and cosine, 180^\circ for tangent), so an answer is a family with a whole number n or a list inside an interval.
- Interval: put the family into the inequality and keep the whole numbers n that fit; about two solutions per turn for \sin x=c and \cos x=c, one per 180^\circ for \tan x=c.
- Multiple angle: \sin(kx+b)=c: solve for u=kx+b over a k times longer interval, then x=(u-b)/(k); 2k solutions per turn.
- Quadratic: substitute u, solve, discard |u|>1 for sine and cosine, solve the basic equations; a root u=±1 gives one angle.
- Dividing: never by a function that can be zero; move everything to one side and factor.
- Identities: use the one that leaves a single function of a single angle; a\sin x+b\cos x=R\sin(x+φ) needs |c|\le R.
- False roots: squaring and multiplying can add them, undefined angles are not solutions; check every candidate in the original.
- No formula: \cos x=x: graph, bracket, bisection (one binary digit per step) or Newton (x-(f)/(f')), with x in radians.
Glossary: key terms
- Trigonometric equation
- An equation whose unknown is the angle inside one or more trigonometric functions, true for some angles and not for others.
- General solution
- The family of all solutions of a trigonometric equation, written with a whole number n, such as 30 degrees plus 360 degrees times n.
- Principal value
- The one angle that an inverse function such as arcsine returns, from which the other solution families are built.
- Multiple-angle equation
- An equation such as sin 2x = 1/2 in which the function is applied to a multiple of the unknown, so that it has 2k solutions per turn.
- Quadratic in a trigonometric function
- An equation of the form a u squared plus b u plus c equal to zero, where u is sin x, cos x or tan x, solved by substituting u.
- Extraneous root
- An answer produced by the steps of a solution, such as squaring, that does not satisfy the original equation.
- Lost solution
- A solution that disappears because a step, such as dividing by an expression that can be zero, is not valid at that angle.
- Bisection
- A way to find a root by repeatedly halving an interval on which a continuous function changes sign, keeping the half that still does.
- Bracket
- Two points at which a continuous function has opposite signs, which guarantees a root between them.
Frequently asked questions
How many solutions does a trigonometric equation have?
Infinitely many if no interval is given, because the functions repeat. In one turn, sin x equals c and cos x equals c each have two solutions when c is strictly between minus 1 and 1, and tan x equals c has one for every 180 degrees.
How do you solve sin 2x = 1/2 for x between 0 and 360 degrees?
Let u be 2x, which runs from 0 to 720 degrees. Then sin u equals one half at 30, 150, 390 and 510 degrees, so x is 15, 75, 195 and 255 degrees. There are four solutions, not two, because 2x goes round twice.
Why do I lose solutions when I divide by cos x?
Division by cos x is not allowed where cos x is zero, at 90 and 270 degrees, and those angles may be solutions. Move everything to one side and factor out cos x instead, which keeps the solutions where it is zero.
How do you solve a quadratic trigonometric equation?
Write u for sin x, cos x or tan x and solve the quadratic in u by factoring or the formula. For sine and cosine discard roots outside minus 1 to 1, then solve sin x equals each remaining root for the angles.
How do you solve a sin x + b cos x = c?
Rewrite the left side as R sin of x plus phi with R the square root of a squared plus b squared. Then sin of x plus phi equals c over R, which has solutions exactly when c is not larger than R in absolute value.
Why do I get extra answers after squaring a trigonometric equation?
Squaring turns A equals B into A squared equals B squared, which is also true when A equals minus B. The extra answers solve that other equation, so check each candidate in the original equation and cross out the ones that fail.
Can sin x equal 2?
Not for any real angle, because the sine of a real angle is never above 1. With complex numbers it can: sin x equals 2 at x equal to pi over 2 plus or minus i times the natural log of 2 plus root 3.
How do you solve cos x = x?
No formula gives it, so use a numerical method with x in radians. Bracket a sign change of cos x minus x, such as 0 to 1, then use bisection or Newton's method. The root is about 0.7391.
References
- James Stewart, Lothar Redlin, Saleem Watson (2016). Precalculus: Mathematics for Calculus (chapters on analytic trigonometry). Cengage Learning.
- I. M. Gelfand, Mark Saul (2001). Trigonometry (2nd ed.). Birkhäuser.
- Richard L. Burden, J. Douglas Faires, Annette M. Burden (2015). Numerical Analysis (10th ed., chapter 2, solutions of equations in one variable). Cengage Learning.
- Milton Abramowitz, Irene A. Stegun (1964). Handbook of Mathematical Functions (section 4.3, circular functions). National Bureau of Standards.
- Eli Maor (1998). Trigonometric Delights. Princeton University Press.
- Johannes Kepler (1609). Astronomia nova. Heidelberg.
- Carl B. Boyer, Uta C. Merzbach (2011). A History of Mathematics (3rd ed.). Wiley.
Related articles
- Trigonometric Identities: Sum, Double-Angle Formulas and Proofs: Trigonometric identities explained: the Pythagorean, sum, double-angle, half-angle and product formulas, how to prove an identity, and how to test one.
- Basic Trigonometry: Sine, Cosine and Tangent: Basic trigonometry explained: sine, cosine and tangent of a right triangle, exact values at 30°, 45° and 60°, the unit circle, identities, equations and graphs.
- Newton’s Method: Newton’s method for solving f(x) = 0: the formula from tangent lines, examples, quadratic convergence, when it fails, square roots by hand, and code.
- Inverse Trigonometric Functions: Inverse trigonometric functions: domains and ranges, the derivatives of arcsin, arctan and arcsec with proofs, cofunction identities, and the best viewing angle.