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.


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


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


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