First four nonzero terms of the McLaurin expansion of $\frac{xe^x}{\sin x}$ at $x_0=0$

Define if necessary the given function so as to be continuous at $x_0=0$ and find the first four nonzero terms of its MacLaurin series. $$\frac{xe^x}{\sin x}$$

Given $f(x)= \frac{h(x)}{g(x)}$ where $h(x)= xe^x$, and $g(x)=\sin x$

We have the following MacLaurin series $$f(x) = \sum_{n=0}^{\infty} a_n x^n = a_0 + a_1 x +a_2 x^2 + a_3 x^3 +a_4 x^4 + ...$$ $$g(x) = \sum_{n=0}^{\infty} b_n x^n = 0 + x+ 0 -\frac{1}{6} x^3 + 0 + \frac{1}{120} x^5 +...$$ $$h(x) = xe^x = \sum_{n=0}^{\infty} c_n x^n = \sum_{n=0}^{\infty} \frac{n}{(n)!}x^n = 0 + x + x^2 + \frac{1}{2} x^3 + \frac{1}{6} x^4 + \frac{1}{24} x^5$$ .

The Maclaurin coefficients of $f(x)g(x)$ $$c_0 = a_0b_0 = 0$$ $$c_1 = a_0b_1 + a_1b_0 = a_0$$ $$c_2 = a_0b_2 + a_1b_1 +a_2b_0 = a_1$$ $$c_3 = a_0b_3 +\cdots a_3b_0 = - \frac{1}{6} a_0 + a_2$$ $$c_4 = a_0b_4 +\cdots + a_4b_0 = - \frac{1}{6} a_1 + a_3$$ $$\implies f(x)g(x) = a_0 x^1 + a_1 x^2 + \left( - \frac{1}{6} a_0 + a_2\right)x^3 + \left(- \frac{1}{6} a_1 + a_3\right) x^4 + \cdots$$

.

Equating coefficients of $f(x)g(x)$ with coefficients of $h(x)$ $$c_0 = 0$$ $$c_1 = a_0 = 1$$ $$c_2 = a_1 = 1$$ $$c_3 = - \frac{1}{6} a_0 + a_2 = 1/2 \implies a_2 = 2/3$$ $$c_4 = - \frac{1}{6} a_1 + a_3 = 1/6 \implies a_3 = 1/3$$ .

it follows that the first 4 nonzero terms are: $$f(x) = \frac{x e^x}{\sin(x)} = 1 + x + \frac{2}{3} x^2 + \frac{1}{3} x^3$$

.

I would like to know if I am going in the right direction?

My main question regards the original question "Define if necessary the given function so as to be continuous at $x_0=0$" . I am not sure how to handle this question, if a definition is needed how? and why? if a definition is not needed how? and why?

• The definition $$f(0)=1$$ is definitely needed. – Did Aug 17 '17 at 11:43
• Because $\lim_{x\to 0} \, \dfrac{x}{\sin (x)}=1$ you need to define $f(0)=1$ to have continuity – Raffaele Aug 17 '17 at 19:13
As for the other question, note that the expression $\frac{xe^x}{\sin x}$ is undefined if $x=0$. In order to make $f$ continuous at $0$; you must define $f(0)$ as $\lim_{x\to0}\frac{xe^x}{\sin x}$, which is equal to $1$.
I think that your expansion is partially incorrect. After setting $f(0)=1$, note that for $x\not=0$, \begin{align*} f(x)=\frac{x e^x}{\sin(x)}&=x \left(1+x+\frac{x^2}{2}+\frac{x^3}{6}+o(x^3)\right)\left(x-\frac{x^3}{6}+o(x^4)\right)^{-1}\\ &=\left(1+x+\frac{x^2}{2}+\frac{x^3}{6}+o(x^3)\right)\left(1-\frac{x^2}{6}+o(x^3)\right)^{-1}\\ &=\left(1+x+\frac{x^2}{2}+\frac{x^3}{6}+o(x^3)\right) \cdot\left(1+\frac{x^2}{6}+o(x^3)\right)\\ &=\left(1+x+\frac{x^2}{2}+\frac{x^3}{6}+o(x^3)\right)\left(1+\frac{x^2}{6}+o(x^3)\right)\\ &=1+x+\frac{x^2}{2}+\frac{x^3}{6} +\frac{x^2}{6}+\frac{x^3}{6}+o(x^3)\\ &=1+x+\frac{2x^2}{3}+\frac{x^3}{3}+o(x^3) \end{align*} where we used the fact that $$(1-z)^{-1}=1+z+z^2+o(z^2).$$