Besides expanding the integrand, is there some general method for solving indefinite integrals of the form $\int (f)^n \, \textrm dx$ where $f$ is a polynomial and $n$ is a positive integer? For example, $$\int (x^2 +x)^{100} \, \textrm dx?$$
$\int (f)^n \, \textrm dx$ where $f$ is a polynomial and $n$ is a positive integer
310 Views Asked by user694133 https://math.techqa.club/user/user694133/detail AtThere are 5 best solutions below
On
Most of the time, you can simplify your task by performing substitutions, integrating by parts, or manipulating expressions with elementary algebra.
If worst comes to worst, and things can't be handled with any clever tricks and manipulations, I suggest using the binomial theorem $$(a+b)^n=\sum_{k=0}^{n}\frac{n!}{k!(n-k)!}a^kb^{n-k},$$ or the more general multinomial theorem $$(x_1+x_2+...+x_m)^n=\sum_{k_1+k_2+...+k_m=n}{n\choose{k_1,k_2,...,k_m}}\prod_{r=1}^{m}x_r^{k_r},\tag{1}$$ where $${n\choose{k_1,k_2,...,k_m}}=\frac{n!}{k_1!k_2!\cdots k_m!}.$$ Note that the summation in $(1)$ runs over all integer $m$-tuples $(k_1,...,k_m)$, where $0\le k_i\le n$, and $\sum_ik_i=n$. See here for a proof.
Of course, this requires a lot of manual calculation if you want to get rid of some notation, but it does provide you with a viable method in the calculation of the integral of any polynomial raised to a non-negative integer power. Tell me if you were looking for anything other than this.
Beyond this, there isn't really anything else, because what we have is general enough to tackle any such power of a polynomial integral.
Addendum (10/13/2020):
If we write $x_j=a_jx^j$ and $p(x)=\sum_{j=0}^{m}a_jx^j$ we have $$p(x)^n=\sum_{k_1+...+k_m=n}x^{\sum_{r=1}^{m}rk_r}{n\choose {k_1,...,k_m}}\prod_{r=1}^{m}a_r^{k_r},$$ and hence $$\int p(x)^ndx=\text{constant}+\sum_{k_1+...+k_m=n}{n\choose{k_1,...,k_m}}\frac{\prod_{r=1}^{m}a_r^{k_r}}{1+\sum_{r=1}^mrk_r}x^{1+\sum_{r=1}^mrk_r}$$
On
Let’s say that $f(x)$ is a polynomial of degree $m$. Then $(f(x))^{n}$ is a polynomial of degree $mn$. Any polynomial of degree $mn$ can be written as the following:
$$ \begin{aligned} (f(x))^{n} &= \sum_{i=1}^{mn+1}{a_{i}x^{mn+1-i}}\\ \int{(f(x))^{n}\ dx}&= \sum_{i=1}^{mn+1}{\frac{a_{i}}{mn+2-i}x^{mn+2-1}}\ \ +C \end{aligned} $$
We now define:
$$ \begin{aligned} \{ A \}\ &,A_{i}=a{i}\\ \{ F \}\ &,F_{i}=(f(i))^{n}\\ [ K ]\ &,M_{i,j}=i^{mn+1-j}\\ \{ L \}\ &, L_{i}=\frac{1}{mn+2-i}i^{mn+2-i}\\ \end{aligned} $$
Therefore,
$$ \begin{aligned} \{A\}&=[K]^{-1}\{F\}\\ \\ \int{(f(x))^{n}\ dx}&=\{A\}\cdot\{L\}+C\\ &=\left([K]^{-1}\{F\}\right)\cdot\{L\}+C \end{aligned} $$
Maybe expanding the coefficient is less complicated after all. Or even better if substitution can make the integral simpler.
On
For a fixed polynomial function $f:I\to\Bbb C$ on an interval $I\subseteq \Bbb R$, and for integers $m,n\ge 0$, let $P^{m,n}_f$ be the polynomials defined by $$P_f^{m,0}(x)=\frac{1}{m!}x^{m},$$ $$P_f^{0,n}(x)=\big(f(x)\big)^n,$$ and for $m,n\ge 1$, $$P_f^{m,n}(x)=\sum\limits_{r=0}^\infty(-1)^r\binom{m+r-1}{r} P_f^{m+r,n-1}(x)\,f^{(r)}(x).$$ Here, $f^{(r)}$ denotes the $r$th derivative of $f$ (with the convention $f^{(0)}=f$). We also use the following two conventions for binomial coefficients:
- for integers $M$ and $N$, $\binom{M}{N}=0$ if $N>M\ge 0$, and
- $\binom{M}{0}=1$ for any integer $M$.
Thus for every integer $m,n\ge0$, \begin{align}P_f^{m,n}(x)&=\small\sum\limits_{r_1,r_2,\ldots,r_n\ge0}\left(\frac{(-1)^{\sum\limits_{j=1}^n r_j}}{\left(m+\sum\limits_{j=1}^nr_j\right)!} \prod\limits_{j=1}^n\binom{m+\sum\limits_{i=1}^jr_i-1}{r_j}\right)\left(x^{m+\sum\limits_{j=1}^nr_j}\prod\limits_{j=1}^nf^{(r_j)}(x)\right)\tag{1} \\&=\small\sum\limits_{r_1,r_2,\ldots,r_n\ge0}\frac{(-1)^{\sum\limits_{j=1}^n r_j}}{\left(m+\sum\limits_{j=1}^nr_j\right)\,(m-1)!\prod\limits_{j=1}^n r_j!} \left(x^{m+\sum\limits_{j=1}^nr_j}\prod\limits_{j=1}^nf^{(r_j)}(x)\right)\end{align} (with the conventions $\frac{1}{(m-1)!}=0$, $m\cdot (m-1)!=m!=1$, and $\left(\sum_{j=1}^nr_j\right)(m-1)!=0$ when $m=0$ and $r_1=r_2=\ldots=r_n=0$). In particular, \begin{align}P_f^{1,n}(x)&=\small\sum\limits_{r_1,r_2,\ldots,r_n\ge0}\left(\frac{(-1)^{\sum\limits_{j=1}^n r_j}}{\left(1+\sum\limits_{j=1}^nr_j\right)!}\prod\limits_{j=1}^n\binom{\sum\limits_{i=1}^jr_i}{r_j}\right)\left(x^{1+\sum\limits_{j=1}^nr_j}\prod\limits_{j=1}^nf^{(r_j)}(x)\right) \\&=\small\sum\limits_{r_1,r_2,\ldots,r_n\ge0}\frac{(-1)^{\sum\limits_{j=1}^n r_j}}{\left(1+\sum\limits_{j=1}^nr_j\right)\prod\limits_{j=1}^n r_j!} \left(x^{1+\sum\limits_{j=1}^nr_j}\prod\limits_{j=1}^nf^{(r_j)}(x)\right).\end{align}
Any $m$th anti-derivative of $\big(f(x)\big)^n$ is given by $P_f^{m,n}(x)+\sum\limits_{s=0}^{m-1}C_sx^s$ where $C_0,C_1,\ldots,C_{m-1}$ are constants. The polynomial $P_f^{m,n}(x)$ is the unique $m$th anti-derivative of $\big(f(x)\big)^n$ which has $x^m$ as a factor. In particular, a ($1$st) anti-derivative of $f^m$ is $P_f^{1,n}(x)+C$ for some constant $C$, and $P_f^{1,n}(x)$ has $x$ as a factor. More specifically, the formula for $P_f^{1,1}$ shows that $$\int f(x) dx=\sum\limits_{r=0}^\infty \frac{(-1)^r}{(1+r)!} x^{1+r}f^{(r)}(x) +C$$ for some constant $C$. Likewise, \begin{align}\int\big(f(x)\big)^2 dx&=\sum\limits_{r_1,r_2\ge 0}\frac{(-1)^{r_1+r_2}}{(1+r_1+r_2)!}\binom{r_1+r_2}{r_2}x^{1+r_1+r_2}f^{(r_1)}(x)f^{(r_2)}(x)+C \\&=\sum\limits_{r_1>r_2\ge 0} \frac{2\cdot (-1)^{r_1+r_2}}{(1+r_1+r_2)!}\binom{r_1+r_2}{r_2}x^{1+r_1+r_2}f^{(r_1)}(x)f^{(r_2)}(x)\\&\;\;\;\;\;\;\;\;\;\;+\sum\limits_{r=0}^\infty\frac{1}{(1+2r)!}\binom{2r}{r}x^{1+2r}\big(f^{(r)}(x)\big)^2+C.\end{align}
If $\deg f=1$, then it follows that $$\int \big(f(x)\big)^n dx=\sum_{s=0}^n\frac{(-1)^{s}}{1+s}\binom{n}{s}x^{1+s}\big(f(x)\big)^{n-s}\big(f'(x)\big)^{s}+C=\frac{\big(f(x)\big)^{n+1}}{(n+1)f'(x)}+C',$$ where $C'=C-\frac{\big(f(x)-xf'(x)\big)^{n+1}}{(n+1)f'(x)}$. If $\deg f=2$, then it follows that $$\int \big(f(x)\big)^n dx=\small\sum_{\substack{s_1,s_2\ge0\\s_1+s_2\le n}}\frac{(-1)^{s_1}n!}{2^{s_2}(1+s_1+2s_2)\,s_1!s_2!(n-s_1-s_2)!}x^{1+s_1+2s_2}\big(f(x)\big)^{n-s_1-s_2}\big(f'(x)\big)^{s_1}\big(f''(x)\big)^{s_2}+C.$$ There are $\binom{n+2}{2}=\frac{(n+1)(n+2)}{2}$ pairs $(s_1,s_2)$ to deal with. For example, when $n=100$ and $f(x)=x^2+x=x(x+1)$, we have $f'(x)=2x+1$ and $f''(x)=2$, so \begin{align}\int \big(x^2+x\big)^{100} dx&=\small100!x^{101}\sum_{\substack{s_1,s_2\ge0\\s_1+s_2\le 100}}\frac{(-1)^{s_1}}{(1+s_1+2s_2)\,s_1!s_2!(100-s_1-s_2)!}x^{s_2}\big(x+1\big)^{100-s_1-s_2}\big(2x+1\big)^{s_1}+C \\&=\small 100!x^{101}\sum_{t=0}^{100}\frac{1}{(100-t)!}(x+1)^{100-t}\sum_{s=0}^t \frac{(-1)^s}{(1+2t-s)\,s!(t-s)!}x^{t-s}(2x+1)^s+C.\end{align} If $\deg f=\ell$, then $$\int \big(f(x)\big)^ndx=\small\sum_{\substack{s_1,s_2,\ldots,s_\ell\ge 0\\s_1+s_2+\ldots+s_\ell \le n}}\frac{(-1)^{\sum\limits_{j=1}^{\lceil \ell/2\rceil}s_{2j-1}}n!}{\left(1+\sum\limits_{j=1}^\ell js_j\right)\,\left(n-\sum\limits_{j=1}^\ell s_j\right)!\,\prod_{j=1}^\ell \Big(s_j!(j!)^{s_j}\Big)}x^{1+\sum\limits_{j=1}^\ell js_j}\big(f(x)\big)^{n-\sum\limits_{j=1}^\ell s_j}\prod_{j=1}^\ell \big(f^{(j)}(x)\big)^{s_j}$$
More generally, suppose that $f_1,f_2,\ldots,f_n:I\to\Bbb C$ are polynomial functions. Define \begin{align}P_{f_1,f_2,\ldots,f_n}^m(x)&=\small\sum\limits_{r_1,r_2,\ldots,r_n\ge 0}\left(\frac{(-1)^{\sum\limits_{j=1}^n r_j}}{\left(m+\sum\limits_{j=1}^nr_j\right)!}\prod\limits_{j=1}^n\binom{m+\sum\limits_{i=1}^jr_i-1}{r_j}\right)\left(x^{m+\sum\limits_{j=1}^nr_j}\prod\limits_{j=1}^nf_j^{(r_j)}(x)\right)\tag{2} \\&=\small\sum\limits_{r_1,r_2,\ldots,r_n\ge 0}\frac{(-1)^{\sum\limits_{j=1}^n r_j}}{\left(m+\sum\limits_{j=1}^nr_j\right)\,(m-1)!\prod\limits_{j=1}^n r_j!} \left(x^{m+\sum\limits_{j=1}^nr_j}\prod\limits_{j=1}^nf_j^{(r_j)}(x)\right).\end{align} Then $P_{f_1,f_2,\ldots,f_n}^m(x)$ is the unique $m$th derivative of the product $\prod\limits_{j=1}^n f_j(x)$ which is divisible by $x^m$. We use the convention $$P^m(x)=\frac{1}{m!}x^m$$ when $n=0$ (as the empty product is conventionally defined to be $1$).
Interestingly, this result also shows that $$\sum\limits_{r=0}^n\frac{(-1)^r}{m+r}\binom{n}{r}=\frac{(m-1)!n!}{(m+n)!}=\frac{1}{m\binom{m+n}{n}}.$$ This is done by selecting $f(x)=x$, and noting that $P_f^{m,n}(x)$ must equal $\frac{n!}{(m+n)!}x^{m+n}$.
The synthesis of $(1)$ and $(2)$ utilizes the fact that $$\int f_0(x)g_0(x) dx=\left(\sum\limits_{r=0}^\infty (-1)^rf_{1+r}(x) g_{-r}(x)\right)+C\tag{3}$$ for some constant $C$, if $f_k,g_k:I\to\Bbb C$ are polynomial functions such that $f_k'=f_{k-1}$ and $g_k'=g_{k-1}$. The fact $(3)$ can be derived using multiple instances of integration by parts.
Here is the proof that $(1)$ and $(2)$ are $m$th anti-derivative of $\big(f(x)\big)^n$ and $\prod\limits_{j=1}^n f_j(x)$, respectively. This is not a synthetic proof (I am not writing that because my synthetic proof is actually longer and more complicated). That is, the polynomials $P^m_{f_1,f_2,\ldots,f_n}$ are not being constructed. If you want a construction, you need to apply $(3)$ inductively.
It suffices to show that $P_{f_1,f_2,\ldots,f_n}^m(x)$ is the unique $m$th anti-derivative of $\prod\limits_{j=1}^n f_j(x)$ that is divisible by $x^m$. Divisibility by $x^m$ is obvious. We will prove the rest by induction on $n$. The base case $n=0$ is trivial.
We need another base case $n=1$. That is, we need to show that $$P_f^m(x)=\sum_{r=0}^\infty \frac{(-1)^r}{(m+r)!}\binom{m+r-1}{r}x^{m+r}f^{(r)}(x)$$ is an $m$th anti-derivative of $f(x)$. By taking derivative of $P_f^m(x)$ w.r.t. $x$, we get \begin{align}(P_f^m)'(x)&=\sum_{r=0}^\infty\frac{(-1)^r}{(m+r)!}\binom{m+r-1}{r}\Big((m+r)x^{m+r-1}f^{(r)}(x)+x^{m+r}f^{(r+1)}(x)\Big) \\&=\sum_{r=0}^\infty \frac{(-1)^r}{(m-1+r)!}\left(\binom{m+r-1}{r}-\binom{m+(r-1)-1}{r-1}\right)x^{m-1+r}f^{(r)}(x). \end{align} However \begin{align}\binom{m+r-1}{r}-\binom{m+(r-1)-1}{r-1}&=\binom{m+r-1}{r}-\binom{m+r-2}{r-1}\\&=\binom{m+r-2}{r}=\binom{(m-1)+r-1}{r}.\end{align} This means $(P_f^m)'=P_f^{m-1}$. As $P_f^0=f$, we conclude that $P_f^m$ is an $m$th anti-derivative of $f$.
Suppose the claim holds for $n=\nu-1$ for some integer $\nu>1$. We want to show that it is true for $n=\nu$. Let $f_j'(x)=f_j(x)$ for $j=1,2,\ldots,\nu-2$ and $f'_{\nu-1}(x)=f_{\nu-1}(x)f_\nu(x)$. By induction hypothesis $P_{f'_1,f'_2,\ldots,f'_{\nu-1}}^{m}(x)$ is an $m$th anti-derivative of $$\prod\limits_{j=1}^{\nu-1}f'_j(x)=\prod\limits_{j=1}^\nu f_j(x).$$ However, from $(2)$, we have $$P_{f'_1,f'_2,\ldots,f'_{\nu-1}}^{m}(x)=\small\sum\limits_{r'_1,r'_2,\ldots,r'_{\nu-1}\ge0}\left(\frac{(-1)^{\sum\limits_{j=1}^{\nu-1} r'_j}}{\left(m+\sum\limits_{j=1}^{\nu-1}r'_j\right)!}\prod\limits_{j=1}^{\nu-1}\binom{m+\sum\limits_{i=1}^jr'_i-1}{r_j}\right)\left(x^{m+\sum\limits_{j=1}^{\nu-1}r'_j}\prod\limits_{j=1}^{\nu-1}(f_j')^{(r'_j)}(x)\right).$$ Note that $$\left(f_{\nu-1}'\right)^{(r'_{\nu-1})}=\left(f_{\nu-1}f_{\nu}\right)^{(r'_{\nu-1})}=\sum\limits_{r_{\nu-1}=0}^{r'_{\nu-1}}\binom{r'_{\nu-1}}{r_{\nu-1}}f^{(r_{\nu-1})}_{\nu-1}f_{\nu}^{(r'_{\nu-1}-r_{\nu-1})}.$$ Therefore, if $r_j=r'_j$ for $j=1,2,\ldots,\nu-2$ and $r_\nu=r'_{\nu-1}-r_{\nu-1}$, then $$\small P_{f'_1,f'_2,\ldots,f'_{\nu-1}}^{m}(x)=\small\sum\limits_{r_1,r_2,\ldots,r_\nu\ge0}\left(\frac{(-1)^{\sum\limits_{j=1}^\nu r_j}}{\left(m+\sum\limits_{j=1}^\nu r_j\right)!}\binom{m+\sum\limits_{i=1}^{\nu}r_i-1}{r'_{\nu-1}}\binom{r_{\nu-1}'}{r_{\nu-1}}\prod\limits_{j=1}^{\nu-2}\binom{m+\sum\limits_{i=1}^jr_i-1}{r_j}\right)\left(x^{m+\sum\limits_{j=1}^nr_j}\prod\limits_{j=1}^nf_j^{(r_j)}(x)\right)$$ but \begin{align}\binom{m+\sum\limits_{i=1}^{\nu}r_i-1}{r'_{\nu-1}}\binom{r_{\nu-1}'}{r_{\nu-1}} &=\binom{m+\sum\limits_{i=1}^{\nu}r_i-1}{r_{\nu-1}+r_\nu}\binom{r_{\nu-1}+r_{\nu}}{r_{\nu-1}} \\&=\binom{m+\sum\limits_{i=1}^{\nu}r_i-1}{r_{\nu-1}+r_\nu}\binom{r_{\nu-1}+r_{\nu}}{r_{\nu}} \\&=\binom{m+\sum\limits_{i=1}^{\nu}r_i-1}{r_\nu}\binom{\left(m+\sum\limits_{i=1}^{\nu}r_i-1\right)-r_\nu}{(r_{\nu-1}+r_\nu)-r_\nu} \\&=\binom{m+\sum\limits_{i=1}^{\nu}r_i-1}{r_\nu}\binom{m+\sum\limits_{i=1}^{\nu-1}r_i-1}{r_{\nu-1}}.\end{align} Therefore $P^{m}_{f_1',f_2',\ldots,f'_{\nu-1}}(x)=P^m_{f_1,f_2,\ldots,f_\nu}(x)$. Hence $P^m_{f_1,f_2,\ldots,f_\nu}(x)$ is an $m$th anti-derivative of $\prod\limits_{j=1}^\nu f_j(x)$. The proof is now complete.
On
Expanding on clathratus' answer using the multinomial theorem, you have an explicit formula for the integral as (ignoring the constant of integration)
$$\begin{align} \int_{ }^{ }\left(\sum_{r=0}^{m}a_{r}x^{r}\right)^{n}\,\mathrm{d}x &=\int_{ }^{ }\sum_{k_{1}+k_{2}+..+k_{m}=n}^{ }{n\choose{k_1,k_2,...,k_m}}\prod_{r=1}^{m}\left(a_{r}x^{r}\right)^{k_{r}}\,\mathrm{d}x \\ \\ &=\sum_{k_{1}+k_{2}+...+k_{m}=n}^{ }\frac{{n\choose{k_1,k_2,...,k_m}}\prod_{r=1}^{m}\left(a_{r}\right)^{k_{r}}}{1+\sum_{r=1}^{m}rk_{r}}\cdot x^{\left(1+\sum_{r=1}^{m}rk_{r}\right)} \end{align}$$
where $a_r$ are the polynomial's coefficients, where $\displaystyle {n\choose{k_1,k_2,...,k_m}}$ is a multinomial coefficient, and where the sum is taken over all $m$-tuples of nonnegative integers, $k_i$, that satisfy $k_{1}+k_{2}+...+k_{m}=n$. This provides both an explicit formula and an algorithm but for many cases will be woefully inefficient. More efficient algorithms are presumably possible if you exploit properties of the integrand polynomial such as its factors. This also reflects how you, as a human, should approach the problem. Find the qualities of the polynomial you can use - don't just mechanically substitute it into a formula.
To perform the method, the terms, $k_r$, can be generated via a stars and bars method, e.g., in your case of $n=100$ and $m=2$ (corresponding to $3$ terms, including $x^0$), you would systematically place $(3-1)$ bars between $100$ stars:
$$ \begin{array}{|l|l|} \hline \text{Stars and bars}&(k_r)_{1\le r\le 3}\\ \hline **\ldots *|| & (100,0,0)\\ \hline **\ldots *|*| & (99,1,0)\\ \hline **\ldots *|**| & (98,2,0)\\ \hline \ldots & \ldots\\ \hline *\ldots *|*\ldots*|*\ldots * & (34,33,33)\\ \hline \ldots & \ldots\\ \hline |*|*\ldots * & (0,1,99)\\ \hline ||**\ldots * & (0,0,100)\\ \hline \end{array}$$
Considering the number of multinomial coefficients, we can see that for an $m$-degree polynomial raised to the power $n$, there are $\displaystyle{\binom{n+(m+1)-1}{(m+1)-1}}$ unsimplified terms as there are $(m+1)$ terms in the polynomial. If we don't improve our algorithm to ignore coefficients of $0$ or to factor $x$, this gives a whopping $5151$ terms for $(m,n)=(2,100)$. Thus, your example would have:
$$\begin{align} \int_{ }^{ }\left(x^2+x+0\right)^{100}\,\mathrm{d}x &=\frac{{100\choose{\color{red}{100},\color{blue}{0},\color{green}{0}}}\cdot\left(0^{\color{red}{100}}\cdot1^{\color{blue}{0}}\cdot1^{\color{green}{0}}\right)}{\left(1+1\cdot\color{red}{100}+2\cdot\color{blue}{0}+2\cdot\color{green}{0}\right)}\cdot x^{\left(1+1\cdot\color{red}{100}+2\cdot\color{blue}{0}+2\cdot\color{green}{0}\right)} \\ &+\frac{{100\choose{\color{red}{99},\color{blue}{1},\color{green}{0}}}\cdot\left(0^{\color{red}{99}}\cdot1^{\color{blue}{1}}\cdot1^{\color{green}{0}}\right)}{\left(1+1\cdot\color{red}{99}+2\cdot\color{blue}{1}+2\cdot\color{green}{0}\right)}\cdot x^{\left(1+1\cdot\color{red}{99}+2\cdot\color{blue}{1}+2\cdot\color{green}{0}\right)} \\ &+\ldots+\frac{{100\choose{\color{red}{0},\color{blue}{0},\color{green}{100}}}\cdot\left(0^{\color{red}{0}}\cdot1^{\color{blue}{0}}\cdot1^{\color{green}{100}}\right)}{\left(1+1\cdot\color{red}{0}+2\cdot\color{blue}{0}+2\cdot\color{green}{100}\right)}\cdot x^{\left(1+1\cdot\color{red}{0}+2\cdot\color{blue}{0}+2\cdot\color{green}{100}\right)} \\ &=0+0+\ldots+\frac{x^{3}}{3}+\frac{x^{2}}{2} \end{align}$$
$\int(x^2+x)^{100}~dx$
$=\int x^{100}(x+1)^{100}~dx$
$=\int x^{100}\sum\limits_{n=0}^{100}C_n^{100}x^n~dx$
$=\int\sum\limits_{n=0}^{100}C_n^{100}x^{n+100}~dx$
$=\sum\limits_{n=0}^{100}\dfrac{C_n^{100}x^{n+101}}{n+101}+C$