# A Curiosity

Thoughts on the power series for  $f\left( x \right)=\cos \left( {\sqrt{x}} \right),x\ge 0$, which I found curious.

Last week someone asked me a question about the Maclaurin series for  $f\left( x \right)=\cos \left( {\sqrt{x}} \right),x\ge 0$.  Finding the Maclaurin series is straightforward:

$\displaystyle \cos \left( x \right)=1-\frac{{{{x}^{2}}}}{{2!}}+\frac{{{{x}^{4}}}}{{4!}}-\frac{{{{x}^{6}}}}{{6!}}+\cdots +{{\left( {-1} \right)}^{n}}\frac{{{{x}^{{2n}}}}}{{\left( {2n} \right)!}}+\cdots$

Substituting $\displaystyle \sqrt{{x}}$ for x gives

$\displaystyle \cos \left( {\sqrt{x}} \right)=R\left( x \right)=1-\frac{{{{{\left( {\sqrt{x}} \right)}}^{2}}}}{{2!}}+\frac{{{{{\left( {\sqrt{x}} \right)}}^{4}}}}{{4!}}-\frac{{{{{\left( {\sqrt{x}} \right)}}^{6}}}}{{6!}}+\cdots {{\left( {-1} \right)}^{n}}\frac{{{{{\left( {\sqrt{x}} \right)}}^{{2n}}}}}{{\left( {2n} \right)!}}+\cdots$

$\displaystyle \cos \left( {\sqrt{x}} \right)=R\left( x \right)=1-\frac{x}{{2!}}+\frac{{{{x}^{2}}}}{{4!}}-\frac{{{{x}^{3}}}}{{6!}}\cdots +{{\left( {-1} \right)}^{n}}\frac{{{{x}^{n}}}}{{\left( {2n} \right)!}}+\cdots$

We can find the radius and interval of convergence by using the Ratio test:

$\displaystyle \underset{{x\to \infty }}{\mathop{{\lim }}}\,\left| {\frac{{\frac{{{{x}^{{n+1}}}}}{{(2(n+1))!}}}}{{\frac{{{{x}^{n}}}}{{\left( {2n} \right)!}}}}} \right|=\underset{{x\to \infty }}{\mathop{{\lim }}}\,\left| {\frac{x}{{\left( {2x+2} \right)\left( {2n+1} \right)}}} \right|=0$

This indicates that Maclaurin series converges for all Real numbers. However, the original function  $f\left( x \right)=\cos \left( {\sqrt{x}} \right),x\ge 0$ is not defined for negative numbers, but the series is. This can be accounted for by the fact that the series contains only even powers of x, and for all Real numbers x, $\displaystyle {{\left( {\sqrt{x}} \right)}^{2}}$ is a Real number. In addition, since the function ends at x = 0, how can the Maclaurin series be centered there? Since it is not defined to the left of zero, how can it have derivatives at zero?

This is in conformance with the graph. You can see the graph and experiment with here on Desmos. Use the slider and note the exaggerated scales. Also note that the power series extends steeply up to the left from  the point (0, 1).

$\displaystyle \cos \left( {\sqrt{x}} \right)$ in red largely covered by its Maclaurin series (with n = 14) in blue.

The curiosity is that $\displaystyle \cos \left( {\sqrt{x}} \right)$  is not defined for negative numbers and is not differentiable at x = 0 (because the two-sided limit defining the derivative does not exist to the left of x = 0. But, but the Maclaurin series is continuous and differentiable for all Real numbers. The Maclaurin series is a good approximation for  $f\left( x \right)=\cos \left( {\sqrt{x}} \right),x\ge 0$ but approximates a larger function to the left of x = 0.

The explanation is that there is a larger function (that is, one defined for all Real numbers with the appropriate derivatives) that includes \$latex \displaystyle \cos \left( {\sqrt{x}} x > 0 as part of it. The series is

$\displaystyle R\left( x \right)=\left\{ {\begin{array}{*{20}{c}} {\cos \left( {\sqrt{x}} \right)} & {x\ge 0} \\ {\cosh \left( {\sqrt{{-x}}} \right)} & {x<0} \end{array}} \right.$

(Note: $\displaystyle \cosh \left( {\sqrt{{-x}}} \right)=1+\frac{x}{{2!}}+\frac{{{{x}^{2}}}}{{4!}}+\frac{{{{x}^{3}}}}{{6!}}+\cdots =\frac{{{{e}^{{\sqrt{{-x}}}}}+{{e}^{{-\sqrt{{-x}}}}}}}{2}$)

I wish to thank Louis A. Talman, Ph.D,,Emeritus Professor of Mathematics Metropolitan State University of Denver for helping me understand this function better and correcting some of my early ideas. He is the one who Developed the piecewise defined series above. An explanation of the reasoning and a longer discussion of this series can be found in this note “On $f\left( x \right)=\cos \left( {\sqrt{x}} \right),x\ge 0$.”   In that note he shows that the Maclaurin series R(x) approximates this piecewise defined function. The two pieces form a function that is continuous and differentiable everywhere including at x = 0. (The pieces join smoothly the point (0, 1).

A similar curious situation, where a series, but not a Taylor/Maclaurin series, approximates a function is discussed in Geometric Series – Far Out.

This site uses Akismet to reduce spam. Learn how your comment data is processed.