Integrating Polynomials

Integrating Polynomials#

When we are differentiating \(x^n\), we multiply by \(n\) and then reduce the power on \(x\) by 1. When integrating, we do the opposite, we add 1 to the power and then divide by this new power. In general, we have the rule:

\[ \int n^n\;dx = \frac{x^{n+1}}{n+1} + C \]

Example

Find the integrals of the following:

  1. \(x^2\)

  2. \(2x+6x^2\)

  3. \(x(x+3)\)

Solution:

  1. We are being asked to find \(\int x^2\;dx\), so using the rule \(\int n^n\;dx = \frac{x^{n+1}}{n+1} + C\)

    \[ \int x^2\;dx = \frac{x^{2+1}}{2+1} + C = \frac{x^3}{3} + C \]
  2. We are being asked to find \(\int (2x + 6x^2) \;dx\). When integrating mulitple terms, we do each of them one in turn. This means that:

    \[\begin{split} \begin{aligned} \int(2x+6x^2)\;dx & = \int 2x\;dx + \int 6x^2\;dx \\ & 2\int x\;dx + 6\int x\;dx \\ & 2\frac{x^{1+1}}{1+1} + 6\frac{x^{2+1}}{2+1} + C \\ & = x^2 + 2x^3 + C \end{aligned} \end{split}\]
  3. First, we expand the brackets to produce \(x^2 + 3x\). Then we would integrat this to give:

    \[ \int(x^2+3x)\;dx = \frac{x^{2+1}}{2+1} + 3\frac{x^{1+1}}{1+1} + C = \frac{1}{3}x^3 + \frac{3}{2}x^2 + C \]

Similar to differentiation, the sympy library can be used to perform symbolic integration, using the integrate function.

from sympy import symbols, integrate

x = symbols('x')

integrate(x**2)
\[\displaystyle \frac{x^{3}}{3}\]
integrate(2 * x + 6 * x ** 2)
\[\displaystyle 2 x^{3} + x^{2}\]
integrate(x * (x + 3))
\[\displaystyle \frac{x^{3}}{3} + \frac{3 x^{2}}{2}\]

Be aware, that sympy drops the \(+C\) from the result of these integrations.


Integrating \(x^{-1}\)#

We recall that if we differentiate \(\ln(x)\), we get \(x^{-1}\). Since integration is the opposite of differentiation, when we integrate \(x^{-1}\), we get \(\ln(x)\).

\[ \int x^{-1}\;dx = \ln{|x|} + C \]

Example

Find the following integral:

\[ \int \frac{x^2+2x^3 - 4x^4}{x^3}\;dx \]

Solution: The fraction can be simplified, by dividing each term on the denominator by \(x^3\). This reduces the original integral into:

\[\begin{split} \begin{aligned} \int \frac{x^2+2x^3 - 4x^4}{x^3}\;dx & = \int\left(\frac{1}{x} + 2 - 4x\right)\;dx \\ & = \ln{|x|} + 2x + \frac{-4}{2}x^2 + C \\ & = \ln{|x|} + 2x - 2x^2 + C \end{aligned} \end{split}\]

Again, this is straightforward for sympy.

integrate((x ** 2 + 2 * x ** 3 - 4 * x ** 4) / (x ** 3))
\[\displaystyle - 2 x^{2} + 2 x + \log{\left(x \right)}\]