Let us consider some functions of a quadratic trinomial. We express the trinomial as a sum or difference of squares and then proceed to integrate the given function.

Example. \(\begin{aligned}
\int{\frac{dx}{x^{2}+2x+5}}
\end{aligned}\)

Solution. We can simplify the quadratic trinomial \(x^{2}+2x+5\) as,

\(\begin{aligned}
x^{2}+2x+5&=x^{2}+2(x)(1)+1^{2}+4\\
&=(x+1)^{2}+2^{2}
\end{aligned}\)

We make the substitution \(x+1=t\).

\(\begin{aligned}
I&=\int{\frac{dx}{(x+1)^{2}+2^{2}}}\\
&=\int{\frac{dt}{t^{2}+2^{2}}}\\
&=\frac{1}{2}\arctan\left(\frac{t}{2}\right)+C\\
&=\frac{1}{2}\arctan\left(\frac{x+1}{2}\right)+C
\end{aligned}\)

Some more examples follow.

Example. \(\begin{aligned}
\int{\frac{dx}{x^{2}+3x+1}}
\end{aligned}\)

Solution. We can simplify the quadratic trinomial \(x^{2}+3x+1\) as,

\(\begin{aligned}
x^{2}+3x+1&=\frac{1}{3}\left(x^{2}+2(x)\left(\frac{3}{2}\right)+\left(\frac{3}{2}\right)^{2}+1-\left(\frac{3}{2}\right)^{2}\right)\\
&=\left(x+\frac{3}{2}\right)^{2}-\frac{5}{4}\\
&=\left(x+\frac{3}{2}\right)^{2}-\left(\frac{\sqrt{5}}{2}\right)^{2}
\end{aligned}\)

We make the substitution \(x+3/2=t\).

\(\begin{aligned}
I&=\int{\frac{dx}{\left(x+\frac{3}{2}\right)^{2}-\left(\frac{\sqrt{5}}{2}\right)^{2}}}\\
&=\int{\frac{dt}{t^{2}-\left(\frac{\sqrt{5}}{2}\right)^{2}}}\\
&=\frac{1}{\sqrt{5}}\left[\int{\frac{dt}{t-\frac{\sqrt{5}}{2}}}-\int{\frac{dt}{t+\frac{\sqrt{5}}{2}}}\right]\\
&=\frac{1}{\sqrt{5}}\ln\left(t-\frac{\sqrt{5}}{2}\right)-\frac{1}{\sqrt{5}}\ln\left(t+\frac{\sqrt{5}}{2}\right)+C\\
&=\frac{1}{\sqrt{5}}\ln\left(\frac{t-\frac{\sqrt{5}}{2}}{t+\frac{\sqrt{5}}{2}}\right)+C\\
&=\frac{1}{\sqrt{5}}\ln\left(\frac{x+\frac{3}{2}-\frac{\sqrt{5}}{2}}{x+\frac{3}{2}+\frac{\sqrt{5}}{2}}\right)+C\\
&=\frac{1}{\sqrt{5}}\ln\left(\frac{2x+3-\sqrt{5}}{2x+3+\sqrt{5}}\right)+C
\end{aligned}\)

Example. \(\begin{aligned}
\int{\frac{(3x-2)dx}{5x^{2}-3x+2}}
\end{aligned}\)

Solution. We can simplify the quadratic trinomial \(5x^{2}-3x+2\) as,

\(\begin{aligned}
5x^{2}-3x+2&=5\left[x^{2}-\frac{3}{5}x+\frac{2}{5}\right]\\
&=5\left[x^{2}-2x\left(\frac{3}{10}\right)+\left(\frac{3}{10}\right)^{2}+\frac{2}{5}-\left(\frac{3}{10}\right)^{2}\right]\\
&=5\left[\left(x-\frac{3}{10}\right)^{2}+\left(\frac{\sqrt{31}}{10}\right)^{2}\right]
\end{aligned}\)

Also, note that :

\(\begin{aligned}
\frac{d}{dx}(5x^{2}-3x+2)=10x-3
\end{aligned}\)

