Finding Integrals Containing \(x^{2}+x+1\)

Find

  1. \(\int \dfrac{dx}{x^{2}+x+1}\)
  2. \(\int \dfrac{x\,dx}{x^{2}+x+1}\)

Solution (a) The integrand contains the quadratic expression \(x^{2}+x+1\). So, we complete the square in the denominator. \[ \begin{eqnarray*} \int \dfrac{dx}{x^{2}+x+1}\underset{\underset{\color{#0066A7}{\hbox{Complete the square}}}{\color{#0066A7}{\uparrow}}} {=}\int \dfrac{dx}{\left( x^{2}+x+\dfrac{1}{4} \right) +\left( 1-\dfrac{1}{4}\right) }=\int \dfrac{dx}{\left( x+\dfrac{1}{2} \right) ^{2}+\dfrac{3}{4}}\\[-2.1pc] \end{eqnarray*} \]

\(\int \dfrac{du}{u^2+a^2} = \dfrac{1}{a}\tan^{-1} \dfrac{u}{a} + C\)

Now we use the substitution \(u=x+\dfrac{1}{2}\). Then \(du=dx\). \[ \begin{eqnarray*} \int \dfrac{dx}{x^{2}+x+1}&=&\int \dfrac{dx}{\left( x+\dfrac{1}{2}\right) ^{2}+\dfrac{3}{4}}=\int \dfrac{du}{u^{2}+\dfrac{3}{4}} \qquad {\color{#0066A7}{\hbox{\(a=\dfrac{\sqrt{3}}{2}\)}}} \\ &=& \dfrac{1}{\dfrac{\sqrt{3}}{2}} \tan^{-1} \dfrac{u}{\dfrac{\sqrt{3}}{2}} + C = \dfrac{2}{\sqrt{3}}\tan^{-1} \dfrac{2u}{\sqrt{3}} +C\\ &=&\dfrac{2\sqrt{3}}{3}\tan ^{-1} \dfrac{2x+1}{\sqrt{3}} +C\qquad {\color{#0066A7}{\hbox{\(u=x+\dfrac{1}{2}\)}}} \end{eqnarray*} \]

We could also complete the square and let \(u=x+\dfrac{1}{2}\).

(b) This problem requires some imagination. We force the derivative of the denominator to appear in the numerator by using the following algebraic manipulations: \[ \begin{array}{@{\hspace*{0pt}}rcl@{\qquad}l} \int \dfrac{x~dx}{x^{2}+x+1} &=&\dfrac{1}{2}\int \dfrac{2x~dx}{x^{2}+x+1} & {\color{#0066A7}{\hbox{Multiply the integrand by \(\dfrac{2}{2}.\)}}} \\ &=&\dfrac{1}{2}\int \dfrac{[ ( 2x+1) -1] dx}{x^{2}+x+1} & {\color{#0066A7}{\hbox{Add and subtract 1 in}}} \\[-6pt] &&&{\color{#0066A7}{\hbox{the numerator to get \(2x+1\).}}}\\ &=&\dfrac{1}{2}\int \dfrac{( 2x+1) dx}{x^{2}+x+1}-\dfrac{1}{2}\int \dfrac{dx}{x^{2}+x+1} & {\color{#0066A7}{\hbox{Write the integral as the}}}\\[-6pt] &&&{\color{#0066A7}{\hbox{sum of two integrals.}}} \end{array} \]

\(\int \dfrac{g'(x)}{g(x)}\,dx = \ln |g(x)| +C \)

Now we find each integral separately. We found the integral on the right in (a). In the integral on the left, the numerator equals the derivative of the denominator. \[ \begin{eqnarray*} \frac{1}{2}\int \dfrac{( 2x+1) dx}{x^{2}+x+1}&=& \frac{1}{2}\ln \left\vert x^{2}+x+1\right\vert \end{eqnarray*} \]

So, \[ \begin{eqnarray*} \int \dfrac{x~dx}{x^{2}+x+1} &=&\dfrac{1}{2}\int \dfrac{\left( 2x+1\right) dx}{x^{2}+x+1}-\dfrac{1}{2}\int \dfrac{dx}{x^{2}+x+1}\\[5pt] &=&\dfrac{1}{2}\ln \left\vert x^{2}+x+1\right\vert -\dfrac{1}{2}\left[ \dfrac{2\sqrt{3}}{3}\tan ^{-1} \dfrac{2x+1}{\sqrt{3}} \right] +C \nonumber \\[5pt] &=&\dfrac{1}{2}\ln \left\vert x^{2}+x+1\right\vert -\dfrac{\sqrt{3}}{3}\tan ^{-1} \dfrac{2x+1}{\sqrt{3}} +C \end{eqnarray*} \]