[Math] Why is treating $i$ as a constant in integration, valid

complex numbersintegration

Why do we, when doing integrals like $\int i\cos xdx$, treat $i$ to be a constant? Is there any proof? Wolfram gives the answer simply as $i\sin x+\text{[constant]}$.
I have a confusion, because integration is just the reverse of finding derivatives, i.e, Let $f(x)$ be a function, in differentiation, we find $f'(x)$, but in integration, we find $F(x)$, where $F$ is the antiderivative of $f$. But that is in the real plane (Cartesian co-ordinates). Definition of derivatives also is defined in real plane. But then how can we do that in complex plane, when it is not defined for it.
Am I missing something? Please clear my doubts.
Thank you in advance.

Best Answer

One can use fancier terms, but what you want to do is to extend integration (and differentiation) from real-valued functions to complex-valued functions. It is natural to do so in a way that preserves linearity (but with linearity over $\mathbf C$ instead of $\mathbf R$).

Every complex-valued function (of a real variable $x$) can be written as $$ f(x)=g(x)+ih(x) $$ where $g$ and $h$ are real valued. Assuming that we have defined differentiation for real-valued functions only, it is natural to define $$ f'(x)=g'(x)+ih'(x). $$ A consequence is that $$ \int g(x)+ih(x)\,dx=\int g(x)\,dx+i\int h(x)\,dx. $$ Luckily, this fits very well with all rules of calculations you are familiar with, and maybe that is why it is confusing. It also fits when you do definite integrals, since also there, you can divide into real and imaginary part and do Riemann sums on each part...

Finally, your integral $\int i\cos x\,dx$ is therefore $$ \int i\cos x\,dx=i\int \cos x\,dx=i\sin x+C. $$