# Solve $\sin x = 1 - x$

How would you be solve sin x = 1 - x, without drawing the graph and manually measuring the point of intersection?

-

There's no closed-form analytical solution for this kind of transcendental equation. You can either solve it graphically (as you said) or numerically. There are various methods for solving it numerically, see this Wikipedia article for an overview.

If you're not looking for a particularly efficient solution, the simplest thing to do in this case might be to write the equation as

$$x=1-\sin x$$

and iterate the map

$$x_{n+1}=1-\sin x_n$$

until you achieve satisfactory convergence. This is very inefficient, though; it only makes sense if you do it on a computer and don't mind if it takes a lot of operations; you'll need a lot of patience to get anywhere with it with a calculator. :-)

A far more efficient method that yields $x$ to double-precision machine accuracy within a couple of iterations would be Newton's method:

$$f(x) = x + \sin x - 1 \stackrel{!}{=} 0\;,$$

$$x_{n+1}=x_n-\frac{f(x_n)}{f'(x_n)}=x_n - \frac{x+\sin x - 1}{1 + \cos x}\;.$$

-
Is there any problem with the following approach? $\sin (\pi/2-x)=1-(\pi/2-x) \rightarrow \cos(x)=1-(\pi/2-x)$. Then use the identity $sin^2 x+cos^2 x=1$ to find x – user11869 Jun 17 '11 at 15:36
If the figure of merit is operator time instead of computer time, a spreadsheet can make the programming very easy. Just put a starting value (0.5 is a good one, as others have said) in A1, =1-sin(x) in B1, =B1 in A2, and copy down until you see convergence. – Ross Millikan Jun 17 '11 at 15:36
@user11869: I don't understand -- how would you then use that identity to find $x$? – joriki Jun 17 '11 at 19:25
$(1-x)^2+[1-(\pi/2-x)]^2=1$ and solve this equation – user11869 Jun 17 '11 at 20:00
@user11869: I see. You're assuming that the given equation holds both for $x$ and for $\pi/2-x$. But there's no reason why it should hold for $\pi/2-x$. – joriki Jun 17 '11 at 20:41

For such cases, I would use Wims Function Calculator. Type the function $f(x)=\sin(x)-(1-x)$, and check the last box to find the root of the equation $\sin(x)-(1-x) = 0$. You can obtain the value of the root even up to $200$ digits. In your example, the root is approximately $0.51097342938856910952001397114508063204535889262375023988987953800752819385525987164073419474333797073844705378201625612601584766524335342369803019732463083576632594596747582089441042803074463769962092$.

-

Below is a calculus-type approach. Remark that to first order $\sin x \simeq x,$ so your result will be somewhere around $x = \frac{1}{2}.$ That suggests a Taylor expansion of sine around $\frac{\pi}{6} \simeq \frac{1}{2}.$ You can introduce $\epsilon = x - \frac{\pi}{6},$ such that $$\sin(x) = \frac{1}{2} + \frac{\sqrt{3}}{2}\epsilon - \frac{1}{4}\epsilon^2 + \mathcal{O}(\epsilon^3).$$ Identifying $1 - x = 1 - (\frac{\pi}{6} + \epsilon),$ you can equate both sides of your equation and solve a linear, quadratic, ..., polynomial equation in $\epsilon$, which will however involve knowing a reasonable approximation to $\pi$ and/or $\frac{\pi}{6}.$

-

As joriki mentions, simple-minded fixed-point iteration works if you're not too concerned about efficiency in obtaining the numerical solution (One usually has to be very lucky to obtain a closed form solution for a transcendental equation; this is not one of those lucky situations.). I'll only note that making use of the fact that $\sin\;x\approx x$, you can then say that there is a solution very near $x=.5$. Feed that to a fixed-point iteration, Newton, or Halley, and you can then obtain a good numerical approximation (which Shai has already given for you).

-

It depends on what you mean by "solving". If you want to show that a solution exists, use the intermediate value theorem. Expressing the solution by "elementary functions" (also called an analytical solution or closed-form solution, but note that these terms don't have universal definitions) is not possible. If you want a numerical solution, then use Newton's method.

-
Using Newton-Raphson method $f(x) := sin(x) + x - 1$, $f'(x) = cos(x) + 1$, $x = x - \frac{f(x)}{f'(x)}$ $x = x - \frac{sin(x) + x - 1}{cos(x) + 1}$, Use an initial estimate between $0$ and $\frac{\pi}{2}$ i.e. $\frac{\pi}{4}$ and iterate? – 911 Mar 11 '11 at 9:48