# Quick way to expand $\cos^{-1}(\cos^2 x)$ up to $O(x^2)$

For a part of a question, I need to expand $\cos^{-1}(\cos^2 x)$ up to $O(x^2)$ about $x=0$. It took me quite a while to get an incorrect answer. What are some quick and efficient offline (i.e, no alpha) ways to get a good approximation?

EDIT: To elaborate a bit more, the first order term can be confidently stated to be $\sqrt{2}x$ as this expression is the length of a hypotenuse for a right spherical triangle, which must reduce to the flat triangle hypotenuse. No "reasoning" like this could work for second order term so I had to take the cumbersome way.

-
What method did you try? Find the first and second derivatives at $0$? – Aryabhata Jul 13 '11 at 20:11
@Aryabhata yes. – kuch nahi Jul 13 '11 at 20:16
Well, $f(0)=0$ obviously, and $f'(0) = \pm \sqrt{2}$, sign depending on which direction you're coming from (you can prove this with chain rule and $\sin(x) = \sqrt{1-\cos^2(x)}$). As the derivative isn't continuous, is this really analytic at $x=0$? – anon Jul 13 '11 at 20:23
Oh, you want a second-order term? That's not what I thought you meant by $O(x^2)$. – Qiaochu Yuan Jul 13 '11 at 20:26
@Qiaochu +1 anyway, as what you did for 1st order was faster than what I would have done progressing routinely – kuch nahi Jul 13 '11 at 20:28
show 6 more comments

We have $\cos^2 x = \left( 1 - \frac{x^2}{2} + O(|x|^4) \right)^2 = 1 - x^2 + O(|x|^4)$. Since $\cos x = 1 - \frac{x^2}{2} + O(|x|^4)$, it follows that $\cos^{-1} \left( 1 - \frac{x^2}{2} \right) = x + O(|x|^2)$, hence

$$\cos^{-1} \left( \cos^2 x \right) = \sqrt{2} x + O(|x|^2).$$

Edit: Jyrti seems to be right. Writing $\cos^{-1} \left( \cos^2 x \right) = \sqrt{2} (x + h)$, we get

$$\cos^2 x = 1 - x^2 + O(|x|^4) = 1 - (x + h)^2 + O(|x|^4)$$

so we can get $h = O(|x|^3)$. Just for fun, writing $h = ax^3 + O(|x|^4)$ we get

$$1 - x^2 + \frac{x^4}{3} + O(|x|^6) = 1 - x^2 - 2ax^4 + \frac{x^4}{6} + O(|x|^6)$$

hence $a = - \frac{1}{12}$ and

$$\cos^{-1} \left( \cos^2 x \right) = \sqrt{2} x - \sqrt{2} \frac{x^3}{12} + O(|x|^4).$$

Note that these power series computations are much faster than repeated computation of derivatives using the chain rule. The manipulations I'm doing make sense in the ring of formal power series modulo $x^4$ or $x^5$ or whatever precision I care about, and in that generality there's no need to think in terms of complicated sums of products of functions (which implicitly carry information about the derivatives to all orders, which is irrelevant).

-
I am sorry for the confusion, but by "up to $O(x^2)$" I meant to include the second term as well, as I need some estimate of the correction. I have added a clarificatory edit to my question – kuch nahi Jul 13 '11 at 20:27
I think that the error term is actually $O(|x|^3)$. If there were a term like $a_2x^2$, with $a_2\neq0$, then when you substitute that to the Maclaurin series of cosine you would get a cubic term. – Jyrki Lahtonen Jul 13 '11 at 20:31
Is there any name for this style of computations. It seems driven by intuition, but it would be good to know if presentation of such a method exists somewhere. – kuch nahi Jul 13 '11 at 21:41
@kuch: I don't know if this kind of reasoning is written up somewhere; it's probably folklore. Basically I am just aggressively exploiting Taylor's theorem. This might be worth a blog post... – Qiaochu Yuan Jul 13 '11 at 21:47
@Qiaochu Yuan - how do you go from $\cos(x)=1-x^2/2+O(x^4)$ to $\cos^{-1}(1-x^2/2) = x + O(x^2)$? – robinson Jul 17 '11 at 1:31
show 4 more comments

Qiaochu's answer is a general way and that method ought to be in your bag of tools.

There are some 'gotchas' with this problem (especially if taking an exam) though, and you need to be careful...

Consider the function

