I want to integrate $$\int\frac{x}{x^2+4x+5}\;dx$$ and I tried to use partial fractions because $x^2+4x+5=(x+2+i)(x+2-i)$. Therefore: \begin{align} \frac{x}{x^2+4x+5}&=\frac{A}{x+2+i}+\frac{B}{x+2-i}\\ x&=A(x+2-i)+B(x+2+i)\\ &=(A+B)x+(2A+2B-Ai+Bi) \end{align} After solving for $A$ and $B$ using \begin{align} \begin{cases} A+B&=1\\ 2A+2B-Ai+Bi&=0 \end{cases}\Longleftrightarrow A=\frac{i+2}{2i}, B=-\frac{2-i}{2i} \end{align} I plugged the coefficients back into to equation. Hence I got \begin{align} \int\frac{i+2}{2i}\frac{1}{x+2+i}-\frac{2-i}{2i}\frac{1}{x+2-i}\;dx&=\frac{i+2}{2i}\int\frac{1}{x+2+i}\;dx-\frac{2-i}{2i}\int\frac{1}{x+2-i}\;dx\\ &=\frac{i+2}{2i}\ln{(x+2+i)}-\frac{2-i}{2i}\ln{(x+2-i)}+c \end{align} My question: I have never integrated a function with complex numbers before and I am wondering if this approach is valid and correct? Is it also possible to turn this antiderivative back into a function that only contains real values because I know that one can also write this antiderivative like $$\frac{1}{2}\ln{(x^2+4x+5)}-2\arctan{(x+2)}+c$$ Thanks in advance for your answer!
-
1It can be made to be valid, but you need a lot of machinery first if you have not done a course in undergraduate complex analysis. See e.g. this answer. – user10354138 Oct 13 '23 at 00:02
-
1Quoth my old prof Andy Lenard, "The study of complex analysis is the study of the logarithm function." This can be done by exclusively real techniques. – ncmathsadist Oct 13 '23 at 00:38
3 Answers
The trick is to note that the real and imaginary parts are independent in some sense for operators like addition, subtraction, scalar multiplication (and thus scalar integration).
Use ${Re}(.)$ i.e. the real part function. It has properties such as:
$ \displaystyle \int Re(f(x)) dx = Re \left (\int f(x) dx \right) $,
$Re(f+g) = Re(f) + Re(g) $, etc.
Everything you did with just complex rational functions is 100% legitimate.
It's also pretty easy to define integrals of complex valued functions defined on the reals, and the integral of the sum of two functions is still the sum of the separate integrals, so that parts legit too.
But when you say that some of these integrals yield the $\log( )$ function you've got to explain what you mean by the logarithm of complex numbers, and you have to choose branches of the log function and it gets messy.
And if you start applying rules for the logarithm that apply in the real case to the complex logarithm, you might get a valid answer or you might not, as many of them stop working in the complex case.
Personally, I think it's a lot easier to break it up as
$$\frac{x+2}{x^2+4x+5}+\frac{-2}{x^2+4x+5}$$
and the first term yields the log() after a simple u-substitution, with u equal to the denominator, and in the second one you can complete the square and get the classic arctan integral, all without worrying about complex logarithms.

- 10,615
-
Alright. Thanks for your comment but not introducing complex numbers to the function seems easier. At least in this case. – Fynn Zentner Oct 13 '23 at 17:13
Starting with the answer of OP, we rearrange it and get $$ \begin{aligned} I= & \frac{1}{2}[\ln (x+2+i)+\ln (x+2-i)] +\frac{1}{i}[\ln (x+2+i)-\ln (x+2-i)]+C \\ = & \frac{1}{2} \ln(x^2+4x+5) +\frac{1}{i} \ln \left|\frac{x+2+i}{x+2-i}\right|+C \end{aligned} $$ $$ \begin{aligned} \frac{1}{i} \ln \left[\frac{\sqrt{x^2+4 x+5} e^{i \tan ^{-1}\left(\frac{1}{x+2}\right)}}{\sqrt{x^2+4 x+5} e^{i \tan ^{-1}\left(\frac{-1}{x+2}\right)}}\right] = & \frac{1}{i} \ln \left[e^{2 i \tan ^{-1}\left(\frac{1}{x+2}\right)}\right] \\ = & \frac{1}{i} \cdot 2 i \tan ^{-1}\left(\frac{1}{x+2}\right) \\ = & -2 \tan ^{-1}(x+2) \end{aligned} $$ where the last step uses the identity : $\tan ^{-1} u+\tan ^{-1} \frac{1}{u}=\frac{\pi}{2}$.
Hence we have$$ I=\frac{1}{2} \ln \left(x^2+4 x+5\right)-2 \tan ^{-1}(x+2)+C $$

- 20,421
-
Thanks for your answer but how do you get $$\frac{1}{i}\ln{\left[\frac{\sqrt{x^2+4x+5}e^{i\tan^{-1}{\left(\frac{1}{x+2}\right)}}}{\sqrt{x^2+4x+5}e^{i\tan^{-1}{\left(\frac{-1}{x+2}\right)}}}\right]}$$ from $$\frac{1}{i}\ln{\left|\frac{x+2+i}{x+2-i}\right|}$$? – Fynn Zentner Oct 15 '23 at 22:41
-
Use the fact that very complex can be expressed in polar form :$z=r(\cos \theta+i\sin \theta)=re^{i\theta}$, where $r$ and $\theta$ are the modulus and argument of z. – Lai Oct 15 '23 at 23:24
-
You can learn from the link https://www.varsitytutors.com/hotmath/hotmath_help/topics/polar-form-of-a-complex-number – Lai Oct 15 '23 at 23:30