# Calculate $\cos(x / 3)$ from $\sin(x)$ and $\cos(x)$

I'm trying to solve some equations using extended precision arithmetics, and I don't have inverse trigonometric functions to simply calculate $\cos\left(\frac{\arccos(\cos(x))}{3}\right)$. I do have (real) square / cube roots and powers.

I think that if I wanted $\cos(3x)$ from $\sin(x)$ and $\cos(x)$, this could be solved using Euler formula and binomial expansion easily.

However, since I want $\cos\left(\frac{x}{3}\right)$ from $\sin(x)$ and $\cos(x)$ (the third angle instead of three angles), I think this will ultimately lead to solving a cubic equation. Is that so, or is there a simpler way how to calculate it?

• $cos x = c(x)$; $\cos 2x = 2c^2 - 1$; $\cos 3x = \cos2x \cos x - \sin2x \sin x = (2c^2-1)c - 2c(1-c^2)$; what's your problem with this? – Vinícius Ferraz Feb 19 '15 at 15:27
• @ViníciusFerraz uh ... it is reverse? – the swine Feb 19 '15 at 15:28

If your program can do complex cube-roots, then $(\cos x+i\sin x)^{1/3}=\cos(x/3)+i\sin(x/3)$
Unfortunately, the standard, Cardano solution to the cubic involves complex cube-roots whenever the three solutions are real. And they are real because they are $\cos(x/3),\cos((x+2\pi)/3),\cos((x-2\pi)/3)$.
If $y=\cos(x/3)$, then $4y^3-3y=\cos x$.
$$\begin{eqnarray}f(y)&=&4y^3-3y-\cos x\\ g(y)&=&12y^2-3\\ y_0&=&\text{ anything, say }y_0=0\\ y_1&=&y_0-f(y_0)/g(y_0)\\ y_2&=&y_1-f(y_1)/g(y_1)\\ y_3&=&y_2-f(y_2)/g(y_2)\end{eqnarray}$$ and continue until $y_n$ settles down. Which it should settle down pretty quickly