2

I am majoring in Physics, and we use Taylor expansions and approximations all the time, so I wanted to understand how they work better. For example, in one of my problems, I was dealing with the following function: $$ f(x) = \frac{\sin{x}}{\sqrt{2 - \sqrt{2 + 2\cos{x}}}} $$ for $x > 0$ and more importantly, near zero: $x \ll 1$. The original problem was to find the limit of this function as $x \to 0^+$. I tried using L'Hopital's rule and some other limit tricks, but it quickly became a mess you can't get out of. Then, I looked at the answer, and I saw that they solved the limit using the famous Taylor approximations: $$ \sin{x} \approx x \qquad \cos{x} \approx 1 - \frac{x^2}{2} \qquad (1 + x)^{\alpha} \approx 1 + \alpha x $$ Plugging these approximations in, we get: \begin{align} \lim_{x \to 0^+}\frac{\sin{x}}{\sqrt{2 - \sqrt{2 + 2\cos{x}}}} &\approx \lim_{x \to 0^+}\frac{x}{\sqrt{2 - \sqrt{2 + 2(1 - \frac{x^2}{2})}}} \\ &= \lim_{x \to 0^+}\frac{x}{\sqrt{2 - \sqrt{4 - x^2}}} \\ &= \lim_{x \to 0^+}\frac{x}{\sqrt{2 - 2\sqrt{1 - \frac{x^2}{4}}}} \\ &\approx \lim_{x \to 0^+}\frac{x}{\sqrt{2 - 2(1 - \frac{x^2}{8})}} \\ &= \lim_{x \to 0^+}\frac{x}{\sqrt{\frac{x^2}{4}}} \\ &= 2 \end{align} This is indeed the correct result. Honestly, this approach looks like magic to me, and it looks like it can solve many tough limit problems easily. We basically found the zeroth order Taylor approximation of $f(x)$. This got me thinking that if I keep more terms in my approximations, then I should be able to produce the rest of the Taylor series of $f(x)$. So I tried keeping the next terms of the trig functions: $$ \sin{x} \approx x - \frac{x^3}{6} \qquad \cos{x} \approx 1 - \frac{x^2}{2} + \frac{x^4}{24} $$ Repeating the same calculation, I get: \begin{align} \frac{\sin{x}}{\sqrt{2 - \sqrt{2 + 2\cos{x}}}} &\approx \frac{x - \frac{x^3}{6}}{\sqrt{2 - \sqrt{2 + 2(1 - \frac{x^2}{2} + \frac{x^4}{24})}}} \\ &= \frac{x - \frac{x^3}{6}}{\sqrt{2 - \sqrt{4 - x^2 + \frac{x^4}{12}}}} \\ &= \frac{x - \frac{x^3}{6}}{\sqrt{2 - 2\sqrt{1 - \frac{x^2}{4} + \frac{x^4}{48}}}} \\ &\approx \frac{x - \frac{x^3}{6}}{\sqrt{2 - 2(1 - \frac{x^2}{8} + \frac{x^4}{96})}} \\ &= \frac{x - \frac{x^3}{6}}{\sqrt{\frac{x^2}{4} - \frac{x^4}{48}}} \\ &= \frac{2 - \frac{x^2}{3}}{\sqrt{1 -\frac{x^2}{12}}} \\ &\approx \left(2 - \frac{x^2}{3}\right)\left(1 + \frac{x^2}{24}\right) \\ &\approx 2 - \frac{x^2}{4} \end{align} While I got that the linear term correctly vanishes, I got the wrong coefficient for the quadratic term. That's when I realized I should also keep another term from the third approximation: $$ (1 + x)^{\alpha} \approx 1 + \alpha x + \frac{\alpha(\alpha - 1)}{2}x^2 $$ Repeating the calculation again with this improved approximation: \begin{align} \frac{\sin{x}}{\sqrt{2 - \sqrt{2 + 2\cos{x}}}} &\approx \frac{x - \frac{x^3}{6}}{\sqrt{2 - 2\sqrt{1 - \frac{x^2}{4} + \frac{x^4}{48}}}} \\ &\approx \frac{x - \frac{x^3}{6}}{\sqrt{2 - 2(1 + \frac{1}{2}(-\frac{x^2}{4}+ \frac{x^4}{48}) - \frac{1}{8}(-\frac{x^2}{4}+ \frac{x^4}{48})^2)}} \\ &\approx \frac{x - \frac{x^3}{6}}{\sqrt{\frac{x^2}{4} - \frac{x^4}{192}}} \\ &= \frac{2 - \frac{x^2}{3}}{\sqrt{1 - \frac{x^2}{48}}} \end{align} Now, I noticed that to get a second-order approximation, it's enough to take the linear approximation of the square root in the denominator (keeping the quadratic term will only give me higher-order terms): \begin{align} \frac{\sin{x}}{\sqrt{2 - \sqrt{2 + 2\cos{x}}}} &\approx \frac{2 - \frac{x^2}{3}}{\sqrt{1 - \frac{x^2}{48}}} \\ &\approx \left(2 - \frac{x^2}{3}\right)\left(1 + \frac{x^2}{96}\right) \\ &\approx 2 - \frac{5x^2}{16} \end{align} This is indeed the correct second-order Taylor expansion of my function $f(x)$. Now I have a few questions about this whole process:

  1. As a physicist, I am used to calculating Taylor approximations like this and it always felt intuitive to me. However, now I suddenly realize it's not as trivial as I thought. My first and most important question is why does this even work in the first place?? The Taylor expansion is given by: $$ f(x) \approx f(0) + f'(0)x + \frac{f''(0)}{2}x^2 $$ We only used this formula for the basic expansions of $\sin{x}$, $\cos{x}$ and $(1 + x)^{\alpha}$, but we didn't compute $f$ or any of its derivatives at $x = 0$. It certainly looks like a nightmare to differentiate $f(x)$ even once, let alone twice. Besides, I still have to compute limits to get $f$ and its derivatives at $x = 0$, which I couldn't manage to do without the Taylor expansions to begin with. Why can I take a function and expand parts of it and then continue expanding by parts and making small steps until I get to the final result instead of going through Taylor's formula? The fact it just works honestly looks like magic to me.
  2. How do I know how many terms I need to keep for each part when expanding? In the beginning, I wanted to get a zeroth-order approximation of $f(x)$, but I had to use the first-order approximations of $\sin{x}$ and $(1 + x)^{\alpha}$ and the second-order approximation for $\cos{x}$. Later, when I tried to get the second-order approximation for $f(x)$, I had to use the second-order approximation of $\sqrt{1 + x}$, the 3rd order approximation of $\sin{x}$ and the 4th order approximation of $\cos{x}$. In the final step of the calculation, I only needed the first-order approximation of $\frac{1}{\sqrt{1 + x}}$ and not the second order. Is there a way to know how many terms I need to keep for each approximation? As you saw in the calculation, when I took too few terms of some approximations, I got a wrong answer, but I couldn't know it was wrong (As opposed to the zeroth order. If I took too few terms there, I'd quickly get zero in the numerator or denominator, signaling that something is wrong).
  3. Is there a meaning to the second calculation I made when I got $f(x) \approx 2 - \frac{x^2}{4}$? From my point of view, I still took correct approximations, so I should still get a good approximation for $f(x)$. It's not the Taylor approximation, but is this still good for something, or did I just get a garbage result?
  4. Is there a more formal or precise way to make these calculations to avoid wrong results like I got? As mentioned before, I am a physicist, but I am willing to learn and apply math properly, especially if it helps me make correct calculations and gives me insight or intuition for what I do. I am curious to know how a mathematician would make these calculations and if it could help me make similar calculations more easily and correctly.