$$g(x) = \begin{cases} \cos^{-1}(\cos^2 x) & x \ge 0 \\ -\cos^{-1}(\cos^2 x) & x \lt 0 \end{cases}$$

This function has the derivative $\displaystyle g'(x) = \frac{2\cos x}{\sqrt{1 + \cos^2 x}} \forall x \in (-\epsilon, \epsilon)$

Notice that $g(x)$ is an odd function.

Hence the power series will only have terms of the form $\displaystyle x^{2n+1}$ and so

$$g(x) = \sqrt{2}x + \mathcal{O}(x^3)$$

The same reasoning we cannot apply to $\cos^{-1}(\cos^2 x)$, which is an even function, as its derivative at $0$ does not exist.

So basically, your question is incomplete when you say about $x = 0$. Technically speaking, as asked, the derivative at $0$ does not exist and so the Taylor series does not exist either.

i.e: in the $(0,\epsilon)$ neighbourhood we have

$$\cos^{-1}(\cos^2 x) = \sqrt{2} x + \mathcal{O}(x^3)$$

while in the $(-\epsilon, 0)$ neighbourhood we have

$$\cos^{-1}(\cos^2 x) = -\sqrt{2} x + \mathcal{O}(x^3)$$

-
 Made the function $g(x)$ in displaystyle mode. – user9413 Jul 14 '11 at 6:23

By symmetry, it is enough to consider the case $x \to 0^+$. Here's a rigorous and not too complicated way to derive the asymptotic equality $$\arccos (\cos ^2 x) = \sqrt 2 x - \frac{{\sqrt 2 }}{{12}}x^3 + O(x^5 )\;\; {\rm as} \; x \to 0^+.$$ From Wikipedia, $$\arccos x = 2\arctan \frac{{\sqrt {1 - x^2 } }}{{1 + x}},\;\; - 1 < x \le 1.$$ Hence $$\arccos (\cos ^2 x) = 2\arctan \frac{{\sqrt {1 - \cos ^4 x} }}{{1 + \cos ^2 x}} = 2\arctan \frac{{\sin x}}{{\sqrt {1 + \cos ^2 x} }} = 2\arctan \frac{{\sin x}}{{\sqrt {2 - \sin ^2 x} }}.$$ Next, from $$\frac{1}{{\sqrt {2 - x} }} = \frac{1}{{\sqrt 2 }} + \frac{1}{{4\sqrt 2 }}x + O(x^2 )$$ we get $$\frac{{\sin x}}{{\sqrt {2 - \sin ^2 x} }} = \bigg(\frac{1}{{\sqrt 2 }} + \frac{1}{{4\sqrt 2 }}\sin ^2 x + O(x^4 )\bigg)\sin x.$$ Then, from $$\sin x = x - \frac{{x^3 }}{6} + O(x^5 )$$ we get $$\frac{{\sin x}}{{\sqrt {2 - \sin ^2 x} }} = \frac{1}{{\sqrt 2 }}\bigg(x - \frac{{x^3 }}{6}\bigg) + \frac{1}{{4\sqrt 2 }}x^3 + O(x^5 ) = \frac{1}{{\sqrt 2 }}x + \frac{1}{{12\sqrt 2 }}x^3 + O(x^5 ).$$ Next, from $$\arctan x = x - \frac{{x^3 }}{3} + O(x^5 )$$ we get $$\arctan \frac{{\sin x}}{{\sqrt {2 - \sin ^2 x} }} = \frac{1}{{\sqrt 2 }}x + \frac{1}{{12\sqrt 2 }}x^3 - \frac{1}{{3\sqrt 2 ^3 }}x^3 + O(x^5 ) = \frac{1}{{\sqrt 2 }}x - \frac{1}{{12\sqrt 2 }}x^3 + O(x^5 ).$$ Finally, $$\arccos (\cos ^2 x) = 2\arctan \frac{{\sin x}}{{\sqrt {2 - \sin ^2 x} }} = \sqrt 2 x - \frac{{\sqrt 2 }}{{12}}x^3 + O(x^5 ).$$

-
 what is 'x downarrow $0$'? – kuch nahi Jul 13 '11 at 20:55 I posted a new answer. – Shai Covo Jul 14 '11 at 2:43 Thanks for undeleting, this is very helpful +1 – kuch nahi Jul 14 '11 at 2:47 Thanks, glad to help. (This answer is completely different from the original one.) – Shai Covo Jul 14 '11 at 2:52