# Using power series to evaluate the integral of a piecewise function

I was self-studying Calculus, and the book I'm using asked me to solve the following integral using the technique of integration of power series:

\int_{0}^{0.25} g(x)dx \text{ where } \begin{align} g(x) &= \begin{cases} \dfrac{\arctan(x)}{x} \text{, if x \neq 0} \\ 1 \text{, if x = 0}\end{cases}\end{align}

The book wants me to solve this integral using the following theorem for power series:

Theorem. Let $\sum_{n=0}^{+\infty}c_n x^n$ be a power series whose convergence radius is $R>0$. Then, if $f$ is the function defined by

$f(x)=\sum_{n=0}^{+\infty}c_n x^n$,

$f$ is integrable in every closed subinterval of $(-R,R)$, and the integral of $f$ is calculated by integrating the power series term by term; that is, if $x$ is in $(-R,R)$, then:

$$\int_{0}^{x} f(t) dt = \sum_{n=0}^{+\infty}\dfrac{c_n}{n+1} x^{n+1}$$

and $R$ is the convergence radius of the resulting series.

Let me show what I have so far:

To solve this integral, I will use the following series representation for $\arctan(x)$:

$$\arctan(x) = \sum_{n=0}^{+\infty} (-1)^n \dfrac{ x^{2n+1} } { 2n+1 } \text{ for |x| < 1}$$

($|x|<1$ means that the convergence interval of the series is $(-1,1)$, and the convergence radius is $1$.)

Therefore, the power series representation of $\dfrac{\arctan(x)}{x}$ will be:

$$\dfrac{\arctan(x)}{x} = \sum_{n=0}^{+\infty} (-1)^n \dfrac{ x^{2n} } { 2n+1 } \text{ for |x| < 1}$$

Substituting this representation for $\dfrac{\arctan(x)}{x}$ into the expression for $g(x)$:

\begin{align} g(x) &= \begin{cases} \sum_{n=0}^{+\infty} (-1)^n \dfrac{ x^{2n} } { 2n+1 } \text{, if x \neq 0 and |x| < 1} \\ 1 \text{, if x = 0}\end{cases}\end{align}

Considering that $g(x)$ has different formulas depending on whether $x\neq 0$ or $x=0$, the integral $\int_{0}^{0.25} g(x)dx$ is:

$$\int_{0}^{0.25} g(x)dx = \int_{0}^{0} 1 dx + \int_{0}^{0.25} \sum_{n=0}^{+\infty} (-1)^n \dfrac{ x^{2n} } { 2n+1 } dx$$

If I simply compute $\int_{0}^{0.25} g(x)dx$ as the integral from $0$ to $0.25$ of the power series by applying the theorem stated above (WITHOUT considering that the value of the series at $x=0$ should not be used):

$$\int_{0}^{0.25} g(x)dx = \int_{0}^{0.25} \sum_{n=0}^{+\infty} (-1)^n \dfrac{ x^{2n} } { 2n+1 } dx = \left[\sum_{n=0}^{+\infty} (-1)^n \dfrac{ x^{2n+1} } { (2n+1)^2 }\right]_0^{0.25}=\left(\sum_{n=0}^{+\infty} (-1)^n \dfrac{ (0.25)^{2n+1} } { (2n+1)^2 }\right)-0$$

If I calculate the approximated value of the resulting sum above, I find the correct result. But that doesn't seem right, because the value of the function $g(x)$ at $x=0$ is $1$, and not $\dfrac{\arctan(0)}{0}$, which doesn't exist.

EDIT: Based on the comment by André Nicolas below, I see now that the value of the power series at $x=0$ is $1$, which equals $g(0)$. Therefore, I could have defined $g(x)$ simply as:

$$g(x)=\sum_{n=0}^{+\infty} (-1)^n \dfrac{ x^{2n} } { 2n+1 }$$

without any need for a piecewise definition. In this case, the above calculation $\int_{0}^{0.25} g(x)dx$ is correct.

-
The power series is equal to your "piecewise" function at $0$, so there is no reason to worry. –  André Nicolas Nov 23 '12 at 19:58
@AndréNicolas: OK, I see. So, I could have defined $g(x)$ simply as the power series. I edited the original post to include this change. –  anonymous Nov 23 '12 at 20:19
Suppose we change the definition of $g(x)$ at $0$ to the silly $g(0)=-77$. That makes absolutely no change in any definite integral $\int_a^b g(x)\,dx$. –  André Nicolas Nov 23 '12 at 21:22