# Arccosx near x = 1

1. Oct 24, 2014

### presto

I compute some arccos near x = 1 and get very fany numbers:

arccos 0.999 = 2.5625 = q

and next with several steps 0.001:
arccos 0.998 = 3.6243 = q*1.414; sqrt2 times bigger
arccos 0.997 = 4.4392 = q*1.732; sqrt3 times bigger
arccos 0.996 = 5.1264 = q*2.000; sqrt4
arccos 0.995 = ... sqrt5
ect.

I can now guess in the fly:
acos 0.99999 = q/10 = 0.2562, because sqrt100 = 10; :)

I don't know what means these sqrt(n) values...

what is a formula for arccosx near x = 1 ?

2. Oct 24, 2014

### .Scott

It means that the cosine wave is very similar to a parabola in the domain of +/- 6 degrees.
You're working in degrees. If you're looking for Math insights, use radians and natural logarithms.

You could do the same thing with the sine of values near 0.

One way of computing the cosine of a value is to use this Taylor series:
$cos(x)=1-{x^2 \over 2!}+{x^4 \over 4!}-{x^6 \over 6!}+ ...$

Notice that for small values of x, the first two terms ($1-{x^2 \over 2!}$) are much larger than the remaining terms - because the numerators keep getting smaller and the denominators keep getting larger.
So for small x, an approximation of the cosine is: $cos(x)=1-{x^2 \over 2!}$
which is a parabola.

Last edited: Oct 24, 2014
3. Oct 24, 2014

### presto

OK. But I compute arccos, not cos.
I used the degrees by accident only... the calc keeps degs as default setting.

Now I can see:
$\arccos x \to \sqrt{1-x^2},\ for\ x \to 1$

but what is a full - exact expansion at x = 1?

Namely: what is a further correction to the sqrt(1-x^2) to get better result of arccos near x=1?

4. Oct 25, 2014

### presto

5. Oct 25, 2014

### .Scott

There is a Taylor Series for arccos, but it's messy.

If we only go to the second term in the cosine Taylor series, we have:
$\quad C_2$ is 2-term cosine: $\quad C_2(\theta) = 1-{\theta^2 \over 2!} = 1-{\theta^2 \over 2}$
$\quad A_2$ is corresponding arc cosine: $\quad A_2(C_2(\theta)) = \theta = A_2(1-{\theta^2 \over 2})$
Let x be defined as follows: $1-{\theta^2 \over 2}=x$, so $\theta^2=2-2x$ and $\theta=\sqrt{2-2x}$
Giving: $A_2(x)=\sqrt{2-2x}$

Taking in one more term:
$\quad C_3$ is 3-term cosine: $\quad C_3(\theta) = 1-{\theta^2 \over 2!}+{\theta^4 \over 4!} = 1-{\theta^2 \over 2}+{\theta^4 \over 24}$
$\quad A_3$ is corresponding arc cosine: $\quad A_3(C_3(\theta)) = \theta = A_3(1-{\theta^2 \over 2}+{\theta^4 \over 24})$
This time, let x be defined as follows: $1-{\theta^2 \over 2}+{\theta^4 \over 24}=x$
$\quad \theta^4 - 12\theta^2 + 24(1-x) = 0$
$\quad \theta^2 = {12\pm \sqrt{12^2-4(24(1-x))} \over 2}$
For $\theta$ near 1, only the minus of the plus/minus works.
$\quad \theta^2 = 6 - \sqrt{6^2-24+24x}$
$\quad \theta^2 = 6 - 2\sqrt{3+6x}$
$\quad \theta = \sqrt{6 - 2\sqrt{3+6x}}$
Giving: $A_3(x)=\sqrt{6 - 2\sqrt{3+6x}}$

For example:
$\arccos(.999) = 0.0447250871687334$
$A_2(.999) = 0.0447213595499958$ (4-place accuracy)
$A_3(.999) = 0.0447250874173630$ (8-place accuracy)

http://www.wolframalpha.com/input/?i=arccos(x)-sqrt(6-2sqrt(3 + 6x))

Last edited: Oct 25, 2014
6. Oct 25, 2014

### Staff: Mentor

With c=1-x, sqrt(1-x^2) = sqrt(1-(1-c))^2 = sqrt(1-1+2c-c^2) = sqrt(2c-c^2). For small c, we can neglect c^2, and you get the approximation sqrt(1-x^2)=sqrt(2c)=sqrt(2-2x). Your observed pattern in the first post is directly this sqrt(2c).

7. Oct 26, 2014

### presto

Very well.

Maybe instead using the two or three tems only, , better will be to sum up the whole, but still approximately.

$1 - x^2/2 + x^4/24 - x^6/720 + ... = 1 - x^2/2 (1 - x^2/12 + x^4/360 - ...)$
and we now try to approximate in someway the serie, for example:

$1 - x^2/12 + (x^2/12)^2 - ... = \frac{1}{1 + x^2/12}$

therefore we get:
$y = 1 - \frac{x^2/2}{1 + x^2/12} = 1 - \frac{x^2}{2 + x^2/6}$

now we invert the function: x = ...
and this should be better approx.

cos0.001 = 0.99999950000004166666527777780258; and:
y(0.001) = 0.9999995000000416666631944447338; up to 20 digits correct!

8. Oct 26, 2014

### zoki85

There are numerous expansions, and many are faster convergeting than plain Taylor's. Here's one involving square root and π:

If you dislike having constant π in it, just replace it with some good series ( and there're some insanely fast convergeting)