## x - cos(x) = 0

For the discussion of math. Duh.

Moderators: gmalivuk, Moderators General, Prelates

tricky77puzzle
Will take "No Tresspassing Signs" for 500
Posts: 488
Joined: Thu Feb 28, 2008 11:02 pm UTC

### x - cos(x) = 0

Is there an algebraic way to define the answer? The answer I get is:

0.73908513321516064165531208767387 (using radians, of course.)

but I don't know if there's a way to define this using a function or any special constants. Can anyone help? (No, this is not homework, they don't teach this kind of thing in Grade 10.)

++\$_
Mo' Money
Posts: 2370
Joined: Thu Nov 01, 2007 4:06 am UTC

### Re: x - cos(x) = 0

Not really, no.

If you rewrite that expression as x = cos(x), you can see that any solution is equal to [imath]\lim_{n \to \infty}cos^{(n)}(x_0),[/imath] if this exists (and it does). However, that's an even less-closed form than the original one.

(Note: [imath]\cos^{(n)}(x)[/imath] is what you get by applying the cosine function to [imath]x[/imath] [imath]n[/imath] times.)

Ended
Posts: 1459
Joined: Fri Apr 20, 2007 3:27 pm UTC
Location: The Tower of Flints. (Also known as: England.)

### Re: x - cos(x) = 0

It's called the Dottie number.

"It was named after a French professor who noticed that whenever she typed a number into her calculator and hit the cosine button over and over, the result always converged to this value." Generally I try to make myself do things I instinctively avoid, in case they are awesome.
-dubsola

t0rajir0u
Posts: 1178
Joined: Wed Apr 16, 2008 12:52 am UTC
Location: Cambridge, MA
Contact:

### Re: x - cos(x) = 0

Most random functions you can write down don't have "nice" inverses. In fact, you should almost never expect this happen, especially if you're mixing polynomials with anything that's not a polynomial. Instead, we have to do things like define whatever we come across as a new function in its own right (at least if it's interesting enough).

NathanielJ
Posts: 882
Joined: Sun Jan 13, 2008 9:04 pm UTC

### Re: x - cos(x) = 0

Here's a thread with some discussion on the Dottie number:

http://forums.xkcd.com/viewtopic.php?f=17&t=23066&p=687416
Homepage: http://www.njohnston.ca
Conway's Game of Life: http://www.conwaylife.com

cspirou
Posts: 147
Joined: Wed Jun 11, 2008 4:09 pm UTC

### Re: x - cos(x) = 0

You won't find an algebraic expression because it's a transcendental function. You can only solve for x when it's a finite polynomial. same thing goes for x=5^x.

t0rajir0u
Posts: 1178
Joined: Wed Apr 16, 2008 12:52 am UTC
Location: Cambridge, MA
Contact:

### Re: x - cos(x) = 0

That depends on what is meant by "algebraic." Usually it means "in terms of elementary functions," and once you realize this you have to realize that the definition of the set of elementary functions is totally arbitrary.

For example, if you only allow radicals and basic arithmetic in your elementary functions, you can't invert general fifth-degree polynomials and higher. (Some people misinterpret Abel's theorem; it is possible to solve quintic polynomials in closed form if you allow either Bring radicals or elliptic functions.) If you allow the Lambert W function, it is (I believe) in fact possible to solve [imath]x = 5^x[/imath].

Rentsy
Posts: 154
Joined: Tue Dec 02, 2008 4:13 am UTC

### Re: x - cos(x) = 0

Most of the time, when there is a variable inside a trig function and a variable outside of a trig function, you can't find the answer, not algebraicly.

I did have to deal with [imath]2x - sinx = 0[/imath] once, and solved it by noticing at at 0, both functions were 0. Oh, the origin...

Cosmologicon
Posts: 1806
Joined: Sat Nov 25, 2006 9:47 am UTC
Location: Cambridge MA USA
Contact:

### Re: x - cos(x) = 0

Rentsy wrote:I did have to deal with [imath]2x - sinx = 0[/imath] once, and solved it by noticing at at 0, both functions were 0. Oh, the origin...

Yes, I noticed that if I kept hitting sin and then dividing by 2 on my calculator, it would always approach 0. That's why the mysterious number 0 is called the Cosmologicon number.

