# Maclaurin Series Terms and Convergence or Divergence

This is one of the HW questions I'm trying to solve

Find the first four terms of this Maclaurin Series of $$f(x)=\cos\left(\frac{x}{x+1}\right)$$

I tried using $$\sum_{n=0}^\infty (-1)^n \frac{x^{2n}}{2n!} = \cos x$$ and $$\sum_{n=0}^\infty (-1)^n x^n= \frac{1}{1+x}$$ but no luck! I can't properly substitute the derivative of the series in the Maclaurin Series.

Also related to this question is its second part$$\sum_{} (n)^p (\cos (\frac{1}{n-1})-\cos(\frac{1}{n})$$ for what values of $$p$$ it converges or diverges.

I would really appreciate it if someone could type in a detailed solution so I can improve my understanding of this topic.

There's only one sensible way to find such expansions (and I guess it's the way Mathematica or Wolfram Alpha do it): Let $$c(x)=\cos\left(\frac{x}{x+1}\right)=c_0+c_1\,x+c_2\,x^2+c_3\,x^3+\ldots\tag1$$ and $$s(x)=\sin\left(\frac{x}{x+1}\right)=s_0+s_1\,x+s_2\,x^2+s_3\,x^3+\ldots\tag2$$ Obviously, $$c_0=c(0)=1$$ and $$s_0=s(0)=0$$. Differentiating (1) and (2), we find $$c'(x)=-\frac1{(1+x)^2}\,s(x)\tag3$$ and $$s'(x)=\frac1{(1+x)^2}\,c(x)\tag4.$$ Since $$\frac1{(1+x)^2}=1-2\,x+3\,x^2-4\,x^3+\ldots,$$ (3) and (4) become $$c_1+2\,c_2\,x+3\,c_3\,x^2+\ldots=-(1-2\,x+3\,x^2-\ldots)(s_0+s_1\,x+s_2\,x^2+\ldots)\tag5$$ and $$s_1+2\,s_2\,x+3\,s_3\,x^2+\ldots=(1-2\,x+3\,x^2-\ldots)(c_0+c_1\,x+c_2\,x^2+\ldots)\tag6.$$ Comparing coefficients in (5) and (6), we obtain $$c_1=-s_0$$, $$2\,c_2=-s_1+2\,s_0$$, $$3\,c_3=-s_2+2\,s_1-3\,s_0, \ldots$$ and $$s_1=c_0$$, $$2\,s_2=c_1-2\,c_0$$, $$3\,s_3=c_2-2\,c_1+3\,c_0, \ldots$$, giving successively $$c_1=0, s_1=1\to c_2=-\frac12, s_2=-1\to c_3=-1,\ldots$$ It's simple to obtain $$c(x)=1-\frac12\,x^2+x^3+\ldots,\tag7$$ (and quite a few more terms, if necessary) this way. But (7) is sufficient for the second part of the question, because $$\cos\left(\frac1{n-1}\right)=\cos\left(-\frac1{n-1}\right)=c\left(-\frac1n\right)=1-\frac1{2n^2}-\frac1{n^3}+\ldots$$

HINTS

The route you want to go notes that if $$g(x) = \frac{x}{x+1}$$, then $$f(x) = \cos(g(x))$$ and expansion into series gives $$f(x) = \cos(g(x)) = \sum_{n=0}^\infty(-1)^n \frac{g(x)^{2n}}{(2n)!} = \sum_{n=0}^\infty \frac{(-1)^n}{(2n)!} \left(\sum_{m=0}^\infty (-1)^mx^m \right)^{2n},$$ which is very messy to deal with.

You are better off writing the first four terms using the definition, i.e. compute $$f'(x), f''(x)$$ and $$f'''(x)$$ and evaluate at $$0$$. You may find it helpful to write $$g(x) = 1 - \frac{1}{x+1}$$.

As for the second part, note that what governs the conergence of the sum is what happens when $$n$$ is large, in which case $$\frac{1}{n}$$ and $$\frac{1}{n-1}$$ become very small. Can you use the Maclaurin series to expand the cosine around zero and approximate the cosine using the expansion which includes the first meaningful term which depends on $$n$$?

Happy to guide you further if you post progress on these in the comments below.

UPDATE

Your first attempt is correct, you can see Wolfram Alpha computes the Maclaurin series to be $$\cos \left(\frac{x}{x+1}\right) = 1 - \frac{x^2}{2} + x^3 - \frac{35}{24} x^4 + \frac{11}{6} x^5 + \mathcal{O}\left(x^6\right)$$

As for the second part, note that for small $$x$$ we have $$\cos x \approx 1 - \frac{x^2}{2}$$ so $$\cos(1/n) = 1 - n^2/2$$ and you can find $$\cos(\frac1{n-1})$$ similarly and subtract, then finding the limit of the difference as $$n \to \infty$$.

• Ok, so I did part 1 using a derivative calculator and the definition of the Maclaurin series. I know these are lengthy derivatives that will take ages to solve but I'm just trying to learn the concept. However, in part two how can I use these first 4 non-zero terms to solve it... These are the terms: $$1 - \frac{x^2}{2} + x^3 - \frac{35}{24}x^4...$$ Is it because it forms a telescoping series? Mar 5, 2021 at 16:06
• @AhsonYousef interesting idea about telescoping series but $\cos(\cdot)$ in the front prevents it from being useful. Please see update for the follow-up hint. Can you finish this now? Mar 5, 2021 at 20:52