# Integral of $\frac{1}{x^2+4}$ Different approach

underneath is a brief method of partial fractions integration on the problem given in the title

Using a standard trigonometric result it is known that: $$\int \frac{1}{x^2+4}dx=\frac{1}{2}\tan^{-1}(\frac{x}{2})+C$$ But also: $$\frac{1}{x^2+4}=\frac{A}{x+2i}+\frac{B}{x-2i}$$ Hence using partial fractions, $$1=A(x-2i)+B(x+2i)$$ Let $x=2i$ $$\therefore 1=4Bi$$ $$\text{Hence } B=\frac{-i}{4}$$ Let $x=-2i$ $$\therefore 1=-4Ai$$ $$\text{Hence } A=\frac{i}{4}$$ Hence, $$\frac{1}{x^2+4}=\frac{i}{4(x+2i)}-\frac{i}{4(x-2i)}$$ Or, $$\frac{1}{x^2+4}=\frac{i}{4}(\frac{1}{x+2i}-\frac{i}{x-2i})$$ Hence, it is quite easy to see that: \begin{align*} \int \frac{1}{x^2+4}dx &=\int \frac{i}{4}(\frac{1}{x+2i}-\frac{1}{x-2i}) dx\\ &=\frac{i}{4}\int \frac{1}{x+2i}-\frac{1}{x-2i} dx\\ &=\frac{i}{4}(\log(x+2i)-\log(x-2i))+C\\ \end{align*} We know that the principal value of log of a complex number can be calculated by the following formula: $$\log(x+yi)=\log(x^2+y^2)+arg(x+yi)$$ Hence, \begin{align*} \int \frac{1}{x^2+4}dx &=\frac{i}{4}(\log(x+2i)-\log(x-2i))+C\\ &=\frac{i}{4}(\log(x^2+4)+\arg(x+2i)-\log(x^2+4)-\arg(x-2i)+C\\ &=\frac{i}{4}(\arg(x+2i)-\arg(x-2i))+C\\ \end{align*} Now, consider cases. If x is bigger than 0, the argument of a complex number is always defined as $\arg(x+yi)=\tan^{-1}(\frac{y}{x})$ So our integral becomes $$\int \frac{1}{x^2+4}dx=\frac{i}{4}(\tan^{-1}(\frac{2}{x})-\tan^{-1}(\frac{-2}{x}))+C$$ And since arctan is an odd function \begin{align*} \int \frac{1}{x^2+4}dx&=\frac{i}{4}(2\tan^{-1}(\frac{2}{x}))+C\\&=\frac{i}{2}\tan^{-1}(\frac{2}{x})+C\\ \end{align*} Now, if $x$ is less than $0$ and $y$ is less than $0$ then argument of a complex number becomes $\tan^{-1}(\frac{y}{x})-\pi$ and if $x$ is less than $0$ and $y$ is more than $0$ the argument becomes $\tan^{-1}(\frac{y}{x})+\pi$ Also as in a previous case becasue arctan is an odd function, the integral becomes \begin{align*} \int \frac{1}{x^2+4}dx&=\frac{i}{4}(\tan^{-1}(\frac{2}{x})-\tan^{-1}(\frac{-2}{x})+2\pi)+C\\ &=\frac{i}{4}(2\tan^{-1}(\frac{2}{x})+2\pi)+C\\ &=\frac{i}{2}\tan^{-1}(\frac{2}{x})+D \end{align*} Hence $$\int \frac{1}{x^2+4}dx=\frac{i}{2}(\tan^{-1}\frac{2}{x}), x\in\mathbb R\ \land x\neq0$$

Now, obviously, it is not the same, as the trig identity, it has a pole at x=0 while the original integral doesn't and most importantly it is not a real number. This was done by me purely for recreational purposes but now it frustrates me.

Can it be done this way? Did I basically did a mistake or maybe I missed something crucial?. thanks in advance.

EDIT

After using the correct definition of principal value of log and nice property about arctan (both given to me by you guys)

we know that

$$\log(x+yi)=\frac{1}{2}\log(x^2+y^2)+i\arg(x+yi)$$ and hence *** becomes $$\frac{i}{4}(i(\arg(x+2i)-\arg(x-2i)))$$ =$$\frac{-1}{4}((\arg(x+2i)-\arg(x-2i)))$$

So the answe becomes $$\int \frac{1}{x^2+4}dx=\frac{-1}{2}\tan^{-1}(\frac{2}{x})+D$$

And since $$\tan^{-1}(\frac{2}{x})=\frac{\pi}{2}-\tan^{-1}(\frac{x}{2})$$ the result is $$\int \frac{1}{x^2+4}dx=\frac{-1}{2}(\frac{\pi}{2}-\tan^{-1}(\frac{x}{2}))+D$$ OR$$\int \frac{1}{x^2+4}dx=\frac{1}{2}\tan^{-1}(\frac{x}{2})+E$$ as required

Thanks :)

• It can be done this way. I don't have time now to go through all your working, but there's definitely an error with this step: $\log (x + yi) = \frac 12 \log (x^2 + y^2) + i\cdot \arg(x + yi)$ should be the correct expression (for the principal logarithm). See if that resolves anything. – Deepak Dec 1 '15 at 23:45
• I believe $arg(x+yi) \neq tan^{-1}(x/y)$, but rather, $arg(x+yi)=tan^{-1}(y/x)$, so you have $2/x$ where you should have $x/2$. This is in addition to the missing factor of $i$ identified in the previous comment. – David K Dec 2 '15 at 0:01
• yes that is true, that was a typo that I did and forgot to correct. I said it once that it is arctan(x/y) but used the correct definition throughout and that is why we and up with 2/x instead of x/2 – Scavenger23 Dec 2 '15 at 0:06

For those kinds of integrals, for how many ideas one might have, the simplest way to proceed is to collect first the constant you have in the denominator:

$$\frac{1}{x^2 + 4} = \frac{1}{4\cdot \left(\frac{x^2}{4} + 1\right)}$$

Remember about the $\frac{1}{4}$ factor, that you bring out of the integral.

Now use the substitution $y = \frac{x}{2}$ so $\text{d}y = \frac{1}{2}\text{d}x$

Result integration: $\int \frac{1}{y^2 + 1}\text{d}y = \arctan(y)$

The final result will be then

$$\frac{1}{2}\arctan\left(\frac{x}{2}\right)$$

Moreover your expression about the complex logarithm is wrong. The right one is:

$$\boxed{\log(a + ib) = \frac{1}{2}\log(a^2 + b^2) + i\ \text{Arg}(x + ib)}$$

• I know how to solve this integral which I stated in the first line of the work, however just tried something different. Thank you for giving me heads up on the log value though. I used wikipedia as a source en.wikipedia.org/wiki/Complex_logarithm and under the definition of a principal value it gives what I written down? Unless I dont understand something? Can you explain it to me please? – Scavenger23 Dec 1 '15 at 23:59

Also $$tan^{-1}(\frac 2x )= cot^{-1}(\frac x2 ) = \frac \pi 2 -tan^{-1}(\frac x2 )$$

• Ok, so using what you said and the correct definition of principal value of log I will have $\frac{-1}{2}(\frac{pi}{2}-atan(\frac{x}{2})$ merge pi/4 with a constant D and weve got the correct solution. Thank you :) – Scavenger23 Dec 2 '15 at 0:04