Ended
Posts: 1459
Joined: Fri Apr 20, 2007 3:27 pm UTC
Location: The Tower of Flints. (Also known as: England.)

### Re: x - cos(x) = 0

Cosmologicon wrote:That's why the mysterious number 0 is called the Cosmologicon number.

The Mathematics Council might not be too happy with that.
Generally I try to make myself do things I instinctively avoid, in case they are awesome.
-dubsola

tricky77puzzle
Will take "No Tresspassing Signs" for 500
Posts: 488
Joined: Thu Feb 28, 2008 11:02 pm UTC

### Re: x - cos(x) = 0

Ended wrote:
Cosmologicon wrote:That's why the mysterious number 0 is called the Cosmologicon number.

The Mathematics Council might not be too happy with that.

Ah... so why is cos so special...? I'll try "cot" next.

t0rajir0u
Posts: 1178
Joined: Wed Apr 16, 2008 12:52 am UTC
Location: Cambridge, MA
Contact:

### Re: x - cos(x) = 0

It's not. You'll figure out why it works if you graph x - cos x = 0 on a calculator. The result is true essentially because the two graphs x and cos x only intersect once. You can do the same thing with, say, x + 1 = sin x.

Beacons!
Posts: 213
Joined: Thu May 29, 2008 2:17 pm UTC
Location: The Grand Unifying Intermahweb

### Re: x - cos(x) = 0

NathanielJ wrote:Here's a thread with some discussion on the Dottie number:

http://forums.xkcd.com/viewtopic.php?f=17&t=23066&p=687416

Aww, my first ever topic is being referenced. How Cute.
"Woof!", explained the dog

cspirou
Posts: 147
Joined: Wed Jun 11, 2008 4:09 pm UTC

### Re: x - cos(x) = 0

It gets attracted to that point because it's an iterative mapping.

http://hypertextbook.com/chaos/11.shtml

t0rajir0u
Posts: 1178
Joined: Wed Apr 16, 2008 12:52 am UTC
Location: Cambridge, MA
Contact:

### Re: x - cos(x) = 0

The fact that it's iterative says nothing about whether it has any attractors. There are plenty of examples of iterative mappings with no attractors (in [imath]\mathbb{R}[/imath]), for example [imath]f(x) = x^2 + 1[/imath].

A_of_s_t
Posts: 180
Joined: Tue Aug 26, 2008 5:10 am UTC
Contact:

### Re: x - cos(x) = 0

tricky77puzzle wrote:Is there an algebraic way to define the answer?

The only way that comes to mind is Newton's method which involves some calculus:

n2 = n1 - f(n1)/f'(n1)

Which is, in your case:

n2 = n1 - (n1 - cos(n1) / 1 + sin(n1) )

What you do is pick any number near the zero and plug it into n1 and solve for n2. Then do the same thing for n2 and untill you get to na where is a is the amount of "iterations" you want. The more you do, the closer the answer gets to being the value x is for x - cosx = 0. Either the answer will be very close, or it will be the exact answer.

Hope that helps :/
Check out my web interzones powered by Web 3.0 technology running on Mozzarella Foxfire:

Cosmologicon
Posts: 1806
Joined: Sat Nov 25, 2006 9:47 am UTC
Location: Cambridge MA USA
Contact:

### Re: x - cos(x) = 0

You can also just do n2 = cos(n1). No calculus needed.

PM 2Ring
Posts: 3715
Joined: Mon Jan 26, 2009 3:19 pm UTC
Location: Sydney, Australia

### Re: x - cos(x) = 0

Cosmologicon wrote:You can also just do n2 = cos(n1). No calculus needed.

Certainly! But it takes ages to converge. If we use Newton's method, it converges rather rapidly. After the first couple of iterations, the number of correct digits doubles at each step. I tried this a few days ago using bc & was most impressed with its speed.

FWIW, I first encountered this "Dottie's Number" in the mid-70s, in high school calculus. Our class was the first one in our school to have access to scientific calculators, and one of the guys stumbled across this number one day, just playing around like Ms Dottie did. So I don't know why she should get naming rights. jestingrabbit
Factoids are just Datas that haven't grown up yet
Posts: 5967
Joined: Tue Nov 28, 2006 9:50 pm UTC
Location: Sydney

### Re: x - cos(x) = 0

PM 2Ring wrote:Prof. Dottie