Shai Avr
  • 129
  • 1
    Good question well written and well thought through. The answer to your last question 4 is "yes" but the theory is much too long for an answer here. You could start with the wikipedia page on Taylor's theorem, where there is information about estimating the remainder. – Ethan Bolker Dec 14 '24 at 13:19
  • 2
    I know you are looking for a general answer, but if you are interested, for this particular limit you may multiply and divide by $\sqrt{2 +\sqrt{2 + 2\cos(x)}} $ and apply the well-known limits of $\frac{\sin(x)}{x}$ and $\frac{1-\cos(x)}{x^2}$. Still, I saved your question because I find it helpful and I am looking forward to reading complete answers. – Davide Masi Dec 14 '24 at 13:56
  • @DavideMasi I can't believe I missed that. I actually tried to multiply and divide by the conjugate of the square root, but I didn't know what to do next. I got stuck in a loop trying to apply L'Hopital's rule. – Shai Avr Dec 14 '24 at 14:56
  • Glad it helped :) perhaps you could change the tags of your post to draw more attention to it (I guess "limits" would be more suitable than "physics" for your question) – Davide Masi Dec 14 '24 at 15:03
  • Don't know in physics, but in engineering is the lowest amount of terms as far as it works good enough. You see, any extra variable increases exponentially the amount of possible combinations of things that could go wrong. Also, Taylor expansions would limit solutions only to harmonics of the imput in my opinion. – Joako Dec 14 '24 at 20:45
  • One can not know in advance the number of terms (of Taylor series) required. Only when we do the calculations it becomes apparent whether a certain number of terms are sufficient or not. If your purpose is to evaluate a limit then it is better to do some combination of algebraic manipulation and well known limits to transform your expression under limit such that the calculations are simple enough to make the number of terms of Taylor series needed as obvious. – Paramanand Singh Dec 15 '24 at 08:01
  • For the current problem the expression $2+2\cos x$ can be written as $4\cos^2(x/2)$ and the denominator simplifies to $\sqrt{2(1-\cos(x/2))}=\sqrt{4\sin^2(x/4)} $ or $2\sin(x/4)$. – Paramanand Singh Dec 15 '24 at 08:04
  • My own experience with limit evaluation is that one rarely needs to use to L'Hospital or Taylor series in non-obvious ways during evaluation of any limit. In particular I have rarely found the need to multiply / divide / compose two Taylor series. A little algebra simplifies the problem considerably to avoid any gymnastics with Taylor series. – Paramanand Singh Dec 15 '24 at 08:07

