# Homework Help: Question about deriving Maclaurin Series

1. Jun 2, 2015

### Potatochip911

1. The problem statement, all variables and given/known data
As I've been going through examples in my textbook they are becoming increasingly lengthy to compute and thus I have resorted to using software to complete the task. For example when computing the series for $\sin{(\ln{(1+x)})}$ $$\ln{(1+x)}=x-\frac{x^2}{2}+\frac{x^3}{3}-\frac{x^4}{4}+... \\ \sin{x}=x-\frac{x^3}{3!}+\frac{x^5}{5!}+... \\ \sin{(\ln{(1+x)})}=\sin{(x-\frac{x^2}{2}+\frac{x^3}{3}-\frac{x^4}{4})}\\ =(x-\frac{x^2}{2}+\frac{x^3}{3}-\frac{x^4}{4})-\frac{(x-\frac{x^2}{2}+\frac{x^3}{3}-\frac{x^4}{4})^3}{3!}+\frac{(x-\frac{x^2}{2}+\frac{x^3}{3}-\frac{x^4}{4})^5}{5!}$$

2. Relevant equations
3. The attempt at a solution

This would take a ridiculously long time to calculate by hand (for me at least) and I was just curious as to whether or not it's normal to encounter difficult expressions to evaluate by hand when finding Maclaurin series.

2. Jun 2, 2015

### MarcusAgrippa

The reason for setting problems like this is to familiarise you with the math and to help you to develop skill in computation. To use software at this stage of the game is counterproductive.

In your problem, you should have recognised that you need to find the series for sin x and the series for ln(1+x), and that you can get the final series by substituting one into the other, as was done above. No software is necessary for this. You have however missed a step: the final series should have the form $a_0 + a_1 x + a_2 x^2 + \cdots$.

In a test or exam, you would be required (unless stated otherwise) to derive the series for sin x and for ln(1+x).

The object of these exercises is 1. to develop skills, thinking and calculational; 2. to impress the theory into your mind by means of concrete examples; 3. to add to your repertoire of basic information that any professional must have if he is to practice his profession. In this case, you should make a point of memorising the power series for sin x and ln(1+x), and for other elementary functions. These basic series will allow you to calculate the series for more complicated examples.

Do not use software for solving your homework problems. It defeats the object of the exercise and is counter productive.

3. Jun 2, 2015

### Potatochip911

I probably should have worded my question differently, I am doing everything in the problem up until the last part I left up there, at that stage I am then plugging it into the software to expand the function.

4. Jun 2, 2015

### PeroK

It shouldn't take very long to expand the series by hand up to terms in $x^4$ or $x^5$.

5. Jun 2, 2015

### Ray Vickson

In this case, the direct approach is easier than you may imagine. Let $f(x) = \sin(\ln(x+1))$ and $g(x) = \cos(\ln(x+1))$. Then we have
$$f'(x) = \frac{g(x)}{x+1}\\ f''(x) = \frac{-f(x)-g(x)}{(x+1)^2} \\ f'''(x) = \frac{g(x) + 3 f(x)}{(x+1)^3}\\ f^{(4)}(x) = \frac{-10 f(x)}{(x+1)^4} \\ \vdots$$
and so forth. So, getting a general formula for the $n$th derivative $f^{(n)}(x)$ should not be too hard. From that you can quite easily get the Maclaurin series
$$f(0) + f'(0) x + \frac{1}{2!} f''(0) x^2 + \frac{1}{3!} f'''(0) x^3 + \cdots \\$$

6. Jun 2, 2015

### vela

Staff Emeritus
You're probably thinking of truncating the series for log after a few terms, multiplying everything out, and then adding them together, right? If you did that, it would be quite tedious and long. Instead, calculate each term one by one, identifying where all the different contributions come from. For example, consider the $x^4$ term. The third term in the expansion of sin (log series) is
$$\frac{1}{5!} \left(x - \frac{x^2}{2} + \frac{x^3}{3} - \frac{x^4}{4} + \cdots \right)^5 = \frac{x^5}{5!} \left(1 - \frac{x}{2} + \frac{x^2}{3} -\frac{x^3}{4} + \cdots\right)^5.$$ From this, you can see that this term will contribute only terms of $x^5$ and higher, so for the $x^4$ term, we can ignore it.

The second term is
$$-\frac{x^3}{3!} \left(1 - \frac{x}{2} + \frac{x^2}{3} -\frac{x^3}{4} + \cdots\right)^3,$$ so it will contribute terms of order $x^3$ and higher. For the $x^4$ term specifically, it comes from the product of $x^3$ and the linear term in the expansion of $(1-x/2+x^2/3-\cdots)^3$, which you can determine using the binomial expansion. The contribution to the $x^4$ term is therefore $-\frac{1}{3!} x^3 \times (-\frac 32 x) = \frac 14 x^4$. When you combine this result with the $x^4$ term from the first term in the sin expansion, you see the $x^4$ term vanishes.

It gets more complicated as you go to higher-order terms, but to figure out the first few terms of the expansion, it's not too bad.

7. Jun 2, 2015

### Potatochip911

If we are only getting terms with a degree less than or equal to 5 isn't it easier to quickly derive $$(ax+bx^2+cx^3+dx^4)^3=(3(a^2c+ab^2))x^5+(3a^2b)x^4+a^3x^3$$ which gives all the terms with a degree of 5 or less.

8. Jun 2, 2015

### vela

Staff Emeritus
Try it and find out. As Marcus says above, one of the reasons for this type of problem is to develop your skills in doing these types of calculations.

9. Jun 2, 2015

### Ray Vickson

It would be quicker to use the method in Post #5. With $f(x) = \sin(\ln(x+1))$ and $g(x) = \cos(\ln(x+1))$ we have the $n$th derivative of $f$ as
$$f^{(n)}(x) = \frac{A_n f(x) + B_n g(x)}{(x+1)^n},$$
where $A_n, B_n$ are constants and $A_1 = 0, B_1 = 1$. It follows easily that the $A, B$ obey a simple recursion scheme:
$$A_{n+1} = -n A_n - B_n, \; \; B_{n+1} = A_n - n B_n$$
Using this, we can easily and quickly get $f^{(n)}(0) = B_n$ for $n$ up to 10 or more with little effort (although the magnitudes of $A,B$ grow large quickly as $n$ increases, so a calculator becomes a necessity). You can keep the numerical growth under control by looking instead at $\alpha_n = A_n / n!$ and $\beta_n = B_n / n!$. These satisfy
$$\alpha_{n+1} = -\frac{n}{n+1} \alpha_n - \frac{1}{n+1} \beta_n, \;\; \beta_{n+1} = \frac{1}{n+1} \alpha_n - \frac{n}{n+1} \beta_n,$$
with $\alpha_1 = 0, \beta_1 = 1$. The quantity $\beta_n$ is the coefficient of $x^n$ in the Maclaurin expansion of $f$. Thus, getting directly the first 10 or so terms of the Maclaurin expansion is relatively straightforward.