Fixed and I think that's probably part of why the name is what it is.
ameretrifle wrote:Magic space feudalism is therefore a viable idea.

PM 2Ring
Posts: 3715
Joined: Mon Jan 26, 2009 3:19 pm UTC
Location: Sydney, Australia

### Re: x - cos(x) = 0

jestingrabbit wrote:
PM 2Ring wrote:Prof. Dottie

Fixed and I think that's probably part of why the name is what it is.

And my high school colleague never published his result, so his chance of glory was lost. Thus is the lot of the 'umble amateur. Speaking of iterating cos, Julia sets of complex trig functions can look quite pretty. I have a few pics in an old fractal book here. I might fire up FRACTINT later, and see what z' = cos(z) looks like in the neighbourhood of Dottie's number.

bray
Posts: 67
Joined: Wed Aug 15, 2007 4:17 pm UTC

### Re: x - cos(x) = 0

I think there are two kinds of people in the world. Those who like a computer program that doubles the number of correct digits with each step, and those who like that with a couple minutes of work by hand (and, okay, I'll admit it, extensive simplification by maple), you can get that it's approximately:

$\frac{\sqrt{232 - 117 \sqrt{3}} + 6 \sqrt{3} - 13}{3 (3 - \sqrt{3})}$

Good within 0.05%! If you really hate computers, you can just go with [imath]\sqrt{3} - 1[/imath] which gets you within roughly 1%. Not too shabby.

NathanielJ
Posts: 882
Joined: Sun Jan 13, 2008 9:04 pm UTC

### Re: x - cos(x) = 0

bray wrote:I think there are two kinds of people in the world. Those who like a computer program that doubles the number of correct digits with each step, and those who like that with a couple minutes of work by hand (and, okay, I'll admit it, extensive simplification by maple), you can get that it's approximately:

$\frac{\sqrt{232 - 117 \sqrt{3}} + 6 \sqrt{3} - 13}{3 (3 - \sqrt{3})}$

Good within 0.05%!

What good is an approximation if it's an obtuse approximation? Exact answers are nice because they are exact. Approximations are nice because they allow us to see at a glance what the number (roughly) is. That approximation is significantly worse than the decimal approximation given in the first post though, and reveals much less about its value.

If you want something within 0.05%, you might as well just use 73909/100000 or some such thing.
Homepage: http://www.njohnston.ca
Conway's Game of Life: http://www.conwaylife.com

bray
Posts: 67
Joined: Wed Aug 15, 2007 4:17 pm UTC

### Re: x - cos(x) = 0

NathanielJ wrote:If you want something within 0.05%, you might as well just use 73909/100000 or some such thing.

Err...I'm not really sure how to respond to this. Different strokes for different folks, basically. But, really, where did that "73909" come from? An approximation, one presumes? An approximation that probably involved evaluating lots of transcendental functions and so forth. Yeah, I could have just gone with cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(0.5))))))))))) and gotten something about as accurate. But I wanted something I could compute by hand. Something without all those damn transcendental functions. And I got it.

Is it pointless? Yes, of course. But this is the Mathematics forum, guy.

jestingrabbit
Factoids are just Datas that haven't grown up yet
Posts: 5967
Joined: Tue Nov 28, 2006 9:50 pm UTC
Location: Sydney

### Re: x - cos(x) = 0

I can see the attraction of bray's radicals answer. I could construct a right triangle with that side length ratio using a straight edge and compass.
ameretrifle wrote:Magic space feudalism is therefore a viable idea.

0xDEADBEEF
Posts: 284
Joined: Wed Jan 30, 2008 6:05 am UTC
Location: Austin, TX
Contact:

### Re: x - cos(x) = 0

This certainly isn't algebraic, and isn't as accurate as the result posted by the OP, but I had fun knocking this out, and that's what matters!

Code: Select all

#!/usr/bin/pythonimport mathhi = math.pi / 2.0lo = 0x = (lo + hi) / 2.0while x > lo and x < hi:        y = math.cos(x)        if y < x:                hi = x                x = (lo + hi)/ 2.0        else:                lo = x                x = (lo + hi) / 2.0      print y

Edit: As I read...
Ended wrote:It's called the Dottie number.

"It was named after a French professor who noticed that whenever she typed a number into her calculator and hit the cosine button over and over, the result always converged to this value." ... it becomes apparent that I should change my algorithm.

Code: Select all

#!/usr/bin/pythonimport mathy = 0.5x = 0while x != y:    x = y    y = math.cos(x)print y

NathanielJ
Posts: 882
Joined: Sun Jan 13, 2008 9:04 pm UTC

### Re: x - cos(x) = 0

bray wrote:But I wanted something I could compute by hand.

Ah, I missed the "by hand" part. I thought you just fiddled around with Maple and got that as an approximation to Dottie's number. Comment retracted.
Homepage: http://www.njohnston.ca
Conway's Game of Life: http://www.conwaylife.com

Macbi
Posts: 941
Joined: Mon Apr 09, 2007 8:32 am UTC
Location: UKvia

### Re: x - cos(x) = 0

bray wrote:Good within 0.05%! If you really hate computers, you can just go with [imath]\sqrt{3} - 1[/imath] which gets you within roughly 1%. Not too shabby.
I'm going with 14/19, good to 0.3%!
Indigo is a lie.
Which idiot decided that websites can't go within 4cm of the edge of the screen?
There should be a null word, for the question "Is anybody there?" and to see if microphones are on.

qinwamascot
Posts: 688
Joined: Sat Oct 04, 2008 8:50 am UTC
Location: Oklahoma, U.S.A.

### Re: x - cos(x) = 0

7093/9597 is much closer. I'm going with that for now.
Quiznos>Subway

jaap
Posts: 2094
Joined: Fri Jul 06, 2007 7:06 am UTC
Contact:

### Re: x - cos(x) = 0

Macbi wrote:
bray wrote:Good within 0.05%! If you really hate computers, you can just go with [imath]\sqrt{3} - 1[/imath] which gets you within roughly 1%. Not too shabby.
I'm going with 14/19, good to 0.3%!

I'd use 17/23 instead. The same number of digits to remember, but it is about 0.006% accurate.
Or else 711/962 to get to about 1e-7 from the right value.

uewebawo
Posts: 11
Joined: Tue Jan 08, 2008 5:27 am UTC
Contact:

### Re: x - cos(x) = 0

you could always do the Taylor Series of 0 = -x + cos(x)...

something like 0 = -x + 1 - x^2/2! + x^4/4! - x^6/6! + ... + (-1)^n * x^2n/(2n)! + ...

although i don't think that gains you anything in solving for x, but it would be "algebraic"

pardon my weak skills at formatting.
Now I know where baby tables come from!

Come see us over at Castle Arcanum

Macbi
Posts: 941
Joined: Mon Apr 09, 2007 8:32 am UTC
Location: UKvia

### Re: x - cos(x) = 0

uewebawo wrote:you could always do the Taylor Series of 0 = -x + cos(x)...

something like 0 = -x + 1 - x^2/2! + x^4/4! - x^6/6! + ... + (-1)^n * x^2n/(2n)! + ...

although i don't think that gains you anything in solving for x, but it would be "algebraic"

pardon my weak skills at formatting.

I imagine that's what bray did to get his insane representation up there. Probably taking the first 5 terms and
solving the quartic. Am I right?
Indigo is a lie.
Which idiot decided that websites can't go within 4cm of the edge of the screen?
There should be a null word, for the question "Is anybody there?" and to see if microphones are on.

bray
Posts: 67
Joined: Wed Aug 15, 2007 4:17 pm UTC

### Re: x - cos(x) = 0

NathanielJ wrote:
bray wrote:But I wanted something I could compute by hand.

Ah, I missed the "by hand" part. I thought you just fiddled around with Maple and got that as an approximation to Dottie's number. Comment retracted.

Ah good, I was highly confused for a while there. Retraction noted.

Macbi wrote:
uewebawo wrote:you could always do the Taylor Series of 0 = -x + cos(x)...

something like 0 = -x + 1 - x^2/2! + x^4/4! - x^6/6! + ... + (-1)^n * x^2n/(2n)! + ...

although i don't think that gains you anything in solving for x, but it would be "algebraic"

pardon my weak skills at formatting.

I imagine that's what bray did to get his insane representation up there. Probably taking the first 5 terms and
solving the quartic. Am I right?

Pretty close! The solution to the quartic is much crazier looking and has the disadvantage that it can't really be worked out by hand (unless one happens to know the quartic formula and I certainly don't). In a nutshell: the first (probably obvious by now) step was to just take the first three terms and solve the resulting quadratic. That's what gives the simple (and perhaps surprisingly good) approximation [imath]\sqrt{3} - 1[/imath]. Then I tried to approximate how tacking on that [imath]\frac{x^4}{4!}[/imath] would shift the answer. So letting [imath]a = \sqrt{3} - 1[/imath], we have
$0 = -24 (a + \Delta a) + 24 - 12 (a + \Delta a)^2 + (a + \Delta a)^4 \approx -24 (a + \Delta a) + 24 - 12 (a + \Delta a)^2 + a^4 + 4 a^3 \Delta a + 6 a^2 \Delta a^2$.
Solving that quadratic (a bunch of the terms there disappear when you use the fact that a is a root of the original quadratic) for [imath]\Delta a[/imath] gives my insane approximation from before.

And, yes, folks, there are lots of other simpler/rational numbers which approximate the Dottie number better. If you'd like to post your derivation for them, please go ahead.

t0rajir0u
Posts: 1178
Joined: Wed Apr 16, 2008 12:52 am UTC
Location: Cambridge, MA
Contact:

### Re: x - cos(x) = 0

Why? With enough digits it's trivial to compute the continued fraction representation of the Dottie number up to some desired accuracy and get good rational approximations. It's not a very useful exercise on a number that isn't known to have any nice algebraic properties.

bray
Posts: 67
Joined: Wed Aug 15, 2007 4:17 pm UTC

### Re: x - cos(x) = 0

t0rajir0u wrote:Why? With enough digits it's trivial to compute the continued fraction representation of the Dottie number up to some desired accuracy and get good rational approximations. It's not a very useful exercise on a number that isn't known to have any nice algebraic properties.

Because it's there. And, yet again, the point was to get something by hand ab initio. Obviously if you start with a decimal approximation you can do better and, seriously, it's more useful of an exercise to take one rational approximation (the decimal one) and come up with another one? (Using a generic algorithm that has nothing to do with the problem at hand, one might add.) Come on.

Cosmologicon
Posts: 1806
Joined: Sat Nov 25, 2006 9:47 am UTC
Location: Cambridge MA USA
Contact:

### Re: x - cos(x) = 0

I got [imath](\sqrt{\pi+3}-1)/2[/imath] completely by hand in about 10 lines - no computers used at all. It's good to within 0.004% (though I used a calculator to find that fact). Beat that!

EDIT: Okay here's the derivation.
Spoiler:
$x^2 = \cos^2{x} = \frac{1}{2}(1 + \cos{2x}) = \frac{1}{2}(1 + \sin(\pi/2 - 2x)) = \frac{1}{2}(1 + \pi/2 - 2x)$where the last step is an approximation. Then you solve the quadratic.

Ended
Posts: 1459
Joined: Fri Apr 20, 2007 3:27 pm UTC
Location: The Tower of Flints. (Also known as: England.)

### Re: x - cos(x) = 0

$\pi / 4 - (1 + \sqrt{2}) + \sqrt{5 + 2\sqrt{2} - \pi / \sqrt{2}}$
Good to within 0.001%! Although yours is much tidier, Cosmologicon.

Spoiler:
Write x = pi/4 + y. It's pretty clear (from considering the graphs) that y will be small. Expand cos(pi/4 + y) = pi/4 + y, Taylor series to 2nd order and solve the quadratic.

edit: the Mathworld page gives the approximation [imath]{(\pi/160)}^{1/13}[/imath], good to 0.00003%. Nice.
Generally I try to make myself do things I instinctively avoid, in case they are awesome.
-dubsola

cspirou
Posts: 147
Joined: Wed Jun 11, 2008 4:09 pm UTC

### Re: x - cos(x) = 0

t0rajir0u wrote:The fact that it's iterative says nothing about whether it has any attractors. There are plenty of examples of iterative mappings with no attractors (in [imath]\mathbb{R}[/imath]), for example [imath]f(x) = x^2 + 1[/imath].

First of all it only intersects at one point and that point is an attractor. Second of all the iterations is literally what is happening when you keep putting it in cosine over and over. That's why I brought it up.

Return to “Mathematics”

### Who is online

Users browsing this forum: No registered users and 6 guests