9
$\begingroup$

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

$\endgroup$
13
$\begingroup$

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}\;.$$

$\endgroup$
11
  • 1
    $\begingroup$ 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 $\endgroup$
    – user11869
    Jun 17 '11 at 15:36
  • $\begingroup$ 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. $\endgroup$ Jun 17 '11 at 15:36
  • $\begingroup$ @user11869: I don't understand -- how would you then use that identity to find $x$? $\endgroup$
    – joriki
    Jun 17 '11 at 19:25
  • $\begingroup$ $(1-x)^2+[1-(\pi/2-x)]^2=1$ and solve this equation $\endgroup$
    – user11869
    Jun 17 '11 at 20:00
  • $\begingroup$ @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$. $\endgroup$
    – joriki
    Jun 17 '11 at 20:41
7
$\begingroup$

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}.$

$\endgroup$
6
$\begingroup$

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$.

$\endgroup$
4
$\begingroup$

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).

$\endgroup$
1
$\begingroup$

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.

$\endgroup$
1
  • 1
    $\begingroup$ 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? $\endgroup$
    – 911
    Mar 11 '11 at 9:48
1
$\begingroup$

As @Gerben answered, building the Taylor series around $x=\frac \pi 6$ gives $$y=x+\sin(x)-1=\frac{\pi -3}{6} +\frac{2+\sqrt{3}}{2} x+\sum_{n=2}^\infty \frac{\sqrt{3} \sin \left(\frac{\pi n}{2}\right)+\cos \left(\frac{\pi n}{2}\right)}{2 n!} \left(x-\frac{\pi }{6}\right)^n$$ Truncated to $O\left(\left(x-\frac{\pi }{6}\right)^6\right)$ for example and using series reversion, then $$x=\frac{\pi }{6}+t+\left(1-\frac{\sqrt{3}}{2}\right) t^2+\left(3-\frac{5}{\sqrt{3}}\right) t^3+\left(\frac{67}{6}-\frac{77}{4 \sqrt{3}}\right) t^4+\left(\frac{232}{5}-\frac{803}{10 \sqrt{3}}\right) t^5+O\left(t^{6}\right)$$ where $t=\frac{y+\frac{3-\pi }{6}}{1+\frac{\sqrt{3}}{2}}$.

Making $y=0$ that is to say $t=-\frac{\left(2-\sqrt{3}\right) (\pi -3)}{3} $, this gives $x=0.51097342938847$ while the exact solution is $x=0.51097342938857$.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.