1 Answers1

1

$$f(x) = \frac{\sin(x)}{\sqrt{2 - \sqrt{2 + 2\cos(x)}}}$$ Lok at the denominator and use (from inside) $$\cos(x)=1-\frac{x^2}{2}+\frac{x^4}{24}-\frac{x^ 6}{720}+O\left(x^8\right)$$ $$2+2\cos(x)=4-x^2+\frac{x^4}{12}-\frac{x^6}{360}+O \left(x^8\right)$$ $$\sqrt{2 + 2\cos(x)}=2-\frac{x^2}{4}+\frac{x^4}{192}-\frac{x ^6}{23040}+O\left(x^8\right)$$ $$2-\sqrt{2 + 2\cos(x)}=\frac{x^2}{4}-\frac{x^4}{192}+\frac{x^6}{23040}+O\left(x^8\right)$$

Assuming $x>0$ $$\sqrt{2 - \sqrt{2 + 2\cos(x)}}=\frac{x}{2}-\frac{x^3}{192}+\frac{x^5}{61440}+O\left(x^6\right)$$ Now, use the series expansion for the numerator to have $$f(x)=\frac {x-\frac{x^3}{6}+\frac{x^5}{120}+O\left( x^7\right) } {\frac{x}{2}-\frac{x^3}{192}+\frac{x^5}{61440}+O\left(x^6\right) }$$ Now, the long division to get $$f(x)=2-\frac{5 x^2}{16}+\frac{41x^4}{3072}+O\left(x^5\right)$$ which gives the limit and much more.

Suppose that you want to solve $f(x)=1$; the above truncated series gives $$x^2=\frac{32}{41}\left(15-\sqrt{102}\right)$$ that is to say $x=1.95570$ whle the solution is $1.94025$. This is a very good estimate for starting any root finding method.

Edit

For applications in physics, let $S_n$ be the expansion to $O(x^{2n+2})$ and suppose that we want to know $n$ for covering the range $0\leq x \leq \pi$.

Consider the infinite norm $$\Phi_n=\int_0^\pi \Big(f(x)-S_n \Big)^2\,dx$$ to be computed numerically

$$\left( \begin{array}{cc} n & \Phi_n \\ 1 & 4.3885\times 10^{-1} \\ 2 & 1.1552\times 10^{-2} \\ 3 & 9.1993\times 10^{-5} \\ 4 & 2.9281\times 10^{-7} \\ 5 & 4.4387\times 10^{-10} \\ 6 & 3.6072\times 10^{-13} \\ 7 & 1.7115\times 10^{-16} \\ \end{array} \right)$$

Bsed on that, make your decision; mine would be $n=5$.

  • It doesn't look like you have answered the main question of the post, which is "How do I know how many terms I need to keep for each part when expanding?" – Davide Masi Dec 14 '24 at 15:41
  • @DavideMasi. I agree that I did not answer. This is because I don't know the range you want to cover. I shall assume that it is from $0$ to $\pi$ and write something. – Claude Leibovici Dec 14 '24 at 15:52
  • @DavideMasi. My question is : what do you want to do withe the series ? Integration, inversion ? – Claude Leibovici Dec 14 '24 at 16:14
  • It was not me who posted this question, so I don't know. However, I think the OP mainly wants to know why it is possible to use the Taylor expansions of the functions appearing in $f$ separately to evaluate limits and then how to decide where to stop in the expansions – Davide Masi Dec 14 '24 at 16:26