We compute the indefinite integral as :

\(\begin{aligned}
I&=\frac{3}{10}\int{\frac{(10x-3)dx}{5x^{2}-3x+2}}+\frac{1}{5}\int{\frac{\frac{9}{10}-2}{(x-3/10)^{2}+(\sqrt{31}/{10})^{2}}dx}\\
&=\frac{3}{10}\int{\frac{(10x-3)dx}{5x^{2}-3x+2}}-\frac{11}{50}\int{\frac{dx}{(x-3/10)^{2}+(\sqrt{31}/{10})^{2}}}\\
&=\frac{3}{10}\ln({5x^{2}-3x+2})-\frac{11}{50}\cdot\frac{1}{\sqrt{31}/{10}}\arctan\left(\frac{x-3/10}{\sqrt{31}/{10}}\right)\\
&=\frac{3}{10}\ln({5x^{2}-3x+2})-\frac{11}{5\sqrt{31}}\arctan\left(\frac{10x-3}{\sqrt{31}}\right)
\end{aligned}\)

Example. \(\begin{aligned}
\int{\frac{dx}{\sqrt{1+x+x^{2}}}}
\end{aligned}\)

Solution. We can simplify the quadratic trinomial \(1+x+x^{2}\) as,

\(\begin{aligned}
1+x+x^{2}&=1+2\cdot{x}\cdot\frac{1}{2}+x^{2}\\
&=\frac{3}{4}+\left(\frac{1}{2}\right)^{2}+2\cdot{x}\cdot\frac{1}{2}+x^{2}\\
&=\left(\frac{\sqrt{3}}{2}\right)^{2}+\left(x+\frac{1}{2}\right)^{2}
\end{aligned}\)

We compute the indefinite integral as :

\(\begin{aligned}
I&=\int{\frac{dx}{\sqrt{\left(\frac{\sqrt{3}}{2}\right)^{2}+\left(x+\frac{1}{2}\right)^{2}}}}\\
&=\ln\left(x+\frac{1}{2}+\sqrt{1+x+x^{2}}\right)+C
\end{aligned}\)

Example. \(\begin{aligned}
\int{\frac{(3x+5)dx}{\sqrt{x(2x-1)}}}
\end{aligned}\)

Solution. We can simplify the quadratic trinomial \(x(2x-1)\) as,

\(\begin{aligned}
x(2x-1)&=2x^{2}-x\\
&=2\left[x^{2}-\frac{x}{2}\right]\\
&=2\left[x^{2}-2x\frac{1}{4}+\left(\frac{1}{4}\right)^{2}-\left(\frac{1}{4}\right)^{2}\right]\\
&=2\left[\left(x-\frac{1}{4}\right)^{2}-\left(\frac{1}{4}\right)^{2}\right]
\end{aligned}\)

Also, the derivative of the quadratic polynomial is:

\(\begin{aligned}
\frac{d}{dx}(2x^{2}-x)&=4x-1
\end{aligned}\)

And we have :

\(\begin{aligned}
3x+5&=\frac{3}{4}(4x-1)+\frac{23}{4}
\end{aligned}\)

Thus, we can compute the indefinite integral as:

\(\begin{aligned}
I&=\frac{3}{4}\int{\frac{(4x-1)dx}{\sqrt{x(2x-1)}}}+\frac{23}{4\sqrt{2}}\int{\frac{dx}{\sqrt{\left(x-\frac{1}{4}\right)^{2}-\left(\frac{1}{4}\right)^{2}}}}\\
&=\frac{3}{4}\cdot{2\sqrt{x(2x-1)}}+\frac{23}{4\sqrt{2}}\ln\left(x-\frac{1}{4}+\sqrt{\left(x-\frac{1}{4}\right)^{2}-\left(\frac{1}{4}\right)^{2}}\right)+C\\
&=\frac{3}{2}\sqrt{x(2x-1)}+\frac{23}{4\sqrt{2}}\ln\left(4x-1+\sqrt{x(2x-1)}\right)+C\\
\end{aligned}\)