Integration by Parts versus the Power Rule

Recently, a friend of mine asked for help on their calculus homework. The problem was to find $\int cos(ln \ x) \ dx$. However, I've never gotten around to memorizing the derivatives and integrals of the trig functions.

I know that you can do it using integration by parts, with $\int cos(ln \ x) \ dx = x \ cos(ln \ x) + \int sin(ln \ x) \ dx = x \ cos(ln \ x) + x \ sin(ln \ x) - \int cos(ln \ x) \ dx$, implying that $2\int cos(ln \ x) \ dx = x \ cos(ln \ x) + x \ sin(ln \ x)$, and thus that $\int cos(ln \ x) \ dx = \frac{x}{2}(cos(ln \ x) + sin(ln \ x)) + C$.

However, I used the power rule for integration (I think the technical name is Cavalieri's quadrature formula). $\int cos(ln \ x) \ dx = \int \frac{e^{i \ lnx}+e^{-i \ lnx}}{2} \ dx = \int \frac{x^{i}+x^{-i}}{2} \ dx = \frac{1}{2}(\frac{x^{i+1}}{i+1}+\frac{x^{1-i}}{1-i}) + C = \frac{x}{2}(\frac{x^{i}}{i+1}+\frac{x^{-i}}{1-i}) + C = \frac{x}{2}(\frac{x^{i}(1-i)+x^{-i}(1+i)}{2}) + C$, which is obviously equivalent to the previous answer.

Can I take it from this problem that the process of using the complex number definitions of the trig functions is valid for all such integrals? That is, does Cavalieri's quadrature formula ALWAYS work for complex numbers (aside from the obvious of x-1, which is why I am asking...)?

 PhysOrg.com science news on PhysOrg.com >> Front-row seats to climate change>> Attacking MRSA with metals from antibacterial clays>> New formula invented for microscope viewing, substitutes for federally controlled drug
 Recognitions: Science Advisor For any mathematical analysis (integration, etc.) using the exponential representation for trig. functions is always valid.
 Indeed, there is great interconnection between real and complex analysis. In fact, there is a rigorous method to calculate real integrals using complex analysis (using Cauchy's residue theorem).