# How do you find the indefinite integral of int (x^2+2x+3)/(x^2+3x^2+9x)?

Aug 2, 2018

$\int \frac{{x}^{2} + 2 x + 3}{{x}^{2} + 3 {x}^{2} + 9 x} \mathrm{dx} = \frac{1}{4} x + \frac{1}{16} \ln \left(4 x + 9\right) - \frac{2}{3} \ln \left(| \frac{1}{\sqrt{{\left(\frac{8}{9} x + 1\right)}^{2} - 1}} + \frac{1}{\frac{8}{9} x + 1} |\right)$

#### Explanation:

$I = \int \frac{{x}^{2} + 2 x + 3}{{x}^{2} + 3 {x}^{2} + 9 x} \mathrm{dx}$
$= \int \frac{{x}^{2} + 2 x + 3}{4 {x}^{2} + 9 x} \mathrm{dx} = \frac{1}{4} \int \frac{4 {x}^{2} + 8 x + 12}{4 {x}^{2} + 9 x} \mathrm{dx}$
$= \frac{1}{4} \int \frac{\left(4 {x}^{2} + 9 x\right) + x + 12}{4 {x}^{2} + 9 x} \mathrm{dx}$

$= \frac{1}{4} \int 1 \mathrm{dx} + \frac{1}{4} \int \frac{x + 12}{4 {x}^{2} + 9 x} \mathrm{dx}$

$= \frac{1}{4} x + \frac{1}{4} \int \frac{x}{4 {x}^{2} + 9 x} \mathrm{dx} + \frac{1}{4} \int \frac{12}{4 {x}^{2} + 9 x} \mathrm{dx}$

$= \frac{1}{4} x + \frac{1}{16} \int \frac{4}{4 x + 9} \mathrm{dx} + \frac{3}{4} \int \frac{1}{{x}^{2} + \frac{9}{4} x} \mathrm{dx}$

For the first integral, let $X = 4 x + 9$
$\mathrm{dX} = 4 \mathrm{dx}$

So:

$I = \frac{1}{4} x + \frac{1}{16} \int \frac{1}{X} \mathrm{dX} + \frac{3}{4} \int \frac{1}{{\left(x + \frac{9}{8}\right)}^{2} - \frac{81}{64}} \mathrm{dx}$

Now let $x + \frac{9}{8} = \frac{9}{8} \sec \left(\theta\right)$

$\mathrm{dx} = \frac{9}{8} \sec \left(\theta\right) \tan \left(\theta\right) d \theta$, and because $\sec {\left(\theta\right)}^{2} - 1 = \tan {\left(\theta\right)}^{2}$::

$I = \frac{1}{4} x + \frac{1}{16} \ln \left(X\right) + \frac{3}{4} \int \frac{\frac{9}{8} \sec \left(\theta\right) \tan \left(\theta\right)}{\frac{81}{64} \tan {\left(\theta\right)}^{2}} d \theta$

$= \frac{1}{4} x + \frac{1}{16} \ln \left(X\right) + \frac{2}{3} \int \sec \frac{\theta}{\tan} \left(\theta\right) d \theta$

$= \frac{1}{4} x + \frac{1}{16} \ln \left(X\right) + \frac{2}{3} \int \frac{\frac{1}{\cos} \left(\theta\right)}{\sin \frac{\theta}{\cos \left(\theta\right)}} d \theta$

$= \frac{1}{4} x + \frac{1}{16} \ln \left(X\right) + \frac{2}{3} \int \frac{1}{\sin} \left(\theta\right) d \theta$

We have $\int \frac{1}{\sin} \left(\theta\right) d \theta = - \ln \left(| \cot \left(\theta\right) + \csc \left(\theta\right) |\right)$, you can have the proof here.

$I = \frac{1}{4} x + \frac{1}{16} \ln \left(X\right) - \frac{2}{3} \ln \left(| \cot \left(\theta\right) + \csc \left(\theta\right) |\right)$

$= \frac{1}{4} x + \frac{1}{16} \ln \left(4 x + 9\right) - \frac{2}{3} \ln \left(| \cot \left(\theta\right) + \csc \left(\theta\right) |\right)$

Because $\theta = {\sec}^{- 1} \left(\frac{8}{9} x + 1\right)$, $\cot \left(\theta\right) = \cos \left(\theta\right) \csc \left(\theta\right)$, $\cos \left({\sec}^{- 1} \left(x\right)\right) = \frac{1}{x}$ and $\csc \left({\sec}^{- 1} \left(x\right)\right) = \frac{1}{\sin} \left({\sec}^{- 1} \left(x\right)\right) = \frac{x}{\sqrt{{x}^{2} - 1}}$
(here is a proof that $\sin \left({\sec}^{- 1} \left(x\right)\right) = \frac{\sqrt{{x}^{2} - 1}}{x}$.),

$I = \frac{1}{4} x + \frac{1}{16} \ln \left(4 x + 9\right) - \frac{2}{3} \ln \left(| \frac{1}{\sqrt{{\left(\frac{8}{9} x + 1\right)}^{2} - 1}} + \frac{1}{\frac{8}{9} x + 1} |\right)$